How to get information about <audio> tags?

like title, subtitle, artist, album, beat, etc.

wiki - MP3 tag information

wiki - ID3 (mp3 metadata format)

I am looking for a lot ... but I can not get an answer.

just looking for how to play, stop, reload audio.

Does the browser not support this?

+6
source share
2 answers

Another library available at https://github.com/aadsm/JavaScript-ID3-Reader

In its simplest form:

ID3.loadTags("filename.mp3", function() { var tags = ID3.getAllTags(filename); alert(tags.artist + " - " + tags.title + ", " + tags.album); }); 

specifying specific tags:

 ID3.loadTags("filename.mp3", function() { var tags = ID3.getAllTags(filename); alert(tags.COMM.data + " - " + tags.TCON.data + ", " + tags.WXXX.data); }, {tags: ["COMM", "TCON", "WXXX"]}); 

or even specifying labels instead of cryptic tags:

 ID3.loadTags("filename.mp3", function() { var tags = ID3.getAllTags(filename); alert(tags.comment + " - " + tags.track + ", " + tags.lyrics); }, {tags: ["comment", "track", "lyrics"]}); 

Demo here http://web.ist.utl.pt/antonio.afonso/www.aadsm.net/libraries/id3/#demo

+5
source

Sounds like you can with the right libraries! Reading ID3 tags with Javascript and here is a demo

Using the ID3.js library, your Javascript will look like:

 // URL of the mp3 file (must be on the same domain!) var file = "mymusicfile.mp3"; // define your own callback function function mycallback() { // either call the ID3.getAllTags([file]) function which returns an object holding all the tags alert( "All tags in this file: " + ID3.getAllTags(file).toSource() ); // or call ID3.getTag([file], [tag]) to get a specific tag alert( "Title: " + ID3.getTag(file, "title") + " by artist: " + ID3.getTag(file, "artist") ); } ID3.loadTags(file, mycallback); 

Based on the post in the first link I provided, it doesn’t work in Opera browsers and is limited to ID3v1, which according to the poster:

"he is only able to read the (rather missing) ID3v1 tags, as they are very simple compared to the richer and more reliable ID3v2 tags"

+2
source

Source: https://habr.com/ru/post/944263/


All Articles