开发者

MPMoviePlayerController: unable to switch from fullscreen to embedded

i have a portrait view with an embedded video. When changing orientation to landscape, the MPMovieplayerController successfully swi开发者_JAVA技巧tsches to fullscreen, but when changing back to portrait, it stays in fullscreen mode. The navigation bar flashes up for the rotation animation, but the video stays in (portrait-)fullscreen mode.

Do i miss something here?

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    m_player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:self.selectedVideo.videoHighURL ]]; 
m_player.scalingMode = MPMovieScalingModeAspectFit; 
m_player.controlStyle = MPMovieControlStyleFullscreen;
    m_player.view.frame = m_videoView.frame;
    [m_videoView addSubview:m_player.view];

[m_player play];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}



- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    switch (toInterfaceOrientation) {
    case UIInterfaceOrientationPortraitUpsideDown:
        break;

    case UIInterfaceOrientationLandscapeLeft:
    case UIInterfaceOrientationLandscapeRight:
        if (NO == m_player.fullscreen) {
            [m_player setFullscreen:YES animated:YES];
        }
        break;
    case UIInterfaceOrientationPortrait:
            [m_player setFullscreen:NO animated:YES];

        break;

    default:
        break;
    }

}

Thanks in advance!


Solved the problem. I used MPMovieControlStyleFullscreen which seems to be incompatible with setFullscreen. With MPMovieControlStyleEmbedded it works fine... strange (Bug?).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜