我初始化一个MPMoviePlayerViewController
到支持范围请求和所有的服务器上的源.mp4和事实上的代码我使用的优秀作品在iPhone 4,iPhone 3GS和iPad上运行iOS 4为什么MPMoviePlayerViewController在技术上应该能够播放的电影上失败?
我有一台运行iOS 4的iPhone 3G。此设备上的电影播放器类开始流式处理,然后立即完成播放。但它并没有错误,只是通过打印MPMoviePlaybackDidFinishNotification
来完成播放;它回来了MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 0
,我认为这意味着MPMovieFinishReasonPlaybackEnded
考虑这是枚举的第一个值。我甚至尝试设置播放提示,MPMovieSourceType = MPMovieSourceTypeStreaming
。
问题是,如果我在iPhone 3G上的Safari中导航到非常相同的URL,它将流式传输并播放电影而不会出错。我完全陷入困境,谷歌迄今为止没有涉及3G的任何具体问题。可能的解决方案包括在3G设备上创建自定义AVFoundation
实现(完全不理想)或使用MPMoviePlayerController
。如果有人根据iPhone的型号进行切换指导,而不是运行iOS的版本,那就太好了。
使用CFNotificationObserver回调注册,我收到的利息如下通知:
Name: AVFileValidatorNotification_NotPlayable <-- likely the source of the issue
Info: Error = "Error
Domain=NSOSStatusErrorDomain
Code=-12621
\"This movie could not be played.\" "
Name: FailedToBecomeReadyForInspection
Info: Properties = (InitialSamples);
Result = "-12621";
Name: AVController_ItemFailedToPlay
Info: "AVController_Error" = (the above Error object);
"AVController_Item" = "<MPAVItem: 0x1b65d0>";
Name: MPAvControllerPlaybackStateChangedNotification
// Got several of these, the playback state changed as follows: 0 -> 2 -> 7 -> 0
添加了后续问题。 – 2011-02-15 02:08:32