MPMoviePlayerController Not Showing FullScreen

Discussion in 'iOS Programming' started by newtoiphonesdk, Apr 4, 2012.

  1. newtoiphonesdk macrumors 6502a

    Jul 30, 2010
    I have a navigation controller with a table view inside it that parses an .xml of m4v video podcast. When the item is selected, it pushes VideoWebView View Controller onto the navigation controller, and the code for that viewDidLoad is:
    - (void)viewDidLoad {
    	self.title = _entry.articleTitle;
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        NSError *setCategoryError = nil;
        [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
        if (setCategoryError) { /* handle the error condition */ }
        NSError *activationError = nil;
        [audioSession setActive:YES error:&activationError];
        if (activationError) { /* handle the error condition */ }
        [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
        [self becomeFirstResponder];    
        NSURL *newURL = [NSURL URLWithString:_entry.articleUrl];
       self.player = [[MPMoviePlayerController alloc] initWithContentURL: newURL];
        [player prepareToPlay];
        player.allowsAirPlay = YES;
        player.scalingMode = MPMovieScalingModeAspectFit;
        self.player.view.frame = self.view.frame;
        [self.view addSubview: player.view];
        [self.player setFullscreen:YES animated:YES];
        [[NSNotificationCenter defaultCenter] 
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:player];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateChanged:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:player];
        [player play];
        [super viewDidLoad];
    The movie plays just fine, but does not take up all the screen. The tab bar still shows, the navigation bar still shows. I also cannot get it to pull up any video controls when I tap the screen. A screenshot is attached below:


    Attached Files:

  2. cMacSW macrumors regular

    Mar 20, 2006
    Changing this line:

    player.scalingMode = MPMovieScalingModeAspectFit;
    player.scalingMode = MPMovieScalingModeAspectFill;

    Will cause the video to fill the screen

    To hide the NavigationBar you will need to set the toolbarHidden property to YES
  3. newtoiphonesdk thread starter macrumors 6502a

    Jul 30, 2010
    It fills the screen, but controls still won't appear and doesn't appear very nice looking like something is messed up
  4. cMacSW macrumors regular

    Mar 20, 2006
    What do you mean by messed up?

    Have you set the control style property?
  5. Sykte macrumors regular

    Aug 26, 2010
    Any reason for not using MPMoviePlayerViewController.

Share This Page