scottschiller / SoundManager2

A JavaScript Sound API supporting MP3, MPEG4 and HTML5 audio + RTMP, providing reliable cross-browser/platform audio control in as little as 12 KB. BSD licensed.
http://www.schillmania.com/projects/soundmanager2/
Other
4.99k stars 768 forks source link

ID3 / Metadata fails to load #161

Closed C-Higgins closed 7 years ago

C-Higgins commented 7 years ago

Example URL: https://firebasestorage.googleapis.com/v0/b/aux-io.appspot.com/o/05%20Fly%20Away%20(Taku%20%26%20TeddyLoid%20For%20the%20Club%20Edit).mp3?alt=media&token=b87f1a93-bb3e-4e78-825e-0b5e52a0f76e

Everything else seems to work with this URL: I can play the sound, the position and duration are correct, etc, but the ID3 and metadata objects never receive any data. I can download the file from this URL and see the ID3 data in any program, so it does exist.

C-Higgins commented 7 years ago

Upon further reading it seems this is not an issue, more of a feature request. It would be nice to read the metadata if we are loading the file anyway

scottschiller commented 7 years ago

Sorry there's no native ID3 / metadata support via HTML5, that could be made more clear in the SM2 docs. Originally the API used JS -> Flash and the ID3 feature was something that Flash implemented. It didn't always work, but was handy when it did. Historically, sometimes there were problems when people would play MP3s edited with or exported from iTunes including album art etc., it'd throw off Flash's decoding of the ID3 data.

To do this in JS, you would need to get binary access to the file and parse the ID3 data manually, entirely separately from the <audio> playing process.

ID3V1 metadata was not-so-handily placed at the end of the file. ID3V2 is in the headers, which is much more practical if you're doing a traditional file request approach. Regardless, browsers are able to support partial / byte range requests these days and a good library should be able to quickly find the ID3 bits within a file, if it is present.

If you're curious, I'd consider looking at a library like https://github.com/aadsm/jsmediatags or https://github.com/43081j/id3.

C-Higgins commented 7 years ago

That's too bad, thanks mate