views:

63

answers:

3

Hi I want to play a WMV (Or Video File ) in C# Application..

I Have made software in which when i click file then File menu opens then i select the media file but then when i click on play then file should be played..

so please guide me...

and if any dll is required then please tell me ...

thanks in advance

A: 

You can use

System.Diagnostics.Process.Start("filename");

To start the media file in the default media player.

Or you can use SoundPlayer if you want to control the playing from code.

System.Media.SoundPlayer player = new System.Media.SoundPlayer("filename");
player.Play();

Edit: Sorry, SoundPlayer is only for sounds.

Albin Sunnanbo
@Albin Sunnanbo:Sorry, But SoundPlayer is used only for audio not video and also waw file is allowed in SoundPlayer
+2  A: 

You can use the DirectX AudioVideoPlayback library. It's not the best, but it's pretty simple to use:

http://msdn.microsoft.com/en-us/library/bb324497(VS.85).aspx

Andy
+1. Think this is also the best solution, because DirectX is available on nearly all machines, in contrast to Silverlight.
Emiswelt
A: 

on the more complicated but powerful side of things, you could host one of the silverlight players in your app.

http://silverlightviewport.codeplex.com/

James Manning