Creating & Playing Playlist – VB.Net Windows Media Player Control

'create playlist
 Dim newPlayList As WMPLib.IWMPPlaylist = wmpControl.playlistCollection.newPlaylist("soundsToPlay")
 newPlayList.appendItem(wmpControl.newMedia("C:\Sample1.mp3"))
 newPlayList.appendItem(wmpControl.newMedia("C:\Sample2.mp3"))
'play the list
 wmpControl.Visible = False
 wmpControl.currentPlaylist = newPlayList
 wmpControl.stretchToFit = True
 wmpControl.Ctlcontrols.play()
Creating & Playing Playlist – VB.Net Windows Media Player Control

9 thoughts on “Creating & Playing Playlist – VB.Net Windows Media Player Control

  1. chris cardwell says:

    I think this is one of the most important info for me.
    And i’m glad reading your article. But should remark on few general things, The site style is great, the articles is really excellent : D. Good job, cheers

    Like

  2. Sergio says:

    hi
    pretty nice your code, really helpfull!!! thanks!!
    I got some question:
    1. It is posible to see the playlist ? like in the “normal” media player ? If it is possible, how to do it by code???

    thnks!!!!

    Like

    1. You could get the contents of the playlist using the below and display any way you wish:

      Dim i As Integer = 0

      For i = 0 To wmpControl.currentPlaylist.count - 1

      Dim pListItem As WMPLib.IWMPMedia = wmpControl.currentPlaylist.Item(i)
      'do something with the playlist item (add to a list or panel)
      Debug.WriteLine(pListItem.name)

      Next

      Like

  3. diya.m'sia says:

    tq..i’m glad to read this article after many trial i had try..and this code usefull for me. i just change a little because the video not appear..this is the code..

    ‘create playlist

    Dim newPlayList As WMPLib.IWMPPlaylist = AxWindowsMediaPlayer1.playlistCollection.newPlaylist(“soundsToPlay”)
    newPlayList.appendItem(AxWindowsMediaPlayer1.newMedia(“C:\Sample1.mp3”))
    newPlayList.appendItem(AxWindowsMediaPlayer1.newMedia(“C:\Sample2.mp3”))

    ‘play the list
    AxWindowsMediaPlayer1.Visible = True
    AxWindowsMediaPlayer1.currentPlaylist = newPlayList
    AxWindowsMediaPlayer1.stretchToFit = True

    Like

Leave a comment