6

I am working with MPMoviePlayerViewController,

MPMoviePlayerViewController *avPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
// [movieView prepareToPlay];

[avPlayer.view setFrame: CGRectMake(0, 200, 320, 100)];  // player's 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 working fine. But i need to disable fullscreen for MPMoviePlayerViewController. So, that i wrote

avPlayer.moviePlayer.fullscreen=NO;

But this is not working.

Will you please give me suggestion.

Vineet Singh
  • 4,009
  • 1
  • 28
  • 39
Ravi
  • 888
  • 6
  • 24

2 Answers2

0

Use this code for disable full screen in MPMoviePlayerViewController.

moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone;

or check this for enter your 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 useful for you.

Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
  • 1
    This will not properly function. Try this, use this code and then use a pinch gesture to scale up or down -> bam! – Till Aug 05 '13 at 16:36
-3

Try this...

- (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];
}

Please check this answer

Community
  • 1
  • 1
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276