I am embedding Youtube videos in my app using UIWebView. I want everything in my app portrait mode only except when playing Youtube video. I have googled it but I havent solved it. My app just has 1 UIViewController (UINavigationController embedded) display 1 UIWebView.
I have tried a solution in here iPhone rotation and full-screen video and here Fullscreen youtube video, rotation, and the status bar (iOS) but not solved yet.
Here is my code in ViewDidLoad:
NSString *videoId = @"nzNkUhvq43A";
NSString *videoUrl =[NSString stringWithFormat:@"src=\"http://www.youtube.com/embed/%@\"", videoId];
NSString *htmlString =[NSString stringWithFormat:@"<iframe width=\"256\" height=\"144\" %@ frameborder=\"0\" allowfullscreen></iframe>", videoUrl];
NSLog(@"%@", htmlString);
myWebView.scrollView.scrollEnabled = NO;
myWebView.scrollView.bounces = NO;
[myWebView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];
Thanks.