MPMoviePlayerController:无法从全屏切换到嵌入式

时间:2011-09-19 06:37:00

标签: orientation mpmovieplayercontroller fullscreen

我有一个带嵌入视频的纵向视图。将方向更改为横向时,MPMovieplayerController成功切换到全屏,但在更改回纵向时,它将保持全屏模式。导航栏会闪烁以显示旋转动画,但视频仍处于(纵向)全屏模式。

我在这里想念一下吗?

- (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;
    }

}

提前致谢!

1 个答案:

答案 0 :(得分:0)

解决了这个问题。我使用了MPMovieControlStyleFullscreen,这似乎与setFullscreen不兼容。使用MPMovieControlStyleEmbedded它工作正常......奇怪(错误?)。