How to disable FullScreen in MPMoviePlayerViewController in iOS

I work with MPMoviePlayerViewController ,

 MPMoviePlayerViewController *avPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; // [movieView prepareToPlay]; [avPlayer.view setFrame: CGRectMake(0, 200, 320, 100)]; // player frame must match parent's [avPlayer shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]; [avPlayer shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]; avPlayer.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; avPlayer.moviePlayer.useApplicationAudioSession=NO; avPlayer.moviePlayer.controlStyle=MPMovieControlStyleEmbedded; //avPlayer.moviePlayer.repeatMode=MPMovieRepeatModeOne; avPlayer.moviePlayer.scalingMode=MPMovieScalingModeFill; [self.view addSubview: avPlayer.view]; 

This functionality is working fine. But I need to disable full screen mode for MPMoviePlayerViewController . So I wrote

 avPlayer.moviePlayer.fullscreen=NO; 

But that does not work.

Could you give me an offer.

+6
source share
2 answers

Use this code to turn off full screen in MPMoviePlayerViewController .

 moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone; 

or check this to enter a view controller.

  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(Enter:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(Enter:) name:MPMoviePlayerDidEnterFullscreenNotification object:nil]; 

I hope this code is helpful to you.

0
source

Try it...

 - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieEventFullscreenHandler:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieEventFullscreenHandler:) name:MPMoviePlayerDidEnterFullscreenNotification object:nil]; self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; } - (void)movieEventFullscreenHandler:(NSNotification*)notification { [self.moviePlayer setFullscreen:NO animated:NO]; [self.moviePlayer setControlStyle:MPMovieControlStyleEmbedded]; } 

Check this answer

-3
source

Source: https://habr.com/ru/post/951017/


All Articles