tags:

views:

495

answers:

2

Hi,

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.

A: 

I do not have a high enough reputation to vote on this post but I need to know the answer to this question as well. TIA

+7  A: 

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);
    }
Andrew
agree with andrew I have done the same thing
hib