I have an application entirely in portrait mode. (iOS 5 and above) I have a video played using MPMoviePlayerController, now in this video i want that when user rotates the iPhone, the video should go to landscape mode(in fullscreen). When video ends , again the video should go into portrait mode. Code:
-(void)PlayVideo:(NSURL*)videoUrl
{
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
[moviePlayerController.view setFrame:CGRectMake(6, 69, 309, 196)];
[self.view addSubview:moviePlayerController.view];
// moviePlayerController.fullscreen = YES;
moviePlayerController.controlStyle = MPMovieControlStyleNone;
[self.view bringSubviewToFront:self.shareView];
[self.view bringSubviewToFront:self.qualityView];
[moviePlayerController play];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
}
Rest of the app, i want in portrait only. How do i achieve this?