Friday, 9 August 2013

C# Get current song source url from Windows Media Player

C# Get current song source url from Windows Media Player

i am trying to create a small application that notifies the user of the
path of the current song being played on Windows Media Player.
So i have searched around and came across a good code:
WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
// Get an interface to the first media item in the library.
WMPLib.IWMPMedia3 firstMedia =
(WMPLib.IWMPMedia3)player.mediaCollection.getAll().get_Item(0);
// Make the retrieved media item the current media item.
player.currentMedia = firstMedia;
// Display the name of the current media item.
currentMediaLabel.Text = ("Found first media item. Name = " +
player.currentMedia.name);
But the problem is that this code actually fetches the first song on the
list instead of getting the current song, i have tried changing the
methods but no good :( and i wish you could help me.

1 comment:

  1. I am also looking for the same. I was using skype4COM before for this purpose but it is not supported anymore :(.

    ReplyDelete