Trying to get a WMPLib to go to the next track when the current one ends. My code is below, but it never fires. I've tried with WMPLib.WMPPlayState.wmppsStopped as well as WMPLib.WMPPlayState.wmppsMediaEnded and it never fires. Anyone see what I'm doing wrong? The media player is afile.
Thanks in advance.
private void mediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
MessageBox.Show("Playstate Has Fired");
if (mediaPlayer.playState == WMPLib.WMPPlayState.wmppsStopped) // check if file has ended.
{
try
{
listFiles.SelectedIndex++;
}
catch (Exception)
{
if (chkLoop.Checked)
{
listFiles.SelectedIndex = 0;
}
else
{
afile.controls.stop();
}
}
}
}
Thank you, I got this figured out by using a timer_tick event, and adding this to it:
Works great. Thanks again.