我用下面的代碼來播放電影在iPad 1上運行iOS6的無畫面:的MPMoviePlayerController:聲音,但在全屏模式下
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myMovie.mov" ofType:@""]];
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.moviePlayer];
// Use the new 3.2 style API
self.moviePlayer.controlStyle = MPMovieControlStyleDefault;
[self.moviePlayer prepareToPlay];
self.moviePlayer.view.frame = CGRectMake(0, 0, 1024, 768);
[self.uiView addSubview:self.moviePlayer.view];
//[self.moviePlayer setFullscreen:YES animated:YES];
[self.moviePlayer play];
這工作。
但是,如果我取消註釋行setFullscreen
,我得到的電影音頻,但有一個完全黑屏,沒有圖片。
我試過改變幾行的順序,特別是play
調用和setFullscreen
調用,沒有任何效果。
更新
這個問題似乎是直接相關的:
MPMoviePlayerController in full screen issue (showing blank black screen)
這個問題並非真正的答案,但我已切換到MPMoviePlayerViewController,並且它對全屏視頻效果很好。 – occulus