How can we make playlist repeateable continuously in AVPlayer
Question
hi Friends I am using AVPlayer but in it I want to play .mov file continuously repeatable.So I want to use seekToTime but cant get proper idea so please any one tell me how?
Solution
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];
}
OTHER TIPS
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()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow