2010-12-14 152 views
3

我想將mp4視頻設置爲全屏,並且它看起來很簡單,但每當我調用setFullscreen方法時,它就會變成白色的空白屏幕。有任何想法嗎?這裏是我的代碼:MPMoviePlayerViewController 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]; 
} 

如果我註釋掉最後一行,視頻將發揮,但不知何故整個屏幕變成白色屏幕,而不是僅僅最大化視頻。

謝謝。

+0

如果你在prepareToPlay之前調用'setFullscreen',會發生什麼? – 2010-12-14 21:30:43

+0

同樣的事情發生了。我也嘗試使用moviePlayerController,他們都產生相同的結果... – okysabeni 2010-12-14 23:43:21

回答

1

我有一個類似的問題,這段代碼爲我工作。

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

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

謝謝賈森:)。它的工作很好! 。 – 2014-10-04 19:51:15