我有一个在iOS 7之前可以正常工作的代码,并且在更新电影无法播放后可以正常工作:
-(void)setMovie:(NSURL *)newMovie autoPlay:(BOOL)autoPlay
{
movieView_ = [[MPMoviePlayerViewController alloc] initWithContentURL:newMovie];
[movieView_.view setContentMode:UIViewContentModeScaleAspectFit];
[movieView_.moviePlayer setShouldAutoplay:NO];
movieView_.moviePlayer.view.frame=self.view.frame;
[movieView_.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[movieView_.moviePlayer setMovieSourceType:MPMovieSourceTypeFile ];
[movieView_.moviePlayer prepareToPlay];
id currentPhotoView = [photoViews_ objectAtIndex:currentIndex_];
[currentPhotoView addSubview:movieView_.moviePlayer.view];
[movieView_.moviePlayer play];
}
不知道是什么问题,应用程序没有崩溃。
最佳答案
您实际上需要提供MPMoviePlayerViewController:
[self presentViewController: _movieView_ animated: YES completion: nil];
如果要在屏幕的一部分中播放,请使用MPMoviePlayerController。
关于ios - MPMoviePlayerViewController在iOS 7上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19314620/