在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:aadsm/JavaScript-ID3-Reader开源软件地址:https://github.com/aadsm/JavaScript-ID3-Reader开源编程语言:JavaScript 94.4%开源软件介绍:
Use this guide to migrate to JavaScript ID3 ReaderThis library was originally made by Jacob Seidelin using ID3v1 for demo'ing his BinaryAjax library [http://www.nihilogic.dk/labs/id3/]. It was then extended by me (António Afonso) to include the ID3v2 tag specification [http://www.id3.org/id3v2.4.0-structure], while I was working at Opera Software, in the context of the Unite Media Player application which was developed using server side JavaScript. Joshua Kifer implemented the tag reader for the QuickTime metadata information found in aac files. A new BufferedBinaryFile was created that extends BinaryFile in a way that only required data will be downloaded from the server. This makes it possible to read tag structures such as the Quicktime metadata without having to download the entire file as it was happening in previous versions of this library. Demo: http://www.aadsm.net/libraries/id3/#demo Technical InformationThis library will only download the relevant data from the mp3 file whenever the webserver supports the HTTP Range feature, otherwise the entire file will be downloaded at the cost of degrading the performance of the library. Another caveat is on the Opera browser, since it lacks support for setting the Range header, the entire file will be downloaded. This library is not complete and there is still some features missing and/or going on:
How To Use ItIn its simplest form: ID3.loadTags("filename.mp3", function() {
var tags = ID3.getAllTags("filename.mp3");
alert(tags.artist + " - " + tags.title + ", " + tags.album);
}); by specifying specific tags: ID3.loadTags("filename.mp3", function() {
var tags = ID3.getAllTags("filename.mp3");
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.mp3");
alert(tags.comment + " - " + tags.track + ", " + tags.lyrics);
},
{tags: ["comment", "track", "lyrics"]}); handling errors: ID3.loadTags("http://localhost/filename.mp3", function() {
var tags = ID3.getAllTags("http://localhost/filename.mp3");
alert(tags.comment + " - " + tags.track + ", " + tags.lyrics);
},
{
tags: ["comment", "track", "lyrics"],
onError: function(reason) {
if (reason.error === "xhr") {
console.log("There was a network error: ", reason.xhr);
}
}
}); Cordova / PhoneGapRaymond Camden wrote a pretty nice blog post on this topic: http://www.raymondcamden.com/2015/04/30/working-with-mp3s-id3-and-phonegapcordova-2 File APIReading a music file through the File API can be done by using the ID3.loadTags("filename.mp3", function() {
var tags = ID3.getAllTags("filename.mp3");
alert(tags.comment + " - " + tags.track + ", " + tags.lyrics);
}, {
dataReader: ID3.FileAPIReader(file)
});
ExampleSee Documentation
for ID3v2:
for AAC:
How to show the cover art from the byte array:You can do this by using a var base64String = "";
for (var i = 0; i < image.data.length; i++) {
base64String += String.fromCharCode(image.data[i]);
}
var dataUrl = "data:" + image.format + ";base64," + window.btoa(base64String); Currently supported frames on ID3:
Shortcuts:
A comprehensive list of all tags defined in the specification can be found here Cross-Domain Requests (CORS)When doing CORS requests the browser is not able to read all response HTTP headers unless the response explicitly allows it to. You need to add the following headers to the response:
Otherwise you could get the error Module LoadersThis package is packaged with browserify
Node.jsThis library is also npm compatible, so it can be required. As of this writing it is not published to the npm repository, but that should be remedied soon. You can use ID3 either via browserify or directly on the server:
Authors
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论