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


i need thumbnail mp3 files. implemented never catch thumbnails. checked existence of images opening them windows media player , xbox music (on phone) can't retrieve them in app. please help

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 display                         thumbnailimage.setsource(thumbnail);                         currentalbumart.source = thumbnailimage;                           debug.writeline("true");                     });                  }                 else                 {                     debug.writeline("false");                 }             }         }      } 

p.s gives false.

it seems there bug on windows phone 8.1, searched night , method implemented

var filestream = await file.openstreamforreadasync();          var tagfile = file.create(new streamfileabstraction(file.name, filestream, filestream));         // load 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; 

but doesn't work too..

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; 

use , taglib portable. (sorry take time)


Comments