在MPMoviePlayerController中播放视频时出现_itemFailedToPlayToEnd错误 [英] _itemFailedToPlayToEnd error when playing video in MPMoviePlayerController
本文介绍了在MPMoviePlayerController中播放视频时出现_itemFailedToPlayToEnd错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 MPMoviePlayerController
播放视频,并且遇到以下错误,
I am trying to play video using MPMoviePlayerController
, and am having following error,
_itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}
以下是我的代码,
NSURL *fileURL = [NSURL URLWithString:_videoUrl];
NSLog(@" fileURL: %@",fileURL);
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
_moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow];
[_moviePlayer.view setFrame:backgroundWindow.frame];
[backgroundWindow addSubview:_moviePlayer.view];
[_moviePlayer prepareToPlay];
[_moviePlayer play];
如何解决此问题?
推荐答案
我有同样的问题,查看了很多主题,但没有找到可行的解决方案。
但是我发现了你的电影网址的url标头响应内容类型的问题..
如果你尝试使用另一个服务器的另一个网址的SetContentUrl我猜这将解决问题..
I had same issue, viewed a lot of topics and haven't found working solution. but what I have discovered that the problem with the url header response content type whose of your Movie URL.. if you try to SetContentUrl with another url from another server I guess this will solve the problem..
这篇关于在MPMoviePlayerController中播放视频时出现_itemFailedToPlayToEnd错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文