iphonempmoviewcontroller

MPMoviePlayerViewController not rotating in landscape with tabbar


I display a video using MPMoviePlayerViewController in a tabbar application, the video plays fine in portrait mode but doesn't rotate in landscape mode.

The same code works fine in another project without the tabbar.

I tried to force the autoresizingmask to flexibleWidth and flexibleHeight without success.

If i return YES in the shouldAutorotateToInterfaceOrientation the status bar rotates but not the movie interface.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}

    -(IBAction) showFamilleMovie {
     NSString *videoURL = [[NSBundle mainBundle] 
            pathForResource:@"film1" 
            ofType:@"mp4"];

     MPMoviePlayerViewController* theMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoURL]];
        theMoviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self presentMoviePlayerViewControllerAnimated:theMoviePlayer];

    }

Do you have any idea where the project could come from ?

Thanks, Vincent


Solution

  • you can try:

     [yourTabbarController presentModalViewController: theMoviePlayer]
    

    that should allow MoviePlayer to rotate.