-->

Get Album info in Windows Phone 8.1

2019-01-19 09:36发布

问题:

As from Windows Phone 8.1, it's possible to get access to the music files in the MusicLibrary. I can read all files without problems.

But now I want to read Album info.

IReadOnlyList<StorageFolder> albums = 
     await KnownFolders.MusicLibrary.GetFoldersAsync(CommonFolderQuery.GroupByAlbum);

foreach (StorageFolder folder in albums)
{
    // how to get album info?            
}

How can I get album info (name, artist, album art) in that foreach?

回答1:

The following works ... sometimes:

var props = await myStorageFileOrFolder.Properties.GetMusicPropertiesAsync();

For folders it seems to always be empty.



回答2:

var allSongList = 
  (await KnownFolders.MusicLibrary.GetFilesAsync(CommonFileQuery.OrderByName)).ToList();

foreach (var file in allSongList)
{
   var musicProperties = await file.Properties.GetMusicPropertiesAsync();
}