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

C# 从windows phone 8.1的c xaml格式的mp3文件中获取缩略图,c#,xaml,windows-phone-8.1,windows-phone,runtime,C#,Xaml,Windows Phone 8.1,Windows Phone,Runtime,我需要从mp3文件中获取缩略图。我实现了这个,但它从来没有抓到缩略图。我通过手机上的windows media player和xbox music检查了是否存在打开这些图像的图像,但我无法在我的应用程序中检索它们。请帮忙 async private void ThumbnailFetcher(StorageFile file) { if (file != null) { const ThumbnailMode thumbnailM

我需要从mp3文件中获取缩略图。我实现了这个,但它从来没有抓到缩略图。我通过手机上的windows media player和xbox music检查了是否存在打开这些图像的图像,但我无法在我的应用程序中检索它们。请帮忙

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");
                }
            }
        }

    }
它给出的总是假的

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-portable。很抱歉花了这么多时间

它不起作用,我读到windows phone 8.1上有一个bug。。。我完全卡住了。。看到我的编辑2了吗?你试过那个密码吗?对我来说,它给了每一首歌诺尔本捕获。我能做什么?我又检查了一遍,它不工作了。它做的尝试代码没有抛出异常,但它没有通过如果控制,我试图做的代码无论如何,它把一个说明图像作为封面艺术..它的工作,谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!