iPad MoviePlayer 拒绝播放视频,直到设备重新启动
我在发货的 iPad/iPhone 应用程序中遇到了一个非常奇怪的错误,我无法修复/追踪。
我的应用程序在标准 MPMoviePlayerController
中播放视频,但隐藏了界面以及我自己的播放和停止按钮。
这工作正常,但有时,使用几次后,我的应用程序拒绝播放任何进一步的视频。这种情况仅发生在 iPad(iOS 3.2.x 中)上,在 iPhone(iOS 4.x 中)上一切正常。奇怪的是,即使我退出应用程序,再次启动它后它仍然拒绝播放视频。它不会保存视频状态,并且会重新加载视频。只有在我重新启动 iPad 后,它才开始工作。
如果我的 iPad 处于“不播放视频”状态,我可以从 Xcode 调试我的应用程序,除了电影不播放而是无限期暂停之外,没有任何不同。
loadState
属性报告为 MPMovieLoadStatePlayable
,但 playbackState
属性仍保持 MPMoviePlaybackStatePaused
,无论我向其发送“播放”多少次“ 命令。
我无法在我的应用程序中执行任何操作(例如选择另一个视频)来使视频再次正常工作。
这些视频的分辨率为 600 x 400 H.264,并且在大于全屏的视图中播放,因此我可以在 iPad 上全屏显示它们(没有黑条),而无需 iPhone/iPad 的两个不同版本,因为这些设备具有不同的长宽比。
有足够的 RAM 可用(> 60 MB)。其他播放视频的应用程序(iTunes/YouTube/streamToMe)可以正常播放,但使用标准的 MoviePlayer 界面/控件,当然不能播放超过全屏的内容。
这一切让我怀疑这是苹果的一个错误。我还没有在 iOS 的 beta 版本中测试过这一点,如果是的话我也无法谈论它。
有人见过这种行为吗?并有可能的解决方案吗?谢谢!
I have a very strange bug in a shipping iPad/iPhone app that I can't fix/track down.
My app plays video in a standard MPMoviePlayerController
but with the interface hidden and my own buttons to play and stop.
That works fine but sometimes, after a few times of use, my app refuses to play any further video. This happens only on the iPad (in iOS 3.2.x), on the iPhone (in iOS 4.x) everything works fine all the time. Strangely enough, even after I quit my app, after I start it again it still refuses to play video. It doesn't save the video state, and it does reload the video. Only after I restart the iPad it starts working again.
If my iPad is in a "don't play video" state I can debug my app from Xcode and there isn't anything different other than the fact that the movie doesn't play but stays paused indefinitely.
The loadState
property reports as MPMovieLoadStatePlayable
, but the playbackState
property stays MPMoviePlaybackStatePaused
however many times I sent it a "play" command.
There is nothing I can do in my app (like choosing another video) to make the video work again.
The videos are 600 x 400 H.264 and are played in a view that is larger than full screen so I can show them full screen (without black bars) on the iPad without needing two different versions for iphone/ipad, because the devices have different aspect ratios.
There is plenty of RAM available (> 60 MB). Other apps that play video (iTunes/YouTube/streamToMe) play fine, but use the standard MoviePlayer interface/controls and don't of course don't play bigger than full screen.
This all makes me suspect this is an Apple bug. I haven't yet tested this in a beta version of iOS, and if so I couldn't talk about it either.
Anybody seen this behaviour? And has a possible solution? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在此线程中 Ipad MPMovieplayerController 视频加载但播放时自动暂停 看起来他们通过使用
player.useApplicationAudioSession = NO;
解决了这个问题。尝试一下!In this thread Ipad MPMovieplayerController video loads but automatically pauses when played it appears they solved the issue by using
player.useApplicationAudioSession = NO;
. Give it a try!这是 iPad OS 3.2.x 上 MPMoviePlayerController 的一个非常常见的错误。
任何应用程序运行几次后,电影都无法播放,如果您移动滑块,您可以看到帧,但仍然无法播放视频超过一次一帧!
此外,您可能会注意到内存消耗很大,因为某些应用程序开始比平常更频繁地收到内存警告。
最后,您可以尝试运行使用相同框架的其他应用程序(例如“ABC News”)来证明这是一个系统问题(而不是具体的应用程序问题)。例如,使用 UIWebView 的其他应用程序(例如基于 YouTube 视频的应用程序)不会出现这些问题。
唯一的解决方案是重新启动设备。这将一直有效,直到下次重新启动为止。
卡洛
This is a quite common bug with MPMoviePlayerController on iPad OS 3.2.x
After a few runs of any app, the movies fail to play and if you move the scrubber you can see the frames but you can't still play the video for more than one frame at a time!
Besides you may notice a great memory consumption, due to the fact that some apps start receiving memory warnings more often than normal.
Finally you may prove this is a system problem (and not specifically an app problem) buy trying to run other apps that use the same framework, e.g. "ABC News". The issues cannot be seen with other apps that use UIWebView for instance (e.g. the ones based on You Tube videos).
The only solution is to re-boot the device. This works until next reboot.
Carlo