Hi everyone, i have some question regarding my project.. I am currently work on a MP3 player project.. And i came out with a problem..
Here is my code
private void mediaPlayer_PlayStateChange_1(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if (e.newState == 3)
{
double dur = mediaPlayer.currentMedia.duration;
currentSongProgress.Maximum = (int)dur;
}
if (e.newState == (int)WMPPlayState.wmppsPlaying)
{
StatusText.Text = "[Playing]";
timer2.Start();
btnPlay1.Enabled = false;
currentSong.Text = mediaPlayer.currentMedia.name;
}
else if (e.newState == (int)WMPPlayState.wmppsPaused)
{
if (!finished)
{
StatusText.Text = "[Paused]";
timer2.Stop();
btnPlay1.Enabled = true;
currentSong.Text = mediaPlayer.currentMedia.name;
}
}
else if (e.newState == (int)WMPPlayState.wmppsStopped)
{
StatusText.Text = "[Ended]";
timer2.Stop();
btnPlay1.Enabled = true;
currentSong.Text = mediaPlayer.currentMedia.name;
}
else if (e.newState == (int)WMPPlayState.wmppsMediaEnded)
{
StatusText.Text = "[Ended]";
finished = true;
timer2.Stop();
btnPlay1.Enabled = true;
currentSong.Text = mediaPlayer.currentMedia.name;
playlist2.SelectedNode = playlist2.SelectedNode.NextNode;
mediaPlayer.Ctlcontrols.play();
timer2.Start();
}
}
this code should change my treeview node and play the next song when the current song ended..
else if (e.newState == (int)WMPPlayState.wmppsMediaEnded)
{
StatusText.Text = "[Ended]";
finished = true;
timer2.Stop();
btnPlay1.Enabled = true;
currentSong.Text = mediaPlayer.currentMedia.name;
playlist2.SelectedNode = playlist2.SelectedNode.NextNode;
mediaPlayer.Ctlcontrols.play();
timer2.Start();
}
But somehow, that code doesn't help me in automatically change song at all.. Anyone can help? Oh.. Anyway, i am using treeview toolbars as my playlist.. :) :Cheer