2

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.

ANeme
  • 731
  • 5
  • 19
  • are you trying to play video from youtube or from other source please show any link here so I can try and give you right suggestion. – Pratik Oct 11 '13 at 09:41
  • thanks Pratik, i'm playing movies from document directory, and i'm showing movieView in a scrollView controller. – ANeme Oct 11 '13 at 14:09
  • url value: file://localhost/var/mobile/Applications/C4FF3792-E70E-4540-8C03-0B86830E05A5/Documents/Main%20Album/images/picture-10112013-00000.MOV – ANeme Oct 11 '13 at 14:25

1 Answers1

0

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.

Daniel Broad
  • 2,512
  • 18
  • 14