Iphone MPMoviePlayerController通过HTTP播放本地文件,但不播放远程文件
我有一个mp4文件,作为应用程序的一部分,它可以与MPMoviePlayerController配合使用Iphone MPMoviePlayerController通过HTTP播放本地文件,但不播放远程文件,iphone,ios,ipad,video-streaming,mpmovieplayercontroller,Iphone,Ios,Ipad,Video Streaming,Mpmovieplayercontroller,我有一个mp4文件,作为应用程序的一部分,它可以与MPMoviePlayerController配合使用 [_mediaPlayer setContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"movie"
[_mediaPlayer setContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"movie"
ofType:@"mp4"]]];
[_mediaPlayer play];
但是,一旦我将同一个文件上载到Web服务器,就会出现以下错误:
Error Domain=MediaPlayerErrorDomain Code=2
同一台设备上的safari浏览器播放远程电影,因此可达性不是问题
.
我没有找到任何关于代码2告诉我的内容的文档。所以我被卡住了
有人吗?您应该使用NSURL的
URLWithString
:因为您没有使用本地文件路径。(作为评论的答案发布:)web服务器文件的链接是什么?这就是你应该使用的url。您应该使用NSURL URLWithString:因为您没有使用本地文件路径。非常感谢那是我需要的那只鹿。这是一个相当愚蠢的错误。我的代码中有:[NSURL fileURLWithPath:item.url];而不是[nsurlUrlWithString:item.url]@杰西-将你的评论作为答案:)@Jakob-当杰西这么做时,将其标记为已接受:)