Play .wav file without crashing the program

119 Views Asked by At

I'm currently using this method to play a .wav file:

private void button5_Click(object sender, System.EventArgs e)
{
    System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.Song1);
    player.PlaySync();
}

It's playing the .wav file for like a second, then it stops and a few seconds later after stopping, the program freezes and closes itself without showing any errors.

Did anyone experience this too and if so, (how) did you solve it?

0

There are 0 best solutions below