saikamesh
saikamesh

Reputation: 4629

MPMoviePlayerViewController playing movie only in landscape mode

I want to play the video only in landscape mode in iPhone SDK.40(MPMoviePlayerViewController). It should not support portrait mode play back. How do we do this.

Upvotes: 2

Views: 4403

Answers (1)

Andrew
Andrew

Reputation: 1507

I found this documentation here:

http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/mpmovieplayerviewcontroller_class/Reference/Reference.html#//apple_ref/occ/instm/MPMoviePlayerViewController/shouldAutorotateToInterfaceOrientation:

So basically you just need to create your own subclass of MPMoviePlayerViewController and override the shouldAutorotateToInterfaceOrientation: method, like so:

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

Upvotes: 11

Related Questions