Question

Is it possible to use chapters in videos for the iPhone in an application?

For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s.

Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s to 95s?

My question is not about how to add chapters to a video. I want to know if this behaviour is available on the iphone.

Was it helpful?

Solution

iPhone SDK 3.0+ has a new MPMoviePlayerController.initialPlaybackTime property for setting the time to start movie playback. This will be "rounded" to the nearest earlier keyframe time, so does not provide exact start positioning, but pretty close.

OTHER TIPS

player.currentPlaybackTime = time;

This is definitely possible sending the non-documented message setCurrentTime to MPMoviePlayerController. It takes one parameter of type double which specifies the playback position in seconds. Find below a short example:

Extend the MPMoviePlayerController to avoid compiler warnings:

@interface MPMoviePlayerController (extended)
-(void)setCurrentTime:(double)seconds;
@end

Then you can call it wherever you need it - before start or during playback.

MPMoviePlayerController* player = [[ MPMoviePlayerController alloc] initWithContentURL:url ];
[ player setCurrentTime:95.0 ];
[ player play ];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top