UITabBarController 内的 MPMoviePlayerController
好的,事情就是这样。我有一个包含 UITabBarController 的 UIViewController。该选项卡栏为每个选项卡按钮都有一个 UIViewController。现在,其中一个选项卡按钮内部是一个 MPMoviePlayerController,它正在通过网络播放流。播放流效果很好,您可以看到视频并听到音频。
问题是当您导航到另一个选项卡时。音频仍在播放,这很好,但当您返回流时,视频是黑色的。音频仍在播放,但视频也需要播放。
以前有人遇到过这个问题吗?
我目前正在使用 iOS 4.0 和 iPhone 3GS 进行构建。
如果需要更多信息,请询问,我会尽力回答。
谢谢, 罗比
Ok, so here's the thing. I have a UIViewController that contains a UITabBarController. That tab bar has a UIViewController for each tab button. Now, inside one of the tab buttons is an MPMoviePlayerController that is playing a stream from over the network. Playing the stream works just fine and you can see the video and hear the audio.
The problem is when you navigate to another tab. The audio still plays, which is good, but when you go back to the stream, the video is black. The audio is still playing, but the video needs to be playing too.
Has anyone run into this problem before?
I'm currently using iOS 4.0 to build against and an iPhone 3GS.
If more information is needed, just ask and I'll do my best to answer.
Thanks,
Robbie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果视图不在屏幕上,可能会发生奇怪的事情(我相信当您切换选项卡时它会从视图层次结构中删除)。
Strange things might happen if the view isn't on-screen (I believe it's removed from the view hierarchy when you switch tabs).
我继续采用的解决方案是非常快速地进入全屏模式并退出全屏模式。这可能不是最好的事情,但它正在发挥作用。
The solution I'm going ahead with is entering fullscreen mode and exiting fullscreen mode very quickly. It may not be the best thing, but it's working.
这种情况在 iOS 6 上仍然会发生。如果我有两个电影播放器(每个选项卡上一个),即使它们没有播放,如果我从第一个选项卡切换到秒选项卡并返回到第一个选项卡,电影播放器将会变黑。
我的解决方案就像在
-viewDidAppear:
上调用prepareToPlay
一样简单:我相信这会将
MPMoviePlayerController
的共享内部视图添加到视图层次结构中。This still happens on iOS 6. If I have two movie player (one on each tab), even if they are not playing, if I switch form the first to the seconds tab and return to the first, the movie player will be black.
My solution was as simple as calling
prepareToPlay
on-viewDidAppear:
:I believe this will add the shared internal view of
MPMoviePlayerController
to the view hierarchy.