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

6.2k views Asked by At

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 MCI, I'm not particular. I'm fairly new to C#. Thanks!

2

There are 2 answers

0
Gary the Llama On

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();
0
Horacio N. Hdez. On

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