How to start movie playback at a certain frame or position in time, using MPMoviePlayerController?
The MPMediaPlayback protocol seems to not define any helpful method for this, and I couldn't find one in the MPMoviePlayerController. But I guess there IS a way to do it, because users must be able to drag the slider to some point in time when playing a movie.
Yesterday I was reading a blog post that claimed the MPMovieController could do exac开发者_运维问答tly that. Unfortunately I didn't bookmark it...
For example, I would want to start the movie programmatically at 20 seconds.
Does anyone know how to do it?
BTW, it's non-streaming content!
There's a currentPlaybackTime property accessible in the MPMediaPlayback protocol, simply set it with the chosen position in the movie (e.g. 20.0 for 20 seconds into the movie)
If you want to restrict the playback range, set initialPlaybackTime
and endPlaybackTime
. Playback will automatically start at the "initial" time.
IIRC the scrubber control is slightly broken on 3.1.
精彩评论