美文网首页
AVPlayer 重複播放

AVPlayer 重複播放

作者: ShinrenPan | 来源:发表于2015-11-30 13:38 被阅读571次
    • 步驟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