venerdì 19 ottobre 2012

Windows Phone - Get Album Art

When you use MediaPlayer class in Windows Phone, usually you want to get the album cover for the current song.
You can access the current track with the ActiveSong property. This property is exposed by the Queue of MediaPlayer. Then you can check out the album art.

This code is all you need:

if (MediaPlayer.Queue.ActiveSong.Album.HasArt)
{
 BitmapImage bmp = new BitmapImage();
 bmp.SetSource(MediaPlayer.Queue.ActiveSong.Album.GetAlbumArt());
 imgAlbum.Source = bmp;
}

Nessun commento:

Posta un commento