**This is an old revision of the document!**

This tutorial will show you how to play videos in your game using java script. This method was made by my brother Zeal Mayfield. It works on Chrome I haven't tested it in other browsers.

First start by enabling JavaScript in your game. Right click on your project icon and select “Edit the property of the game”

Next you will need to download the java script code file below to your computer.

https://drive.google.com/file/d/0B0ytvwZTF0r1UVhCbHBCUVI2QlE/view?usp=sharing

In GDevelop add this file as a source code by right clicking on the source file and selecting “Add an already existing source file”.

It will open a browser locate the file you just downloaded and select it and press “Open”. Don't quote me on this but this file allows for the use of JQuery which is a Java Script Library so we can easily write simple code to display a video later.

OK to create the Java Script to play the video Cick “Events” then on the bar above “Add” then “JavaScrip Code(Web platform only)” and type: window.video.play(“<Filename.ext>”, “controls”);

If you don't remove the comma and “controls” the video will just auto play. There is more options you can add with controls being displayed, auto start and different things maybe someone can add those to this wiki later.

A JavaScript box will appear now you can create a condition, you can see I chose on click. Create a SubEvent on that even and drag the JavaScript Code box underneath it. When I click the mouse the video will play.

This will not work in the preview because I have not figure out how to get the video files into the correct place to be played. I export the Web Platform and then just put the videos I'm using inside the main folder.
If you want you can export to a folder that has local server running out of it to test it quickly. I use http://www.freeutils.net/source/jlhttp/ it works great for video playback, and even video scanning.