嗨朋友们 我正在使用AVPlayer,但在其中我想播放.mov文件连续可重复。所以我想使用seekToTime但不能得到正确的想法所以请任何人告诉我如何?
答案 0 :(得分:4)
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];
}
答案 1 :(得分:-2)
对于iOS 10+,您可以使用AVPlayerLooper
Apple文档中的示例:
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()