Play videos with MPMoviePlayerController in landscape-only

Today’s HD videos displayed best on 16:9 sized displays, which is available on iOS devices as well in landscape mode.
That’s why it is useful to start 16:9 videos in landscape mode, and even don’t allow to be rotated in portrait mode.
Here is a good tutorial about MPMoviePlayerController usage, with good example, however to start in landscape mode, apply the following lines in your ViewController, which owns the MoviePlayerController’s view:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight;
}

Leave a Reply