Aug 29
Link:Reading ID3 tags with JavaScript(貌似要翻墙才能打开)
通过JS读取MP3的ID3标签,使用比较简单,把从网站上下载的两个包导入,再用下面的代码就可以了
// 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);
还有个Demo可以看
点击下载 id3.zip [3.17 KB]
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.


Recent Comments