xcode Ipad MPMovieplayerController 视频加载但播放时自动暂停
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3000969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ipad MPMovieplayerController video loads but automatically pauses when played
提问by slayerIQ
I am trying to get the MPMovieplayerController to work. I load a video everything goes wel i even see the first frame but then it automatically pauses, if i press play it pauses again. In the simulator it works perfectly but on the ipad device it gives the problem. I can even seek through the video and i see the frame i seeked to but nothing plays. This is some output from the console:
我试图让 MPMovieplayerController 工作。我加载了一个视频,一切顺利,我什至看到了第一帧,但它会自动暂停,如果我按下播放,它会再次暂停。在模拟器中它运行良好,但在 ipad 设备上却出现了问题。我什至可以通过视频寻找,我看到了我寻找的框架,但没有播放。这是控制台的一些输出:
2010-06-08 22:16:13.145 app[3089:207] Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.
[Switching to thread 12803]
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/VideoDecoders/VCH263.videodecoder" (file not found).
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/VideoDecoders/H264H2.videodecoder" (file not found).
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/VideoDecoders/MP4VH2.videodecoder" (file not found).
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/VideoDecoders/JPEGH1.videodecoder" (file not found).
2010-06-08 22:16:15.145 app[3089:207] setting file:///private/var/mobile/Applications/46CE5456-6338-4BBF-A560-DCEFF700ACE0/tmp/MediaCache/
I dont get those warning when using the simulator BTW.
顺便说一句,使用模拟器时我没有收到这些警告。
Does anyone know how to fix this ?
有谁知道如何解决这一问题 ?
回答by xwwxy
Set the property "useApplicationAudioSession" of the MPMoviePlayerController to "NO" to resolve the problem.
将 MPMoviePlayerController 的“useApplicationAudioSession”属性设置为“NO”即可解决问题。
回答by slayerIQ
Found the solution just restart the ipad and it works again weird but thats it :)
找到解决方案,只需重新启动 ipad,它的工作又很奇怪,但就是这样:)
回答by chrisg
Avaudioplayer was causing my problem. Apperently on the iPad Avaudioplayer and Mpmovieplayercontroller cannot both play at the same time.
Avaudioplayer 导致了我的问题。显然在 iPad 上 Avaudioplayer 和 Mpmovieplayercontroller 不能同时播放。
If an Avaudioplayer object is open the Mpmovieplayer will only display a frame and immediately stop playing.
如果 Avaudioplayer 对象打开,则 Mpmovieplayer 将仅显示一帧并立即停止播放。
As far as I can tell this only happens with iPad device 3.2.1 and SDK 4.0.1; simulators and the iPhone work fine
据我所知,这只发生在 iPad 设备 3.2.1 和 SDK 4.0.1 上;模拟器和 iPhone 工作正常
I switched back to Audioservices since I need Audioplayer and Movieplayer to play at the same time.
我切换回 Audioservices 因为我需要 Audioplayer 和 Movieplayer 同时播放。
回答by DuMmWiaM
Had the same problem. Video was playing ok on simulation but not on device. The problem was either on my HTML5 code embeded in the UIView or on the mp4 video compression, I don't know what fixed it but I suggest you try both. I am still getting the error when I am testing the video on the device, but the video plays just fine!
有同样的问题。视频在模拟上播放正常,但在设备上播放不正常。问题出在嵌入在 UIView 中的 HTML5 代码或 mp4 视频压缩上,我不知道是什么解决了它,但我建议您同时尝试两者。我在设备上测试视频时仍然收到错误消息,但视频播放得很好!
回答by Edward
I had an issue on the device where the video would show up but not play. I could scrub. The fix for me was that I was using the avaudiorecorder, and I was releasing it before playing the video without stopping the audio recorder. My solution was to add the stop call to the recorder before starting the video:
我在设备上遇到了视频会显示但无法播放的问题。我可以擦洗。对我来说,解决方法是我使用了 avaudiorecorder,我在播放视频之前释放了它,而没有停止录音机。我的解决方案是在开始视频之前向录音机添加停止调用:
[recorder stop];
[recorder release];