iOS:反向AVPlayer播放直到开头,不调用AVPlayerItemDidPlayToEndTimeNotification

时间:2017-07-31 20:49:22

标签: ios avplayer reverse playback

我收到了覆盖当前iOS / tvOS上的预期行为的请求,但我无法使其正常工作。

正如标题所说,我喜欢将播放转换为开头,而不会触发播放结束的通知。这是我所拥有的代码片段。

AVPlayer player = [self generatePlayer];
playerItem = [self generatePlayerItem];
//playerItem.reversePlaybackEndTime = kCMTimeInvalid;
[player replaceCurrentItemWithPlayerItem:playerItem]
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:player.currentItem];
[player play];
...
//on rewind
player.rate = -1;
....
//upon currentTime = 0 on rewind, playerItemDidReachEnd is called

我需要建议在这里更改哪些代码,以便完成我想要的任务。我认为reversePlaybackEndTime属性是答案,但它不允许我在其中设置否定CMTime

0 个答案:

没有答案