MPMoviePlayerViewController not working on iOS 7

断了今生、忘了曾经 提交于 2020-01-04 14:23:11

问题


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.


回答1:


You actually need to present the MPMoviePlayerViewController:

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

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



来源:https://stackoverflow.com/questions/19314620/mpmovieplayerviewcontroller-not-working-on-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!