I am placing an MPMoviePlayerController in my view at a certain size and position. This is working fine. However, in certain circumstances, I want the video to play full screen. My view is part of a UISPlitViewController, so if I just get the view width, it is not full screen. What I need is to show the video as if the user had clicked the double ended arrow in the player controls to maximise the video.
Here is my code so far. Can anyone fill in the missing bit that forces the full screen playing?
- (void)viewDidLoad
{
[super viewDidLoad];
// FIND OUT HOW MANY VIDEOS ARE AVAILABLE
int videoCount = [[self videos] count];
// GET THE FILE NAME OF THE FIRST AVAILABLE VIDEO
NSString* fileName = [NSString stringWithFormat:@"%@.mp4", [self videos] objectAtIndex:0]];
NSArray *arrayPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString *filePath = [path stringByAppendingPathComponent:fileName];
NSURL *url = [NSURL fileURLWithPath:filePath];
// PLACE THE MOVIE AT THE CORRECT LOCATION ON THE PAGE
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[moviePlayer view] setFrame:CGRectMake(100, 100, 600, 360)];
[[moviePlayer view] setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[[self view] addSubview:moviePlayer.view];
[moviePlayer play];
if(videoCount == 1)
{
-- MAXIMISE THE VIDEO TO FULL SCREEN AND LANDSCAPE --
}
}
Thanks