iOS 6: Youtube embed video (MPAVController) in a browser can lock app in landscape mode
ios6, iphone, landscape-portrait, uiinterfaceorientation, youtube
Solution
I am facing the same problem. Here is how I have solved it:
First register to receive ExitFullscreenNotification, on the ViewController that holds the UIWebView:
- (void)viewDidLoad {
[super viewDidLoad];
// For FullSCreen Exit
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(youTubeVideoExit:)
name:@"UIMoviePlayerControllerDidExitFullscreenNotification"
object:nil];
}
Then, on the "exit fullscreen" handler, force Portrait mode:
- (void)youTubeVideoExit:(id)sender {
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO];
}
When the video finishes in landscape mode, the user sees the status bar changing its location for a split second. This may not be the best solution, but at least solves the problem.
Hope it helps!
Problem
I'm embedding a Youtube video in a browser which is part of an all portrait application. When you launch the youtube video, it plays in MPAVController and rotation in Landscape is permitted. This is not an issue for me, but the problem is if the video is in landscape and i press "OK" to dismiss the video; i return to the browser but the iPhone status bar is now stuck in landscape mode leaving a blank space on the top of the app, as well as the status bar overlappting the right or left part of my app depending on rotation orientation. My view controller containing the UIWebView is locked in portrait: ``` - (BOOL) shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskPortrait; } ``` Note that this issue is not present when compiling with an SDK prior to 6.0. Anyone with a similar problem has a solution?