AVPalyer默认观察员跟踪视频的当前时间,当您暂停或恢复播放视频,你可以得到通过使用一个全局变量来暂停时间(在观察者更新该变量的情况下)
CMTime interval = CMTimeMake(1,1);
//The capture of self here is coming in with your implicit property access of self.currentduration - you can't refer to self or properties on self from within a block that will be strongly retained by self.
//You can get around this by creating a weak reference to self before accessing timerDisp inside your block
__weak typeof(self) weakSelf = self;
self.timeObserverToken = [_player addPeriodicTimeObserverForInterval:interval queue:NULL usingBlock: ^(CMTime time)
{
_currentDuration = (int)CMTimeGetSeconds (_player.currentTime);
if(!_isPlaying)
{
_pausedDuration = _currentDuration;
}
}
有一种方法来监视是否AVPlayer播放这里列出:http://stackoverflow.com/a/9288642/2383604 –