I want to run an .MP3 file in my C # application, but whenever I run the timerson
method, I get an error that tells me that WindowsMediaPlayer is in use .
I do not know how to close the instance or kill that process because it does not let me continue in my code.
This is the current code:
public void timerson()
{
MessageBox.Show("Cada cierto tiempo segundos");
WindowsMediaPlayer myplayer = new WindowsMediaPlayer(); -- Error
myplayer.URL = @"C:\Users\david\Music\Cancion.mp3";
myplayer.controls.play();
}
public void ejecutar()
{
var timer = new System.Threading.Timer(
e => timerson(),
null,
TimeSpan.Zero,
TimeSpan.FromMinutes(0.3));
}