4

ビデオをそのまま再生する場合KVOに追加AVPlayerqueuePlayerAVPlayer

[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 timevideo

seekToTimeどちらも機能していませんstepByCount

EDIT :Valuesobject使用されてmethodsいるcorrectno luck

4

1 に答える 1