Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVPlayer seektoTime iPhone

I have used seekToTime in my application and its working properly. But I want to have some more information about it. Which is, if I have a streaming video file of 1 minute now I want to play it from second 15th to second 45 (first 15 seconds and the last 15 seconds will not play).

How can I do it?

I know that by use of seekToTime I can play a video from 15th second but how to stop it at 45th second and also get noticed by the method that the video has played for the specified time period?

CMTime timer = CMTimeMake(15, 1);
[player seekToTime:timer];

The above code takes me to the 15th second of the streaming file but how to stop it on 45th second and get notified too?

I have searched a lot but couldn't get any info.

Thanks

EDIT:

As @codeghost suggested, simply use forwardPlaybackEndTime.

You can simply use:

yourAVPlayerItem.forwardPlaybackEndTime = CMTimeMake(10, 1);

Here 10 is the time till the AVPlayerItem will play.

like image 540
Omer Waqas Khan Avatar asked May 16 '12 08:05

Omer Waqas Khan


1 Answers

Set the forwardPlaybackEndTime property on your AVPlayerItem.

like image 106
codeghost Avatar answered Sep 19 '22 02:09

codeghost