MPMoviePlayerViewController无法在iOS 7上运行 [英] MPMoviePlayerViewController not working on iOS 7

查看:107
本文介绍了MPMoviePlayerViewController无法在iOS 7上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码在iOS 7之前有效,并且在更新电影没有播放之后:

I have a code that was working before iOS 7, and after update movies are not playing:

-(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];      
}

不知道,问题是什么,应用程序没有崩溃。

Don't know, what is the issue and the application is not crashing.

推荐答案

您实际上需要提供MPMoviePlayerViewController:

You actually need to present the MPMoviePlayerViewController:

[self presentViewController: _movieView_ animated: YES completion: nil];

如果您尝试在屏幕的一部分播放,请使用MPMoviePlayerController。

Use MPMoviePlayerController if you are trying to playback in a part of the screen.

这篇关于MPMoviePlayerViewController无法在iOS 7上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆