mgv
mgv

Reputation: 347

How to play a video starting from specific point on iOS 9

I'm playing video using MPMoviePlayerController and I need to play it starting from a given point by this code:

MPMoviePlayerController *player;

[player setCurrentPlaybackTime:from];
[player setInitialPlaybackTime:from];
[player setEndPlaybackTime:to];

[player prepareToPlay];
[player play];

But it doesn't work, the video always plays from beginning. I've seen on Apple Docs that initialPlaybackTime is deprecated in iOS 9 (as well as endPlaybackTime). Does it mean than it will not work on iOS 9? I tried to run this code on iOS 8.4, but the result is the same: the video always plays from the very beginning.

How to make it play from a given point?

Thank you!

Upvotes: 2

Views: 887

Answers (1)

Pulkit Sharma
Pulkit Sharma

Reputation: 555

Use AVPlayer instead of MPMoviePlayer. It will give you more control over Media playback.

See this (AVPlayer)

Upvotes: 1

Related Questions