C#C
C#4y ago
Exilon

Restarting audio with MediaPlayer?

I've made a button that uses MediaPlayer to play a custom MP3 file that I've made.
MediaPlayer flashSound;
flashSound = new MediaPlayer();
flashSound.Open(new Uri(@"FlashBangSound.mp3", UriKind.RelativeOrAbsolute));

...

private void Button_Click_1(object sender, RoutedEventArgs e)
{
  flashSound.Play();
}

This does work too. It's just that it only works once. Once I press the button again, nothing happens and I believe its because the audio is finished and needs to be restarted, but how would I do that?
Was this page helpful?