1

我已经将扩展“CCVideoPlayer”“导入”到我的 cocos2d 项目中,我想使用它来在我的游戏开始之前显示视频闪屏(我知道很多人讨厌它,但我不在乎)。但是,网上的教程不多,所以你们几乎是我最后的手段。我已将我的视频 - 1280 x 720 Quicktime 电影 (671 MB) - 正确复制到我的项目中,当我打电话时:

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

我看到黑屏并且电影的声音可以正常播放,但是没有视频。所以我该怎么做 ?

旁注:我已经实现了委托方法,并且我的班级遵守CCVideoPlayerDelegate.

4

1 回答 1

1

您也可以通过简单地使用 Objective-C 代码来添加视频闪屏。

第一次导入 MediaPlayer 框架第二个 .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];
}
于 2012-08-13T07:30:29.650 回答