开发者

C# Play MP3 from Resources with MCI or WMP control?

开发者 https://www.devze.com 2022-12-11 14:57 出处:网络
I have a MP3 file in my Resources of Visual C#. I\'m trying to find out if there is a way I can play this MP3 in a Windows Media Player control or with M开发者_JS百科CI, I\'m not particular. I\'m fair

I have a MP3 file in my Resources of Visual C#. I'm trying to find out if there is a way I can play this MP3 in a Windows Media Player control or with M开发者_JS百科CI, I'm not particular. I'm fairly new to C#. Thanks!


This page shows you how in just a few lines of code:

http://www.crowsprogramming.com/archives/58

Hope this helps.

Edit: Be sure to copy the .mp3 to your bin before you run it.

And here is the source code. Be sure to add a reference to wmp.dll in your project.

WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayer();
wmp.URL = "test.mp3";
wmp.controls.play();


this is a component for playing MP3 with C# on Windows Forms (it includes a demo app).

http://www.codeplex.com/keniamm/

hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号