AVPlayer 重複播放
- 步驟1: 設置 actionAtItemEnd.
- 步驟2: 監聽 AVPlayerItemDidPlayToEndTimeNotification Notification.
_player = [AVPlayer playerWithPlayerItem:item];
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone; // set this
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(__playerItemDidPlayToEndTimeNotification:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:nil];
- (void)__playerItemDidPlayToEndTimeNotification:(NSNotification *)sender
{
[_player seekToTime:kCMTimeZero]; // seek to zero
}
本文标题:AVPlayer 重複播放
本文链接:https://www.haomeiwen.com/subject/ywrjhttx.html
网友评论