hi Friends I am using AVPlayer but in it I want to play .mov file continuously r开发者_开发问答epeatable.So I want to use seekToTime but cant get proper idea so please any one tell me how?
player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[player currentItem]];
- (void)playerItemDidReachEnd:(NSNotification *)notification{
AVPlayerItem *p = [notification object];
[p seekToTime:kCMTimeZero];
}
For iOS 10+ you can use AVPlayerLooper
Sample from Apple documentation:
let asset = // AVAsset with its 'duration' property value loaded
let playerItem = AVPlayerItem(asset: asset)
// Create a new player looper with the queue player and template item
playerLooper = AVPlayerLooper(player: queuePlayer, templateItem:playerItem)
// Begin looping playback
queuePlayer.play()
精彩评论