简体   繁体   English

如何将另一个视频添加到MPMoviePlayer?

[英]How to add another video to MPMoviePlayer?

Is it possible to make a playlist for MPMoviePlayer? 是否可以为MPMoviePlayer制作播放列表? all videos are from internet. 所有视频均来自互联网。 While player runs, when it comes to 1 minute position i want to play another video from URL. 当玩家跑步时,当谈到1分钟位置时,我想从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. 我看到了一些ipad应用程序,比如hulu plus。

what steps should i make? 我该做什么步骤?

You can use the playbackdidfinish notification: 您可以使用playbackdidfinish通知:

    [[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. 您可以将url保存在plist文件中,并使用简单的整数索引跟踪当前项目beign。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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