Iphone 如何使播放列表在AVPlayer中连续可重复
嗨,朋友们 我使用的是AVPlayer,但我想在其中连续播放.mov文件。所以我想使用seekToTime,但不能得到正确的想法,所以请任何人告诉我如何 对于iOS 10+您可以使用Iphone 如何使播放列表在AVPlayer中连续可重复,iphone,avplayer,Iphone,Avplayer,嗨,朋友们 我使用的是AVPlayer,但我想在其中连续播放.mov文件。所以我想使用seekToTime,但不能得到正确的想法,所以请任何人告诉我如何 对于iOS 10+您可以使用 player.actionAtItemEnd = AVPlayerActionAtItemEndNone; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:
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];
}
苹果文档中的示例:
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()
只需编写->>self.moviePlayer.repeatMode=YES;