Resume AVPlayer after forwardPlaybackEndTime

I created AVPlayerand installed forwardPlaybackEndTimeto make a local video stop at a given timestamp. Of course, the video stops at the time I requested. Things are good.

Now I want the video to continue when it was initiated by a user action (for example, clicking a button). Unfortunately, I cannot seem that this will happen without restarting the video from the very beginning.

I will show you all the AVPlayer installation code (which is mainly taken from the AV Foundation Programming Guide ), but given these variables

AVPlayer *avPlayer;
AVPlayerItem *playerItem;

I can set the end time as follows:

[playerItem setForwardPlaybackEndTime: CMTimeMake(30, 30)];

To try to renew, I tried this:

[playerItem setForwardPlaybackEndTime: CMTimeMake(30, 30)];
[avPlayer setRate: 1.0];

. play. . seekToTime , , . .

- , ? !

0
1

forwardPlaybackEndTime , kCMTimeInvalid, .

[playerItem setForwardPlaybackEndTime: kCMTimeInvalid];
[playerItem seekToTime: CMTimeMake(30, 30) toleranceBefore: kCMTimeZero toleranceAfter: kCMTimeZero];
[avPlayer play];
+1

All Articles