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

8 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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s