I am working on an application in which I have embedded an iframe on a screen to show the thumbnail of a video from vimeo.com. Every thing is working perfect but when I tap to play the video it invokes iPhone's DEFAULT MOVIE PLAYER and then I rotate my iPhone to landscape and video plays in landscape mode. But if video finishes in landscape mode then the screen (on which I have added the vimeo iframe) also gets rotated in landscape mode. I need to fix it in portrait only but video should play in portrait and landscape both modes. Thanks!
Asked
Active
Viewed 1,161 times
1
-
The video application allowed orientations do not depend on what's enabled in your application, do you have the landscape disabled in that particular view controller where the preview is shown ? – A-Live Jul 12 '12 at 05:33
-
@A-Live Hi, I have disabled all the orientations in my application and all viewControllers only support portrait mode only using this code: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } – iOS Monster Jul 12 '12 at 06:54
-
Do you need the app to be in the portrait mode only ? If so, please confirm `UISupportedInterfaceOrientations` at info.plist is set to `UIInterfaceOrientationPortrait` or optional `UIInterfaceOrientationPortraitUpsideDown`. – A-Live Jul 12 '12 at 07:57
-
@A-Live yes, I have already done that in my application's info.plist. Note that this movie player is default player of iPhone i.e. invoked automatically when I tap on the video thumb in webView. I am not able to find any way out for this :( – iOS Monster Jul 12 '12 at 08:09
-
That seem to be a good question for apple tech support, meanwhile you can use this "hack" to set the portrait orientation: http://stackoverflow.com/a/7264053/792677 – A-Live Jul 12 '12 at 08:17
-
@A-Live Hi, Thanks for the link. Although this didn't help me but while reading content on this URL an idea came in my mind to solve my issue. Thanks! – iOS Monster Jul 12 '12 at 10:48
3 Answers
0
Put this method in your all view controller to force them to remain always in portrait mode
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

Sanchit Paurush
- 6,114
- 17
- 68
- 107
-
Hi! thanks for you response. But I am already using this fraction of code in my viewcontrollers. Note that the issue arises only after playing the video in landscape mode. – iOS Monster Jul 12 '12 at 06:56
0
When we play a video in this way then iPhone's in built video player get invoked that is of class "mpinlinevideoviewcontroller". We can't control it's functionality. So I set
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
in the view controller containing the web view and now only this screen of the application supports all orientation and thus my issue got removed (but not resolved).

Luke
- 11,426
- 43
- 60
- 69

iOS Monster
- 2,099
- 1
- 22
- 49
0
one possible way is : When your player stopped playing just call this function.
-(void)setupOrientaion
{
[[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
}
or else post your code here. it 'll be more helpful to analyze.

Veera Raj
- 1,562
- 1
- 19
- 40