嗨朋友我正在使用 AVPlayer 但我想在其中播放 .mov 文件连续可重复。所以我想使用 seekToTime 但无法得到正确的想法所以请任何人告诉我怎么做?
问问题
2248 次
2 回答
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];
}
于 2011-05-03T07:17:19.953 回答
-3
对于 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()
于 2017-11-14T07:04:19.960 回答