在我的应用程序中,我需要使用MPMoviePlyerController
播放视频。它适用于1920x1080的分辨率,但对于像3840×2160这样的高分辨率,视频无法在控制台中播放并显示_itemFailedToPlayToEnd
错误。它在模拟器中运行良好,只有设备才会出现问题。我的应用程序支持7.0及更高版本。
我搜索了许多Stack Overflow答案,但没有一个能为我工作。
我无法播放的视频分辨率为:3840x2160。
这是我用来播放视频的代码
NSURL *url = [NSURL URLWithString:videoDetails.media_urlString];
self.moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayLoadStateChangeNotification:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:self.moviePlayer];
[self.moviePlayer setControlStyle:MPMovieControlStyleNone];
self.moviePlayer.view.frame = CGRectMake(self.frame.origin.x, 0, self.frame.size.width, self.frame.size.height); //Set the size
[self.moviePlayer setFullscreen:NO];`enter code here`
[self.moviePlayer setShouldAutoplay:YES];
[self addSubview:self.moviePlayer.view];//Show the view
[self.moviePlayer play];
我测试的设备是iPad3,iPhone5s,iPhone5,iPhone4s