Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get <audio> tag information?

like title, subtitle, singer, Album, Bit rate etc..

wiki - MP3 tag infomation

wiki - ID3(mp3 metadata format)

I search a lot.. but I can't get answer.

only searched how to play,stop,reload audio..

browser not support that?

like image 662
NamNamNam Avatar asked May 04 '13 03:05

NamNamNam


1 Answers

One more 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);
});

by 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 by specifying shortcuts 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

like image 139
HaBo Avatar answered Sep 30 '22 18:09

HaBo