IOS - forced full-screen video

I am using MPMoviePlayerViewController. When a video loads and starts playing, it does not fill the entire screen. I have to click the full screen button in the upper right corner for this to happen. If I use MPMoviePlayerController, I cannot make it fill the screen at all.

In any case, with the code that I can get in full screen using MPMoviePlayerViewController, without clicking on the full-screen button?

I know that I am using a private API here, but this is normal, this is for demonstration.

the code:

- (void)viewDidLoad
{
[super viewDidLoad];


[[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait];
NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"phatpad" ofType:@"mov"];

if (moviePath)
{
    NSURL *url = [NSURL fileURLWithPath:moviePath];
    player = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
}

player.view.frame = self.view.frame;

[self.view addSubview: player.view];

}

Here is the screen. The first - without pressing the full screen button, the second - after pressing. enter image description here

+5
source share
2

fullscreen true, scallingMode :

if (moviePath)
{
    NSURL *url = [NSURL fileURLWithPath:moviePath];
    player = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
    player.moviePlayer.fullscreen = YES;
    player.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
}

, , .

+14

iPhone iPod Touch MPMoviePlayerController , , , iPad? ? UIView XIB . ?

0

All Articles