1

So I am trying to add a music player to my web browser so users can play music in it from a specific folder in it's app data folder ("\AppData\Roaming\MantouWeb360\MWP360")

I was looking around a came accross a solution here

The user can select files (multiple ones too) which is then added to a playlist and then played. However I am not so experienced at C# and VS doesn't recognise the wmp.playlistCollection.newPlaylist("myplaylist"); part of the code (and the following code using the wmp. part). This must mean there was code outside the example defining wmp. but I do not know what it is. Any way to get this code to work so that users can play music from their selected files on my web browser or is there possibly a better way which copies the music to the folder I said above and plays them in order (loop at the end of the last file) so that the user does not need to keep selecting files?

WMPLib.IWMPPlaylist playlist = wmp.playlistCollection.newPlaylist("myplaylist");
WMPLib.IWMPMedia media;

if (ofdSong.ShowDialog() == DialogResult.OK)

{
    foreach (string file in ofdSong.FileNames)
    {
        media = wmp.newMedia(file);
        playlist.appendItem(media);
    }

}
wmp.currentPlaylist = playlist;
wmp.Ctlcontrols.play();
Community
  • 1
  • 1
Kai
  • 41
  • 5
  • have to thought about other options or is this the only Library that you are restricted to using.. take a look here if you're not restricted http://www.aspsnippets.com/Articles/Play-Audio-MP3-Files-in-ASPNet-using-Flash-Music-Player.aspx || tKWake a look at this site and convert the VB code to C# http://www.windows-tech.info/7/a69cf75a6fbb067c.php – MethodMan Dec 19 '14 at 17:53
  • did you download the Windows Media Kit SDK? http://msdn.microsoft.com/en-us/library/windows/desktop/dd758070(v=vs.85).aspx – Sorceri Dec 19 '14 at 17:57
  • No I have not, I'll download it. I am restricted to Windows Form, I cannot use ASP.NET @DJKRAZE – Kai Dec 19 '14 at 18:16

0 Answers0