2

I get warning described in title and I've found that this is as a result of calling viewDidLayoutSubviews multiple times.

- (void) viewDidLayoutSubviews
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"wq" ofType:@"mp4"]];
self.playerController = [[MPMoviePlayerViewController alloc]initWithContentURL:url];

[self presentMoviePlayerViewControllerAnimated:self.playerController];
[self.playerController.moviePlayer prepareToPlay];

self.playerController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
self.playerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
self.playerController.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
self.playerController.moviePlayer.repeatMode = MPMovieRepeatModeOne;

[self.playerController.view setFrame:self.movieView.bounds];
[self.movieView addSubview:self.playerController.view];

[self.playerController.moviePlayer play];
}

I have also tried using above code in (void) loadView but the result was the same. I also have some buttons in the storyboard which I don't want to miss them. Could anyone help me to have only one MPMoviePlayerViewController?

Thanks in advance!

Minoo
  • 139
  • 11
  • Finally I solved the issue using this [link](http://stackoverflow.com/questions/13040862/how-to-play-video-in-ios6). Thanks timquinn! – Minoo Apr 02 '16 at 05:49

0 Answers0