在iOS6中进入全屏后,MPMoviePlayerController会中断/停止 [英] MPMoviePlayerController breaks/stops after going to fullscreen in iOS6

查看:121
本文介绍了在iOS6中进入全屏后,MPMoviePlayerController会中断/停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MPMoviewPlayerViewController 嵌入到 UIView 对象中。当我在嵌入模式下启动播放器时,一切正常并且符合预期。如果用户然后点击全屏切换(或者如果我使用 setFullscreen:animated 以编程方式更改为全屏),则播放器全屏显示,电影播放另一秒钟,之后屏幕变黑,只有正在加载... 消息。



此行为仅在使用iOS 6(也是iPad 6.0模拟器)时出现,在运行iOS 5的设备上,一切都按预期工作。



电影源是应用程序包中的本地文件。



在比赛中进入全屏调试输出如下:

 
2012-09-26 15:24:48.251 [39895:c07] [MPAVController]自动播放:禁用自动播放暂停
2012-09-26 15:24:48.252 [39895:c07] [MPAVController]自动播放:禁用自动播放
2012-09-26 15:24:48.262 [39895:c07] [MPAVController]自动播放:启用自动播放
2012-09-26 15:24:48.265 [39895:c07] [MPAVController]自动播放:可能跟上或完全缓冲:0
2012-09-26 15 :24:48.266 [39895:c07] [MPAVController]自动播放:跳过自动播放,没有足够的缓冲来跟上。
2012-09-26 15:24:48.267 [39895:c07] [MPAVController]自动播放:可能跟上或完全缓冲:0
2012-09-26 15:24:48.268 [39895: c07] [MPAVController]自动播放:跳过自动播放,没有足够的缓冲来跟上。
2012-09-26 15:24:48.276 [39895:c07] [MPAVController]自动播放:跳过自动播放,禁用(当前项目:0,播放器:1)
2012-09-26 15 :24:48.286 [39895:c07] [MPCloudAssetDownloadController]请求媒体项ID的优先级:0
2012-09-26 15:24:48.938 [39895:c07] [MPAVController]自动播放:启用自动播放
2012-09-26 15:24:48.940 [39895:c07] [MPAVController]自动播放:启用自动播放
2012-09-26 15:24:48.954 [39895:c07] [MPAVController]自动播放:跳过自动播放,禁用(当前项目:0,播放器:1)
2012-09-26 15:24:49.006 [39895:c07] [MPAVController]自动播放:启用自动播放
2012-09-26 15:24 :49.012 [39895:c07] [MPAVController]自动播放:跳过自动播放,禁用(当前项目:0,播放器:1)

有人知道为什么玩家会停止工作吗?



编辑:
添加了 github上的示例项目


解决方案

我自己解决了。当我将Movie Player作为子视图添加到容器视图时,我不需要使用用 MPMoviePlayerViewController 创建的实际视图控制器,该控制器旨在用于呈现它modally或其他vc层次结构。



为了让电影播放器​​视图可以作为子视图添加到其他视图的单一目的 MPMoviePlayerController 的视图属性已足够。



直到iOS 6都有效,但iOS 6在资源管理/生命周期方面似乎有所不同。



示例项目使用工作代码进行更新。


I have a MPMoviewPlayerViewController embedded into an UIView object. When I start the player in the embedded mode everything works fine and as expected. If the user then taps onto the fullscreen toggle (or if I change to fullscreen programmatically using setFullscreen:animated) the player goes fullscreen, the movie plays for another second and after that the screen goes black with only a "Loading..." message.

This behavior only appears using iOS 6 (also iPad 6.0 Simulator), on devices running iOS 5 everything works as intended.

The movie source is a local file from the app bundle.

Upon playing & entering fullscreen the debug output is as follows:

2012-09-26 15:24:48.251 [39895:c07] [MPAVController] Autoplay: Disabling autoplay for pause
2012-09-26 15:24:48.252 [39895:c07] [MPAVController] Autoplay: Disabling autoplay
2012-09-26 15:24:48.262 [39895:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-26 15:24:48.265 [39895:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2012-09-26 15:24:48.266 [39895:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2012-09-26 15:24:48.267 [39895:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2012-09-26 15:24:48.268 [39895:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2012-09-26 15:24:48.276 [39895:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
2012-09-26 15:24:48.286 [39895:c07] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2012-09-26 15:24:48.938 [39895:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-26 15:24:48.940 [39895:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-26 15:24:48.954 [39895:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
2012-09-26 15:24:49.006 [39895:c07] [MPAVController] Autoplay: Enabling autoplay
2012-09-26 15:24:49.012 [39895:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)

Has somebody an idea why the player stops working?

Edit: Added an example project on github

解决方案

I solved it by myself. As I add the Movie Player as a subview to a container view I don't need to use the actual view controller created with the MPMoviePlayerViewController which is intended to be used to present it modally or in some other vc hierarchy.

For the single purpose of having a Movie Player view that can be added to some other view as a subview the MPMoviePlayerController's view property is sufficient.

Until iOS 6 both worked but iOS 6 seems to differ in terms of ressource management/lifetime.

The example project is updated with working code.

这篇关于在iOS6中进入全屏后,MPMoviePlayerController会中断/停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆