How do I play movies in a C# WinForm application

2019-03-22 02:36发布

I am trying to play a movie (wmv,avi,mpg,etc.) in a winforms application. I would like the user to be able to start, stop and pause.

I'm not looking for a full answer ... I just need pointed in the right direction. I've already did some searching on google but could not find anything useful. I can continue searching but I know the stackoverflow community rocks.

So, please point me in the right direction!

Thanks.

5条回答
太酷不给撩
2楼-- · 2019-03-22 02:41

I think this is probably the path of least resistance:

http://msdn.microsoft.com/en-us/library/bb383953.aspx

查看更多
可以哭但决不认输i
3楼-- · 2019-03-22 02:48

Another alternative is to use the VLC library instead of Windows Media Player. The VLC Forums have a number of wrappers that can be used in C#.

I have not done a comparison of VLC versus Windows Media Player, but it is alot less resource intensive then the WPF media elements.

If I remember correctly VLC also has built in support for alot of video formats, potentially making it a better choice I guess.

查看更多
4楼-- · 2019-03-22 02:48

It depends on how complicated you want to get, but I've had luck implementing DirectShow before. It's definitely more complicated than a drop on control, but it's really flexible for different formats and loading codecs.

查看更多
Melony?
5楼-- · 2019-03-22 03:00

You could use Windows Media Player ActiveX control.

You could also embed a WPF control that contains a MediaElement control.

查看更多
一夜七次
6楼-- · 2019-03-22 03:03

One possibility is to use the Forms.WebBrowser class. This will give you an embedded web browser so you can install what ever player and plugins you need.

查看更多
登录 后发表回答