|
-
May 25th, 2013, 10:12 AM
#1
Thread Starter
Hyperactive Member
Windows Media Palyer - Show Current Playlist & Delete Song Once Played
Hi & Good Afternoon,
I've got the following code that populates a Listbox with Songs from my PC.
Code:
Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim allMusic() As String = My.Computer.FileSystem.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyMusic), FileIO.SearchOption.SearchAllSubDirectories, "*.mp3", "*.wma").ToArray
lstSongs.Items.AddRange(allMusic)
End Sub
Private Sub lstSongs_DoubleClick(sender As System.Object, e As System.EventArgs) Handles lstSongs.DoubleClick
Player.currentPlaylist.appendItem(Player.newMedia(lstSongs.SelectedItem))
End Sub
Private Sub cmdPlay_Click(sender As System.Object, e As System.EventArgs) Handles cmdPlay.Click
Player.controls.play()
End Sub
To add a song to a playlist you just double click on the required song. You can then play the playlist by pressing the Play button.
What I'd like to do is see the actual playlist in another Listbox, so if you double click on the songs Listbox to add to the playlist the other Listbox will be update accordingly.
Now for the slight twist.... How can remove the song that has just been played from the playlist?
Any thoughts, ideas or pointers will be appreciated.
Thanks & Regards
-
May 25th, 2013, 11:27 AM
#2
Re: Windows Media Palyer - Show Current Playlist & Delete Song Once Played
I'm really not sure why you would want to do that but you could try using the PlayStateChange event to determine when the track changes (but be warned - it's rendered grown men hysterical with its quirks!) or you could run a timer to check periodically what's playing and delete when it changes. I'm assuming you know the .removeitem syntax?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 25th, 2013, 12:24 PM
#3
Thread Starter
Hyperactive Member
Re: Windows Media Palyer - Show Current Playlist & Delete Song Once Played
Many thanks for the reply.
Why would I want to do this?
Well I'm in the slow process of putting together a Jukebox application and thought it'd be neater to remove the song that has just played from the playlist to ensure it isn't inadvertently played again by mistake.
Thanks for the warning regarding the PlayStateChange event 
I'll have look at it and for some examples where it's been used.
I've had a very brief look at the .removeitem syntax, but haven't tried anything with it yet.
Regards
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|