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)
- 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.
- 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.
- 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.