2

I am trying to make a music player in C# using WMPLib. Here is what I have:

WMPLib.WindowsMediaPlayer song = new WMPLib.WindowsMediaPlayer();
song.URL = file;  //the path to a mp3 file
song.controls.stop();
Console.WriteLine(song.currentMedia.getItemInfo("Title"));
Console.WriteLine(song.currentMedia.getItemInfo("Artist"));
Console.WriteLine(song.currentMedia.getItemInfo("Album"));

Only 'song.currentMedia.getItemInfo("Title")' works (it returns the title). What am I doing wrong with Artist and Album that they return ""(nothing)?

mimit
  • 39
  • 6

1 Answers1

1

I solved it! I have to wait a little for the song to load from the disk. Information like Album and Artist is available only after the song has loaded.

This was helpful: https://social.msdn.microsoft.com/Forums/en-US/7718f71a-1296-4168-9b12-36d063993b0d/getting-an-track-length-with-windows-media-player?forum=Vsexpressvcs

mimit
  • 39
  • 6