Objective-c – iphone – force MPMoviePlayerController to play video in landscape mode

iphonempmovieplayercontrollerobjective cvideo

I have an app that is portrait mode only, but when the user plays a video I want it to play in fullscreen landscape mode (the video player doesn't look good in portrait mode). I'm playing it like this:

[self.view addSubview:myMoviePlayer.view];
[self.myMoviePlayer setFullscreen:YES animated:YES];
[self.myMoviePlayer play];

What's the best way to accomplish this?

Best Answer

Read this article:

http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html

The main idea is:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

[[self view] setBounds:CGRectMake(0, 0, 480, 320)];
[[self view] setCenter:CGPointMake(160, 240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
Related Topic