Here is my media player playlist code setup, working with the windows media player library.
Right now what I'm doing is creating the media player and giving it a playlist.
WindowsMediaPlayer wmPlayer = new WindowsMediaPlayer();
wmPlayer.PlayStateChange += Player_PlayStateChange;
IWMPPlaylist playlist = wmPlayer.playlistCollection.newPlaylist("All");
wmPlayer.currentPlaylist = playlist;
I then add songs to the playlist
IWMPMedia media = _wmPlayer.newMedia(path); //path to mp3 is given via method parameter
wmPlayer.currentPlaylist.appendItem(media);
This allows me to easily execute basic music player controls and I don't need to manually go to the next/previous song.
wmPlayer.controls.play();
wmPlayer.controls.pause();
wmPlayer.controls.next();
wmPlayer.controls.previous();
What I would like to do is get the index of the current media that is playing/paused in the playlist (wmPlayer.currentPlaylist
). Is that possible?
I know that you can get a song at a specific index via wmPlayer.currentPlaylist.Item[index];
, but I cannot find out how to get the index of the current song.
Any help is much appreciated. Thanks.