简体   繁体   中英

How to add another video to MPMoviePlayer?

Is it possible to make a playlist for MPMoviePlayer? all videos are from internet. While player runs, when it comes to 1 minute position i want to play another video from URL. second video is an ads clip. after ads clip finishes, main video should continue. is it possible? i saw some ipad apps, like hulu plus.

what steps should i make?

You can use the playbackdidfinish notification:

    [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayBackDidFinish:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:nil];

And make your player fetch the next item in your playlist with this method

    -(void)moviePlayBackDidFinish:(NSNotification*)notification;

You can save the url's in a plist file and keep track of the current item beign played using a simple integer index.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM