How can I play a WAV audio file in from my project's Resources? My project is a Windows Forms application in C#.
Because mySoundFile is a Stream, you can take advantage of SoundPlayer's overloaded constructor, which accepts a Stream object:
mySoundFile
Stream
SoundPlayer
System.IO.Stream str = Properties.Resources.mySoundFile; System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str); snd.Play();
SoundPlayer Class Documentation (MSDN)
1.4m articles
1.4m replys
5 comments
57.0k users