Whether it's showing your game studio's logo sequence at the start of the game, or it's telling an important part of your story using cutscenes—sometimes you need to play full motion video. That's why in this recipe you will learn how to load a video and replay it in the game window.
This sample uses the project structure created in Setting up the game structure found in Chapter 1. You also need to add a directory called videos
to the project's source tree to keep your assets organized. Make sure that the videos
directory is on Panda3D's content search path!
Of course, you need to provide a video file for playback. Panda3D uses the FFmpeg
programming library for decoding video data, so it should be able to process any codec supported by FFmpeg
. The sample code assumes you are using an AVI file.