MPMoviePlayerController Not Showing FullScreen

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

  1. newtoiphonesdk macrumors 6502a

    Joined:
    Jul 30, 2010
    #1
    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:
    Code:
    - (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] 
         addObserver:self
         selector:@selector(movieFinishedCallback:)
         name:MPMoviePlayerPlaybackDidFinishNotification
         object:player];
        
        [[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:

    [​IMG]
     

    Attached Files:

  2. cMacSW macrumors regular

    Joined:
    Mar 20, 2006
    #2
    Changing this line:

    player.scalingMode = MPMovieScalingModeAspectFit;
    to
    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

    Joined:
    Jul 30, 2010
    #3
    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

    Joined:
    Mar 20, 2006
    #4
    What do you mean by messed up?

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

    Joined:
    Aug 26, 2010
    #5
    Any reason for not using MPMoviePlayerViewController.
     

Share This Page