一个视图中有多个 MPMoviePlayer?
我需要在一个视图中显示多个电影播放器。
我知道我只能播放一个视频。
我的问题是,我添加到视图中的两个 MPMovieplayer 中只有一个显示了控制按钮。
我可以做什么来解决我的问题?
我使用此代码添加电影播放器:
MPMoviePlayerController * moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerPlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerDidEnterFullscreen:)
name:MPMoviePlayerDidEnterFullscreenNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:moviePlayer];
moviePlayer.view.frame = rect;
[movie setContentURL:contentURL];
[movie prepareToPlay];
[self addSubview:moviePlayer.view];
I need to display more than one movieplayer in a view.
I know I can only play one video.
My problem is that only one of the two MPMovieplayer, I have added to the view, shows me the control buttons.
What can I do to solve my problem?
I use this code to add a movieplayer:
MPMoviePlayerController * moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerPlaybackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerDidEnterFullscreen:)
name:MPMoviePlayerDidEnterFullscreenNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:moviePlayer];
moviePlayer.view.frame = rect;
[movie setContentURL:contentURL];
[movie prepareToPlay];
[self addSubview:moviePlayer.view];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这是不可能的。请看这个问题的答案
在 iPAD 上播放多个视频
您必须使用 AVPlayer多个视频观看,查看此
这是另一个 AVPlayer 教程
您还可以从苹果开发者门户网站 链接
这个
href="https://stackoverflow.com/questions/6258573/playing-many- Different-videos-on-iphone-using-avplayer">问题还提到了有关向 AVPlayer BR、Hari
I think its not possible. Please see the answer for this question
Playing Multiple Videos on iPAD
You will have to use AVPlayer for multiple video viewing, see this
Here is another tutorial for AVPlayer
You can also check this from apple developer portal, link
This question also says something about adding controls to AVPlayer
BR, Hari
您好,在 ios 中无法播放超过 1 个视频,因为一次只能播放一个线程。
我在 iPad 应用程序中遇到了同样的问题,但我找到了替代解决方案。
我想在 1 个视图控制器中播放更多视频,但这些视频只有 4 到 5 秒。
我制作该视频的多个连续图像帧并制作 .gif 文件并将其显示在 UIWebView 中。效果很好。
Hi this is not possible to play more than 1 video in ios because only one thread at a time .
I face same issue in my iPad application but I've found an alternate solution.
I want to play more video in 1 view controller , but these videos are 4 to 5 sec's only.
I make number of continuous image frames of that video's and make .gif files and show this in a UIWebView. it works fine.