I did it:
WindowsMediaPlayer wmp = new WindowsMediaPlayer();
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PostGen.Resources.Kalimba.mp3");
using (Stream output = new FileStream ("C:\\temp.mp3", FileMode.Create))
{
byte[] buffer = new byte[32*1024];
int read;
while ( (read= stream.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
}
wmp.URL = "C:\\temp.mp3";
wmp.controls.play();
We have to delete this temporary file:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
File.Delete("C:\\temp.mp3");
}