3

'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];

}
4

2 に答える 2

2

調査や明確さが不足しているために、この質問の評価が -1 になった理由がわかりません。このフォーラムの正しい使い方を知らないのかもしれません。謝罪します。

[moviePlayer prepareToPlay] を追加すると問題が解決することがわかりました。私が言ったように、iOS 6 より前に最初のフレームが常に表示されるのは奇妙でした。

于 2012-10-24T22:41:21.710 に答える
0

やってみました:

 [moviePlayer.view addSubView:startButton];
于 2012-10-22T18:45:22.330 に答える