tags:

views:

1505

answers:

4

I need to be able to embed and control the playback of an AVI file in a WinForms app, using C#. The video needs to be embedded in the form, not launched in a separate media player window.

What's the best approach to do this? I found the System.Media namespace, which sounded promising, but it appears that is only useful for sound.

Do I use DirectX to do this? MCI? Or some other approach?

+3  A: 

You can use Media Player inside your Winform. This would been an easy way to do it.

Daok
A: 

I would consider using the WPF media controls and just use the ElementHost to put your WPF control inside your WinForms app. I think you will get a much more rich experience.

See System.Windows.Forms.Integration for more information

Brian Genisio
A: 

The suggestions from Daok and Brian Genisio are both good options. Let me add a third: DirectShow. Used to be part of DirectX but has now been promoted to the Windows SDK. There are many good C# sample applications to look at, and it gives complete control of the playback.

Guge
+3  A: 

I highly recommend this library:

http://directshownet.sourceforge.net/

It is a .NET wrapper around the DirectShow API.

(The sample apps should get you going very quickly.)

--Bruce

bvanderw
Thanks. You may have answered this question as well: http://stackoverflow.com/questions/2464613/looking-for-a-component-net-or-com-activex-that-can-play-avi-files-in-a-winfor
MusiGenesis
Have you ever used this? It looks like the sample app can do what I need, but the sample apps for DirectShow.NET don't make much sense to me. I can run it and play a file, and it loops automatically, but all this is done internally and I can't find any way to modify it to play multiple files in succession.
MusiGenesis