ios - MPMoviePlayerViewController在iOS 7上不起作用

标签 ios objective-c ios7

我有一个在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/

相关文章:

objective-c - 将粗体应用于 NSAttributedString 的一部分,同时保留字体大小和外观

ios - UIButton 边框在被选中时改变粗细

ios - 在 Storyboard 上处理阿拉伯语(从右到左)的最佳方式是什么?

ios - 如何使用自动布局的 Masonry DSL 定义 View 之间的垂直和水平关系?

ios - 我可以从当前未激活的 iOS 应用程序调用电话吗?

iphone - 如何检测MoreController推送了新的VC?

ios - 目录中的视频缩略图

ios - UI(有时)在 iOS 上的操作期间卡住

ios - 动态/可拖动 UIView 的自动布局

ios - ios中UITabBarController中的UITabBarController使用 Storyboard