Loop AVPlayerItem in presented AVPlayerViewController



我正在使用AVPlayerViewController以全屏模式显示我的视频。在我的BaseController中,我已经实施了AVPlayerItemAVPlayer。我已经添加了self.playerItem.actionAtItemEnd = AVPlayerActionAtItemEnd.None ,并且正在为AVPlayerItemDidPlayToEndTimeNotification添加通知。问题是,那是在BaseController而不是AVPlayerViewController.阅读Apple文档,子类化AVPlayerViewController有严格的NO。

重要 不要子类化 AVPlayerViewController。重写此类的方法不受支持,并导致未定义的行为。

检测已完成AVPlayerViewController AVPlayerItem以便我可以设置seekToTime(kCMTimeZero)的最佳方法是什么?我可以使用AVPlayer将其添加为子视图并循环播放视频,但我希望能够从AVPlayerViewController循环播放视频

试试这个人:

- (void)playerItemDidReachEnd:(NSNotification *)notification {
AVPlayerItem *p = [notification object];
[p seekToTime:kCMTimeZero];}

最新更新