如何获取 mp3 文件中的 AlbumArt 图像?我正在使用 C# 开发 Windows 应用商店应用。
MusicProperties 类为我提供了专辑名称与艺术家名称的对比,但它无法为我提供专辑封面。
最佳答案
查看 MSDN 示例以显示任何文件的缩略图。它还包括如何检索专辑封面。
File and folder thumbnail sample
如果您想保存专辑封面,请查看 How to store save Thumbnail image in device in windows 8 metro apps c#
更新 1
MediaFile
是StorageFile
. ImageControl
是<Image ... />
using (StorageItemThumbnail thumbnail = await MediaFile.GetThumbnailAsync(ThumbnailMode.MusicView, 300))
{
if (thumbnail != null && thumbnail.Type == ThumbnailType.Image)
{
var bitmapImage = new BitmapImage();
bitmapImage.SetSource(thumbnail);
ImageControl.Source = bitmapImage;
}
}
关于c# - 为 Windows 应用商店应用获取 .mp3 文件中的 Albumart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18807320/