开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜