Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
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:

attachment.php
 

Attachments

  • Screen Shot 2012-04-04 at 11.08.31 AM.png
    Screen Shot 2012-04-04 at 11.08.31 AM.png
    184.1 KB · Views: 2,863
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
 
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

It fills the screen, but controls still won't appear and doesn't appear very nice looking like something is messed up
 
What do you mean by messed up?

It fills the screen, but controls still won't appear and doesn't appear very nice looking like something is messed up

Have you set the control style property?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.