Video Playback

How to play videos?

Follow these steps to load videos at runtime and play them:

Video Codecs & Licensing

GameMaker does not ship with any codecs, and makes use of the codecs present on the platform that the game is running on. This means your videos must be encoded in a format that can be decoded on your intended target platform(s).

Making use of certain formats may require you to pay licensing fees depending on the related codec's licence and your game's revenue, and in such a case, the developer will be legally liable for any fees that is to be paid to the codec owners. Codecs are also licensed differently on each platform and so care must be taken for games that are distributed on multiple platforms.

Note that video formats (such as .mp4, .avi, .mkv, etc.) are simply containers that wrap video and audio streams, both of which may be encoded separately and may require separate licences.

For distribution on console platforms, check with your account representative to find out what formats you are allowed to use without having to pay extra licencing fees.

Formats

The video formats that you are able to load and play in your game will depend on your target platform, and the codecs that are supported on that platform.

Functions

You can load, play and manipulate video files at runtime using the following functions:

 

The following functions are used to get information about the currently loaded video:

Async Callbacks

The Async Social event is triggered at the stages given below, with the "type" key in its async_load map set to the given value:

Here is an example of an Async Social event listening to video callbacks:

var _type = async_load[? "type"];

if (_type == "video_start")
{
    obj_video.display_video = true;
}
else if (_type == "video_end")
{
    obj_video.display_video = false;
    video_close();
}

The above code reads the type from the async_load map. When the video starts, it sets a variable in an object to true, so it can display the video.

When the video ends, it sets that same variable to false, and then calls video_close() to remove the video from memory.