'autoPlay = NO' に設定されている moviePlayer をインスタンス化するメソッドが、オープン クラス コントローラ内にあります。
movieplayer.view をコントローラー ビューのサブビューとして追加し、それを構成して、ビデオを開始するためのフル スクリーン ボタンを一番上に作成しました。iOS4.3以降は問題なく動作しています。ボタンは透明で、ビデオの最初のフレームが透けて見えます (これは、カスタムの Automoble Auto-Start ボタンの画像でした)。
iOS6以降、黒い画面しか表示されません。画像ボタンをクリックすると、ビデオが開始されます。[moviePlayer play] を呼び出します
私が考慮していない何かが変わったのですか?必要と思われるコードの 2 つのセクションを提供しました。
#define INTRO_MOVIE @"Intro.mov"
-(void)viewDidLoad
{
if(SHOULD_PLAY_INTRO_VIDEO)//Debug switch to ignore the intro video
{
// Prepare the movie and player
[self configureIntroMoviePlayer];
[self.view addSubview:moviePlayer.view];
[self.view bringSubviewToFront:moviePlayer.view];
// Add and Show the Start Button to start the App
[self configureStartButton];
[self.view addSubview:startButton];
}
}
-(void)configureIntroMoviePlayer
{
LOGINFO
// Prepare the Intro Video
NSString *pathToIntroVideo = [ mainFilePath_ stringByAppendingPathComponent: INTRO_MOVIE];
NSURL *URLToIntroVideo = [NSURL fileURLWithPath:pathToIntroVideo];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:URLToIntroVideo];
[moviePlayer setShouldAutoplay:NO];
moviePlayer.view.frame = CGRectMake(0, -20, 1024, 768);
[moviePlayer setControlStyle:MPMovieControlStyleNone];
//fixing video brightness Difference with iPad2
if(isIpad2)
{
moviePlayer.backgroundView.backgroundColor = [UIColor blackColor];
moviePlayer.view.alpha = .99;
}
// Create the sKip button for cancelling the Intro Video
skipIntro = [UIButton buttonWithType:UIButtonTypeCustom];
[skipIntro showsTouchWhenHighlighted];
skipIntro.frame = CGRectMake(900, 20, 111, 57);
[skipIntro addTarget:self action:@selector(skipIntroWasPressed) forControlEvents:UIControlEventTouchUpInside];
}