2012-07-05 147 views
1

我已經將「CCVideoPlayer」擴展名「導入」到了我的cocos2d項目中,我想用它來在我的遊戲開始之前顯示視頻閃屏(我知道很多人討厭它,但我不關心)。但是,互聯網上的教程並不多,所以你們幾乎是我最後的選擇。我抄我的視頻 - 1280×720的QuickTime影片(671 MB) - 爲我的項目正常,當我打電話:CCVideoPlayer無法正常工作

[CCVideoPlayer setDelegate:self]; 
    [CCVideoPlayer playMovieWithFile:@"Main.mov"]; 

我看到一個黑色的屏幕和電影的聲音能夠正常播放,但有沒有視頻。所以我該怎麼做 ?

附註:我已經實現了委託方法,我的班級堅持CCVideoPlayerDelegate

回答

1

您也可以通過簡單地使用objective-c代碼添加視頻啓動畫面。

一號通進口MediaPlayer的框架 2日,在.h文件中的#import

.M中的任何方法文件 -

{ 
NSString *path=[[NSBundle mainBundle] 
        pathForResource:@"videoName" ofType:@"mov"]; //only .mov file can run here 

    MPMoviePlayerViewController * player=[[MPMoviePlayerViewController alloc] 
      initWithContentURL:[NSURL fileURLWithPath:path]]; 

    [ self presentMoviePlayerViewControllerAnimated: player]; 
}