Reputation: 3464
Can any one help me to seek at particular time in AVQueuePlayer
?
I have use this controller to play video in iPhone because i need to play two video at the same time. But my problem is to navigate in video and jump to at particular time, I am not able to do that.
I Know the method the That is [controller seekToTime:(CMTime)]
But it is not moving the video at exact position of the video.
Does any one know the solution?
Upvotes: 3
Views: 1530
Reputation: 94794
This is stated in the documentation for seekToTime:
:
The time seeked to may differ from the specified time for efficiency. For sample accurate seeking see
seekToTime:toleranceBefore:toleranceAfter:
.
So try using seekToTime:toleranceBefore:toleranceAfter:
instead, specifying a low or zero tolerance. You may also want to specify true for AVURLAssetPreferPreciseDurationAndTimingKey
when creating any AVURLAssets you may be using.
Upvotes: 2
Reputation: 8243
Update... I ended up doing hackery and not being especially pleased with the results--the snap-through-black between movies may or may not show, and because I was bad and didn't inquire as to the load status etc it's possible to get many things confused.
But for straight looping an AVQueuePlayer assetItem it works to set a boundaryTime observer and use that to rewind the assetItem. My stuff is only a few seconds long so the seekToTime is pretty seamless, I don't know what it'll do seeking on a longer asset. looping an assetItem in AVQueuePlayer
Upvotes: 1