Playing video with cocos2d


  1. Download cocos2d extension from: https://github.com/cocos2d/cocos2d-iphone-extensions
  2. Unzip, navigate into the directory: extensions -> CCVideoPlayer.
  3. Copy file CCVideoPlayer.h and CCVideoPlayer.m and the folder iOS. 
  4. Insert them anywhere in the project.
  5. In CCVideoPlayer.m, comment out the line #import "CCVideoPlayerImplMac.h"
  6. Done! To play video, simply do: [CCVideoPlayer playMovieWithFile:@"filename.mp4"]
  7. You can set a delegate to the CCVideoPlayer by implementing protocol: <CCVideoPlayerDelegate>
  8. The protocol will call method: 
    -(void) movieStartsPlaying
    when the movie starts
    and
    -(void) moviePlaybackFinished
    when the movie finishes.

0 komentar:

Posting Komentar