Search code examples
iosmpmovieplayercontrollermpmovieplayer

How can I change the view of a video to Landscape when my app is locked to portrait


I am working on a iPad/iPhone app that displays a video on a button press. I have the video working however, my app is locked to portrait mode and I would like my video to display in Landscape only. Here is some code to go with my questions, I would like the easiest and simpliest way if its possible.

-(void) view_intro:(UIButton *)introButton {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
               pathForResource:@"Introduction" ofType:@".m4v"]];
moviePlayer =  [[MPMoviePlayerController alloc]
                initWithContentURL:url];

[[NSNotificationCenter defaultCenter] addObserver:self
                selector:@selector(moviePlayBackDidFinish:)
                name:MPMoviePlayerPlaybackDidFinishNotification
                object:moviePlayer];

moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];}

Solution

  • Basically what I ended up doing was creating a seperate view/classes for my Movie Player, this seemed to have worked perfectly.