Playing a video in Xna game studio
This tutorial will teach you how to play a video in XNA game studio.
The videos in this tutorial were in the wmv format
Step One
Add this to the top of you code :
using Microsoft.Xna.Framework.Media;
Step Two
Declare the VideoPlayer and the video to play:
VideoPlayer vPlayer;
Video instructions;
Step Three
Instantiate the VideoPlayer and load the video to play:
vPlayer = new VideoPlayer();
//is the video looping?
vPlayer.IsLooped = true;
//load the videos
instructions = content.Load<Video>(@"Videos/1_start_game_instructions");
Step Four
Play the video using:
vPlayer.Play(instructions);
Step Five
Draw the current frame in the Draw method:
spriteBatch.Draw(vPlayer.GetTexture(), new Vector2(0, 0), Color.White);
Notes**
To Pause the video: vPlayer.Pause();
To Resume playback: vPlayer.Resume();
A Screenshot
This screenshot shows how you might use this to display sign language instructions
