Project Description

Allows Video Playback in the Microsoft XNA Framework, using DirectShow.
More information on DirectShowLib-2005 can be found at their project site: http://directshownet.sourceforge.net/index.html.

Usage

  • Add both SeeSharp.Xna.Video.dll and DirectShowLib-2005.dll to your XNA project
  • Reference both these dlls
  • Create a new VideoPlayer object, passing in the filename of the video to play
  • Call VideoPlayer.Update() in the Game.Update() method every frame to update the player
  • The Play(), Pause(), Stop() and Rewind() methods can be called as soon as the player has been created.
  • To draw the video, use a SpriteBatch in the Game.Draw() method to draw the VideoPlayer.OutputFrame Texture2D. It is important to enable SaveState mode on the SpriteBatch to prevent subsequent VideoPlayer.Update() calls failing.
  • The OnVideoComplete event handler is fired when the video finishes (ie, the video reaches the end and stops). This can be used to continue the game etc once a video such as a cutscene has finished.
  • Important: Ensure that you call VideoPlayer.Dispose() once you have finished with the player, otherwise the player, video and threads may not be disposed properly.

See the provided sample for more information.

Last edited Feb 24, 2008 at 2:42 PM by un4filled, version 3