添加KVO
了AVPlayer
何时按原样播放queuePlayer
视频AVPlayer
[self.queuePlayer addObserver:self forKeyPath:@"status" options:0 context:NULL];
observer
method
:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:@"status"]) {
if (self.queuePlayer.status == AVPlayerStatusReadyToPlay) {
NSInteger step = (NSInteger)(startTimeForVideo/0.04);
[self.queuePlayer.currentItem stepByCount:step];
//CMTime seekTime = CMTimeMake(startTimeForVideo*timeScale,timeScale);
//if (CMTIME_IS_VALID(seekTime))
// [self.queuePlayer seekToTime:seekTime toleranceBefore:kCMTimePositiveInfinity toleranceAfter:kCMTimePositiveInfinity];
//else
// NSLog(@"In valid time");
[self.queuePlayer play];
} else if (self.queuePlayer.status == AVPlayerStatusFailed) {
/* An error was encountered */
}
}
这里startTimeForVideo
最初playBack time
用于video
seekToTime
也不工作stepByCount
编辑:用于Values
是和即使object
methods
correct
no luck