Here's an implementation using a MPMoviePlayerViewController
subclass supporting portrait and portrait upside down (but you can easily change the mask). This works in iOS 6 as you suggested, prior versions have different rotation selectors.
Usage:
NSURL* url = [NSURL URLWithString:@"your_movie"];
MovieViewController* mvc = [[MovieViewController alloc] initWithContentURL:url];
// I did this from the app delegate.
// You could push this view controller, present it modally, etc.
[self.window setRootViewController:mvc];
In MovieViewController.h:
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface MovieViewController : MPMoviePlayerViewController
- (id)initWithContentURL: (NSURL*) url;
@end
In MovieViewController.m:
#import "MovieViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@interface MovieViewController ()
@end
@implementation MovieViewController
- (id)initWithContentURL: (NSURL*) url
{
self = [super initWithContentURL: url];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
ROTATION CODE
*/
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
@end
Result (note rotation is enabled on the project for all rotations..):
