I play mp3s and m4as with the following method:
private void playmp3(string path)
{
WMPLib.WindowsMediaPlayer a = new WMPLib.WindowsMediaPlayer();
a.URL = path;
a.controls.play();
}
Usually when I play them, they only play for around 5 seconds or less and then stop playing. If i interact with the (WPF) form in any way, it also stops. I call playmp3
from a BackgroundWorker
.
Edit: It actually stops playing about a tenth of a second after I move my mouse.