2012-10-22 25 views
3

我有我的開放類控制器中的方法,實例化一個moviePlayer,它被設置爲'autoPlay = NO';ios6 moviePlayer第一幀沒有出現在創建

我已經添加了movieplayer.view作爲控制器視圖的子視圖,配置它並在頂部創建了一個全屏按鈕以啓動視頻。自iOS4.3以來,這一直工作正常。該按鈕是透明的,視頻的第一幀顯示出來(這是自定義Automoble Auto-Start按鈕的圖片)。

自iOS6以來,我只能看到黑屏。 單擊圖像按鈕確實會開始視頻,因爲它應該;來電[moviePlayer play]

有什麼改變,我沒有考慮到? 我提供了我認爲必要的兩段代碼。

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

} 

回答

0

你試過:

[moviePlayer.view addSubView:startButton]; 
+0

不,我沒有「StartButton」本身。視頻的前幾個幀是存在於該特定汽車中的開始按鈕的圖像。點擊視頻頂部的全屏UIButton時,視頻開始播放視頻,開始按鈕開始搖動並被按下。 – jtingato

+0

就像我說的,在iOS 6之前,只需添加使用的視頻顯示暫停視頻的第一幀。 – jtingato

2

我不知道爲什麼我有一個-1評級這個問題缺乏研究或清晰? 也許我不知道這個論壇的正確用法。 我很抱歉。

我確實發現添加[moviePlayer prepareToPlay]解決了這個問題。就像我說的,奇怪的是,第一幀總是出現在iOS 6之前。

相關問題