Shuffling that Playlist

Sign in to queue


badlands1[1] Matt Gertz over at the Visual Basic Team talks about his big problem with shuffling music and starts on how to solve it.  Matt's problem (and mine) is when you have your music on shuffle, the transitions could be too jarring.  In this installment, he shows you the basics at writing code against Windows Media Player.

His big three are (quoting Matt here)

  1. The player itself. Being a COM control, it gets wrapped for .NET so that you can write code against it without resorting to Declares, etc., and ends up being an object of type AxWMPLib.AxWindowsMediaPlayer. Properties on the player include which of its controls show and its visibility, whether it auto-plays (via its “Settings” property), actions such as Play and Stop (via the Ctlcontrols property), and so on.
  2. The playlist. This is the object that tells the player what media it should play. You don't “Dim” or “New” a playlist; instead, you ask the player for a new or existing playlist, and it returns an interface of type WMPLib.IWMPPlaylist to the result, on which you can then call methods.
  3. The media. Again, these are not objects that you create yourself. There are methods on the player and the playlist which will return interface values (WMPLib.IWMPMedia) for them. The playlist is made up of media objects.



The Discussion

  • User profile image

    ...or you could just expect WMP to support Shuffle By Album like a lot of other major players do.  That's nice because it auto-groups your shuffling by disc: it randomly picks track 1 from a disc, then plays the whole disc in order before moving onto another disc.  I've been waiting for it to appear in WMP since version 9, especially since a certain fruit-flavored player had it for the last 5 years.

  • User profile image

    Please explain how to prevent media control to play files automatically.

  • User profile image

    @fried as you have a windows media control on your app or windows starting the application to playing them?

Add Your 2 Cents