Chapters in video for iPhone

Can I use chapters in video for iPhone in the app?

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

Is it possible to start playing a video in 50 seconds (chapter 2) to the end? Can I make him play only in chapter 2 for 50 to 95 seconds?

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

+3
source share
3 answers

The iPhone SDK 3.0+ has a new MPMoviePlayerController.initialPlaybackTime property to set the start time for movie playback. This will be rounded to the nearest early time of the keyframe, therefore it does not provide exact positioning of the beginning, but rather close.

+4

player.currentPlaybackTime = ;

+2

It is certainly possible to send an undocumented setCurrentTime message to MPMoviePlayerController. It takes one parameter of type double, which determines the playback position in seconds. The following is a short example:

Extend MPMoviePlayerController to avoid compiler warnings:

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

Then you can call it where you need it - before launching or during playback.

MPMoviePlayerController* player = [[ MPMoviePlayerController alloc] initWithContentURL:url ];
[ player setCurrentTime:95.0 ];
[ player play ];
0
source

Source: https://habr.com/ru/post/1697155/


All Articles