I suppose you know how to add mp3 file to project resource (right click on the project -> Properties -> Resources tab -> On Add resource tab click Add existing file).
After you added, for example tada.wav (C:\Windows\Media\tada.wav), to project resources you can type this code for example to Form_Load event:
Stream str = Properties.Resources.tada; SoundPlayer snd = new SoundPlayer(str); snd.Play();
If you type "DirectShow C#" into your favorite search engine you will get several hits with example source code showing how to create a simple media player in C# that will play mp3, wma and other compressed AV formats. Or you can also use the Windows Media Player ActiveX control, as demonstrated in this video on the C# Express Web site:
Hey you are in a C# express forum. NOT VB. So please don't post code that isn't C#.
I know how 2 play a file, i want to embed the mp3 in my exe and have my exe beable to play the file that is embedded. But .net 2.0 is stupid and only like wav files.
I wish the soundplayer class could play WMA and MP3 file but it does not.
How do i use embedded mp3 file.
Waterbaby
SoundPlayer only works with WAV, For me to use wav will make the file 15 mb or more.
Please read the entire post and understand before posting.
snehalppatel
After you added, for example tada.wav (C:\Windows\Media\tada.wav), to project resources you can type this code for example to Form_Load event:
Stream str = Properties.Resources.tada;
SoundPlayer snd = new SoundPlayer(str);
snd.Play();
Romain Larmet
If you type "DirectShow C#" into your favorite search engine you will get several hits with example source code showing how to create a simple media player in C# that will play mp3, wma and other compressed AV formats. Or you can also use the Windows Media Player ActiveX control, as demonstrated in this video on the C# Express Web site:
http://msdn.microsoft.com/vstudio/express/visualcsharp/learning/default.aspx#forms
Michael Blome - Visual C# Documentation Team
Gaetano77
Hi,
Below link might be of some help.
Link: http://www.planet-source-code.com/vb/scripts/ShowCode.asp txtCodeId=4582&lngWId=10
If you think that this has answered your post then please mark it as answer.
Thank you,
Bhanu.
Irv154449
I know how 2 play a file, i want to embed the mp3 in my exe and have my exe beable to play the file that is embedded. But .net 2.0 is stupid and only like wav files.
I wish the soundplayer class could play WMA and MP3 file but it does not.