Windows Media Player playlist  
Author Message
Sam Dela Cruz





PostPosted: Visual C# General, Windows Media Player playlist Top

I want to build a minimal version of Media Player in C#. I'm experimenting on using Windows Media Player control and it works great in opening and playing music and video files. My next step is to be able to create a playlist. How do I go about in doing this in C# I was able to create a playlist file using the following code, but I don't know how to add songs in the playlist. How do I do that

string playListName = "MySamplePl";

windowsMediaPlayer.playlistCollection.newPlaylist(playListName);



Visual C#20  
 
 
Sam Dela Cruz





PostPosted: Visual C# General, Windows Media Player playlist Top

I tried to just discover this myself, here's my sample code that works!

string myPlaylist = "Sample";

WMPLib.IWMPPlaylist pl;

WMPLib.IWMPPlaylistArray plItems;

plItems = windowsMediaPlayer.playlistCollection.getByName(myPlaylist);

if (plItems.count == 0)

     pl = windowsMediaPlayer.playlistCollection.newPlaylist(myPlaylist);

else

     pl = plItems.Item(0);

string musicFile01 = ;

string musicFile02 = ;

if (System.IO.File.Exists(musicFile01))

{

     WMPLib.IWMPMedia m1 = windowsMediaPlayer.newMedia(musicFile01);

     pl.appendItem(m1);

}

if (System.IO.File.Exists(musicFile02))

{

     WMPLib.IWMPMedia m2 = windowsMediaPlayer.newMedia(musicFile02);

     pl.appendItem(m2);

}

 


 
 
wizkid1





PostPosted: Visual C# General, Windows Media Player playlist Top

How do you play one MP3 at a time

Is there a way to do this with quartz.dll (QuartzTypeLib) and a list view control

I can add songs to the list view, but I can't play any.

Thanks,