Tom
Tom

Reputation: 13

Getting library from windows media player - C#

I am trying to build an interface to choose and play songs using a touch screen. So far the eaisest way I can find is to use WMP, the problem I have is getting the lists of artists, albums and songs and displaying them in list boxes from the WMP library. Basically I have 3 list boxes. One needs to display artists, one albums and one songs. These need to come from WMP library. How can I achieve this? Thanks heaps for any help.

Upvotes: 0

Views: 450

Answers (1)

cansik
cansik

Reputation: 2004

It is possible to get the Playlist over the COM Interface. You just have to add the com library "WMPLib" and create a new instance of the player:

//create windows media player instance
WindowsMediaPlayer wmp = new WindowsMediaPlayer();

//get all playlists and media
IWMPPlaylistArray paylists = wmp.playlistCollection.getAll();
IWMPPlaylist allMedia = wmp.mediaCollection.getAll();

Now you can iterate over thos lists to get the information you want to.

Upvotes: 2

Related Questions