Here’s a sample on how to use the new support for video files in XNA Game Studio 3.1.
All you have to do is add the video file (wmv) to your Content project, and you’re ready to use it with a few lines of code.
The sample loads a video containing a montage of XNA games, released some while ago. After loading it, you can view it in 4 ways (use spacebar/gamepad A to change):
- simple
- full-screen
- using a post-processing shader (reusing some code from Dark Codex’s tutorials)
- on a rotating sphere object
Here’s some screenshots:
And here’s the sample: VideoSample.zip
P.S. If a video file you have doesn’t work from the first try, try re-encoding it with Windows Movie Maker.


by Catalin’s XNA Experiments » New Sample: XNA GS 3.1 Video Support, on 06.11.09 @ 9:28 pm
[...] More info on the sample’s page, here. [...]
by Alan, on 06.16.09 @ 10:14 pm
Any word on the recipe needed to create the WMV? I’ve tried several of my own WMVs and get complaints when compiling the project.
by Catalin Zima, on 06.16.09 @ 10:22 pm
There’s some solutions for it in the forums (but they’re offline right now). I only encountered problems with 1 video, and then re-encoded it with degault settings in Windows Movie Maker, and it worked. So I’m afraid I don’t have any “magic recipe” for the videos
by Primeros ejemplos de reproducción de video en XNA 3.1 « Aprendiendo XNA, on 06.18.09 @ 9:46 am
[...] http://www.catalinzima.com/?page_id=532 [...]
by Petri Wilhelmsen, on 08.29.09 @ 2:04 am
Thank you for this little article. Was just thinking of adding a video to my application and stumbled across this
by Catalin’s XNA Experiments » Re-awarded XNA/DirectX MVP for 2010, on 04.03.10 @ 6:13 pm
[...] XNA 3.1 Video [...]