MPMoviePlayerViewController setFullScreen:显示白色屏幕

时间:2010-12-14 21:21:56

标签: iphone uitableview mpmovieplayercontroller

我想将mp4视频设置为全屏,看起来很简单,但每当我调用setFullscreen方法时,它就会变成一个白色的空白屏幕。有任何想法吗?这是我的代码:

- (void)tableView:(UITableView *)aTableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
......
moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:movpath]];
[self presentModalViewController:moviePlayerViewController animated:YES];

moviePlayerController = [moviePlayerViewController moviePlayer];
[moviePlayerController prepareToPlay];

[[moviePlayerViewController moviePlayer] play]; 
[[moviePlayerViewController moviePlayer] setFullscreen:YES animated:YES];
}

如果我注释掉最后一行,视频将播放,但不知何故全屏变为白色屏幕,而不是仅仅最大化视频。

感谢。

1 个答案:

答案 0 :(得分:1)

我有类似的问题,这段代码对我有用。

MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:URL]];

            [moviePlayer.view setBackgroundColor:[UIColor blackColor]];
            [moviePlayer.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
            [self presentMoviePlayerViewControllerAnimated:moviePlayer];
            [moviePlayer.moviePlayer play];