forked from aadsm/JavaScript-ID3-Reader
-
Notifications
You must be signed in to change notification settings - Fork 0
jameshartig/JavaScript-ID3-Reader
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
JavaScript ID3 Reader ===================== This 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 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. Then finally it was modified by James Hartig to reduce everything to a single file and supporting local files only. Technical Information --------------------- This library will only work on Chrome 7+, Firefox 3.6+, IE10, unless you send stringData instead of a file. This library is not complete and there is still some features missing and/or going on: * Unsynchronisation support * Support for other types of charsets, at the moment only latin1, UTF-8 and UTF-16 are supported, these are the ones defined in the specification. However, the usage of local charsets has been common for a long time specially in Russia, Japan and China. This support can be achieved using [chardet](http://github.com/aadsm/jschardet) and a proper string reader function. * Support for VBR (this requires loading a lot more of the file and checking lots of frames to compare) How To Use It ------------- In its simplest form: var file = document.getElementById("upload").files[0]; if (file && file.type == "audio/mpeg" || file.type == "audio/mp3") { ID3.loadTags({file: file, success: function(tags) { alert(tags.artist + " - " + tags.title + ", " + tags.album); }); } or by specifying shortcuts instead of cryptic tags: ID3.loadTags({file: file, tags: {artist: 1, album: 1}, success: function(tags) { alert(tags.artist + " - " + tags.title + ", " + tags.album); }); Documentation ------------- `ID3.loadTags(options)` `options` - Parameters. `options.file` - The Blob(File) object of the file you wish to read. `options.tags` - The hashmap of tags and/or shortcuts to read from the ID3 block. `options.success` - The function that will be called on success. `options.error` - The function that will be called on error. `options.stringData` - Instead of sending file you can send a string. Success will be sent an object like: { version: "1.1", title: string, artist: string, album: string, year: string, comment: string, track: string, genre: string, sampleRate: int(hz), bitRate: int(kbps) } ### Currently supported frames on ID3: * APIC/PIC: Attached picture * COMM/COM: Comments * PCNT/CNT: Play counter * T*: Text frames * USLT/ULT: Unsychronized lyric/text transcription ### Shortcuts: * title: TIT2/TT2 * artist: TPE1/TP1 * album: TALB/TAL * year: TYER/TYE * comment: COMM/COM * track: TRCK/TRK * genre: TCON/TCO * picture: APIC/PIC * lyrics: USLT/ULT A comprehensive list of all tags defined in the specification can be found [here](http://www.id3.org/id3v2.3.0#head-e4b3c63f836c3eb26a39be082065c21fba4e0acc) Authors ------- * Jacob Seidelin * António Afonso * Joshua Kifer * James Hartig
About
ID3 tags reader in JavaScript (ID3v1 and ID3v2)
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- JavaScript 100.0%