C# Play MP3 from Resources with MCI or WMP control?
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
精彩评论