edit: The videos are of the app being used: i.e. they're instructional videos designed to be played in portrait mode.
I used this method (NB iPhoneDevSDK.com is currently marked by Google as containing malware, so be careful. I've uploaded a screengrab of the relevant post) to open & play a YouTube video (using a UIWebView behind the scenes).
The video I want to show was recorded in portrait (uploaded in 320x480) and was intended to fill the iPhone screen nicely when in portrait mode. However, the YouTube video starts in a forced landscape mode, and can only be put into portrait by moving the phone to a landscape position and then back again (sometimes needs to be done a few times).
What I'm wondering is: is there a way of forcing the UIWebView to open a video player that defaults to portrait mode?
NB I've set (interfaceOrientation == UIInterfaceOrientationPortrait) on the UIWebView delegate that's spawning the UIWebView.
Edit: I even tried subclassing UIWebView on the off-chance that this would get it to work:
@interface AltWebView : UIWebView
@end
@implementation AltWebView
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
- First image: video playing in Landscape by default
- Second image: Portrait mode once rotated a few times