I am working on a universal application that starts with a really short intro video. So I simply add a MPMoviePlayerViewController and modally present it. On the iPhone everything works fine even if I play the video in landscape mode. But on the iPad the video always plays in portrait mode no matter what interface orientation the device currently has. I searched for hours and tried a lot of different things like CGAffineTransformation or adding a new view, but nothing seems to work. Here is the code that I work with:
NSString *filePath = [[NSBundle mainBundle] pathForResource:videoName ofType:@"mp4"];
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
self.startupController = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[self.startupController.moviePlayer setControlStyle:MPMovieControlStyleNone];
[self.startupController.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
[self.startupController.moviePlayer setFullscreen:YES];
[self presentModalViewController:self.startupController animated:NO];
Do you have any idea how I can fix this issue? In my opinion this should be a simple feature offered by Apple, but sometimes the easiest things are the ones I have to worry about most…
Here is how I did it.
First, listen to this notification
Then implement this :
So the trick is just using transformation