0

I am using AVPlayerDemo open source code for play back of chosen video. The reason why I am using AVPlayerDemo is seeking of each frame is easy compared to MPMoviePlayerController.

In the AVPlayerDemo sample code , I have added a button "Next" where the click on "Next" will make the video to advance to the next frame.

I have got a problem on advancing to the next frame , when the user is at the first frame of the video

When the video's nominalFrameRate is 30 , from the above logic to seek to next frame , the log is mentioned below, on click of "Next" button does not advance the video.

user1305194
  • 9
  • 1
  • 6
  • Once the user manually scrubs to the second (or any later) frame there is no problem. current time {2002/30000 = 0.067} , one frame time {1001/30000 = 0.033, rounded} added time {3003/30000 = 0.100, rounded} the video will be seeked to the next frame with out any issues. When frame rate is 24 , video is not seeked to the next frame. , from the above the log is mentioned below current time {0/1 = 0.000} one frame time {0/1 = 0.000, rounded} added time {0/1 = 0.000, rounded} Am I missing some thing here ? – user1305194 Sep 03 '12 at 11:57
  • Advancing is calculated as below , CMTime currentTime = [mPlayerItem currentTime]; NSLog(@"********************** current time ******************** "); CMTimeShow(currentTime); CMTime oneFrame = CMTimeMakeWithSeconds(1.0 / mFrameRate, currentTime.timescale); NSLog(@"********************** one frame ************* ******* "); CMTimeShow(oneFrame); CMTime added = CMTimeAdd(currentTime, oneFrame); NSLog(@"********************** added ******************** "); CMTimeShow(added); [mPlayer seekToTime:added toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero]; – user1305194 Sep 03 '12 at 11:58

0 Answers0