OK, first thing you need to know is that Cocos2d doesn’t play videos, it leaves this up to the iOS SDK on the devices. The following code therefore is Obj C which can be inserted into your projects AppController.mm file or you could create a new mm interface file and put it in there.

* Add the “AVFoundation.framework” to your projects Frameworks (located the Frameworks folder, right click, select “Add ~~> Existing Frameworks”).
* Add the “MediaPlayer.framework” to your projects Frameworks.
* You will need a video to play and to add it to the resources in the project. Use your own or download my sample video from here (MiniVideo640x360.m4v)
* Add the following code to your AppController.mm
<pre>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MPMoviePlayerViewController **playerViewController=NULL;
int g_iPlayVideoState=0;

The above gl command sets your Cocos2D-X window to transparent wherever it is black, so you can see through it to the video behind.

I have a global variable “g_iPlayVideoState” which you can monitor in your Cocos2D applications code to detect when the video ends, its values are 2=initializing, 1=playing, 0=finished. At the end of play you might want to put the views back to non-transparent with the call “glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

As I suspected before, seems the newer iOS keeps (or newer Cocos2D-X loses) the touch dispatch events even after the movie is finished. A fix was to set the movie window layer to hidden at the end of the movie. movieFinishedCallback now looks like below:-

Maybe this is due to the fact that I did not Add the “AVFoundation.framework” and “MediaPlayer.framework” or the “equivalent” to the project but I don’t know how to do that on win32 with visual studio 2008 ( or what to add ).
If I understood correctly AVFoundation.framework and MediaPlayer.framework are from iOS SDK, so how about Android and win32 ?
Ideas of how to make it work on win32 and Android ?

Congratulations on choosing Cocos2d-x! It’s quite powerful and has helped me progress with my game, but one thing it doesn’t do is play videos. Hence, I wrote the above to play videos but it is only for iOS devices (iPhone, iPad, etc). You’ll notice the code is in a “.mm” file which is the ObjC file (iOS SDK).

So if you want to play videos on Win32 you will need to write the code for that platform yourself, there is plenty of source code and tutorials on the CodeProject here: http://www.codeproject.com/kb/audio-video/