How to create a valid image url from ArrayBuffer
- Lingua principale
- TypeScript
- Stelle
- 344
- Fork
- 66
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Thanks for you wonderful library, I've already tested [this](https://github.com/aadsm/JavaScript-ID3-Reader) and [this](https://github.com/leetreveil/musicmetadata) before, but yours is way faster.
I've got a question about how to use the returned image data. I'm currently doing it that way:
``` Javascript
var arrayBufferView = new Uint8Array(tags.v2.image.data);
tags.v2.image.mime = tags.v2.image.mime || 'image/jpeg';
var blob = new Blob([arrayBufferView], {type: tags.v2.image.mime});
var urlCreator = window.URL || window.webkitURL;
var imageUrl = urlCreator.createObjectURL(blob);
```
This works sometimes, however most of the time it fails. Sometimes it just doesn't create a valid file URL, most of the time it creates only parts of the picture and rarely it works perfectly:

All of these mp3 covers are shown correctly in my windows explorer.
The ones that have a nice placeholder image don't have a tags.v2.image attribute. (which is alright, better have nothing then something wrong...)
The last one somehow created an invalid URL, the others show only a part of the image.
Interestingly the Beatles one doesn't show up in my explorer, but your library parses it correctly.
Am I doing this wrong?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.