views:

30

answers:

1

Hi,

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

A: 

you can try:

 [yourTabbarController presentModalViewController: theMoviePlayer]

that should allow MoviePlayer to rotate.

Deniz Mert Edincik
Unfortunatly same problem...
vdaubry
But i just realized the problem might be coming from the fact that i am already in a modal view ?
vdaubry
actually tabbar requires all children to respond, same answer to shouldAutorotateToInterfaceOrientation. Otherwise it does not support autorotation at all. By presenting video model, we are detaching it from tabbar, so it can rotate freely.
Deniz Mert Edincik
I tried to add shouldAutorotateToInterfaceOrientation to all the controller inside the tabbar. They all rotate to landscape but when i try to present the movie as a modal viw, only the status bar rotate (!). Do you you think it could come from the fact that the tabbar is already a modal view itself ?
vdaubry
I am not sure about it really, but it is highly possible.
Deniz Mert Edincik