Search code examples
iphonevideompmovieplayercontrollermpmovieplayeravqueueplayer

set seek time in AVQueuePlayer in iphone


I am developing an application in that I want to play two video at the same time, That is not possible using MPMoviePlayer. So I have used AVQueuePlayer To play video. As I am success to play video but the problem is in jumping to particular time. For that we have method call seekToTime and we need to variable of the CMTime datatype.

I am able to jump at time in 1,2,3 seconds etc, My problem that I want to jump at Time 1.2, 1.3 , 1.4 second etc. but I am not able to move the video at that time.

Can any one know the solution of this problem than please help me to solve the problem.


Solution

  • The seekToTime: method, however, is tuned for performance rather than precision. If you need to move the playhead precisely, instead you use seekToTime:toleranceBefore:toleranceAfter Reference


    toleranceBefore: The accuracy of the time before to which you would like to move the playback cursor.
    [time-beforeTolerance]

    toleranceAfter: The accuracy of the time after to which you would like to move the playback cursor.
    [time+afterTolerance]

    Lets say both parameters represents the margin of in-accuracy.

    I have seen other Question on SO using self.player.currentItem.asset.duration to get the duration.

    Good Luck.