views:

1152

answers:

2

Hi all! I have a view and a MPMoviePlayerViewController.. the iPad is oriented in landscape left mode, but when I play the video, the video is good to see in portrait mode... is there a way to force movieplayer to rotate in landscape mode? thanks in advance

+2  A: 

you can force a MPMoviePlayerViewcontroller to work in landscapce mode by

[player setOrientation:UIDeviceOrientationPortrait animated:NO];

You can read my blog entry for sample code http://www.makebetterthings.com/blogs/iphone/play-video-on-iphone-and-ipad/

Saurabh
thanks Saurabh! I read yesterday your blog ( I poosted also ) but the line where shows this thing I skipped, I don't know how!!!!!Thanks, I'll try soon!
ghiboz
Thanks for reading my blog!:)
Saurabh
sorry, but the MPMMoviePlayerViewController doesn't have setOrientation method...https://developer.apple.com/iphone/prerelease/library/documentation/MediaPlayer/Reference/MPMoviePlayerViewController_class/Reference/Reference.html
ghiboz
sorry, i read into your blog that setOrientation is not ready for iPad....
ghiboz
+3  A: 
@interface MyMovieViewController : MPMoviePlayerViewController
@end

@implementation MyMovieViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

@end

Then just instantiate MyMovieViewController instead of MPMoviePlayerViewController.

tc.

related questions