从 c# xaml for windows phone 8.1 中的 mp3 文件获取缩略图

Get Thumbnail from mp3 file in c# xaml for windows phone 8.1

我需要从 mp3 文件中获取缩略图。我实现了这个,但它从来没有捕捉到缩略图。我检查了使用 windows 媒体播放器和 xbox 音乐(在 phone 上)打开它们的图像的存在,但我无法在我的应用程序中检索它们。请帮忙

async private void ThumbnailFetcher(StorageFile file)
    {

        if (file != null)
        {
            const ThumbnailMode thumbnailMode = ThumbnailMode.MusicView;
            const uint size = 100;



            using (StorageItemThumbnail thumbnail = await file.GetThumbnailAsync(thumbnailMode, size))
            {

                if (thumbnail != null && thumbnail.Type == ThumbnailType.Image)
                {
                   this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        BitmapImage thumbnailImage = new BitmapImage();//image used for display
                        thumbnailImage.SetSource(thumbnail);
                        CurrentAlbumArt.Source = thumbnailImage;


                        Debug.WriteLine("true");
                    });

                }
                else
                {
                    Debug.WriteLine("False");
                }
            }
        }

    }

P.s 它给出的总是错误的。

windows phone 8.1好像有bug,找了一个晚上,唯一能实现的方法就是这个

var fileStream = await file.OpenStreamForReadAsync();

        var TagFile = File.Create(new StreamFileAbstraction(file.Name, fileStream, fileStream));
        // Load you image data in MemoryStream
        var tags = TagFile.GetTag(TagTypes.Id3v2);


        IPicture pic = TagFile.Tag.Pictures[0];
        MemoryStream ms = new MemoryStream(pic.Data.Data);
        ms.Seek(0, SeekOrigin.Begin);


            bitmap.SetSource(ms.AsRandomAccessStream());
            AlbumArt.Source = bitmap;

但它也不起作用..

var filestream = await receivedFile.OpenStreamForReadAsync();
            var tagFile = File.Create(new StreamFileAbstraction(receivedFile.Name, filestream, filestream));
            var tags = tagFile.GetTag(TagLib.TagTypes.Id3v2);
            var bin = (byte[])(tags.Pictures[0].Data.Data);
            MemoryStream ms = new MemoryStream(bin);
           await bitmapImage.SetSourceAsync(ms.AsRandomAccessStream());
AlbumArt.Source=bitmapImage;

使用这个和 taglib 可移植。 (不好意思耽误了这么多时间)