| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Note: This fork is still being developed. Do not use it yet, please.
This library attempts to parse ID3 tag data in music files using Javascript.
The following changes have been made in this fork:
Additional plans include:
This fork will eventually try to merge changes by other contributors, as they are made. These include:
The software is modular, and comes with the following modules by default:
Any of these modules may be dropped if desired.
Presently, adopters are recommended to stick with the code available from António Afonso. The following changes are required to move to the new library:
In general, existing users will unlikely gain from such a migration, but new users (especially those developing heavily HTML5 applications) will found these changes beneficial.
`ID3.loadTags(url, [options])`
`url` - The URL of the mp3 file to read, this must reside on the same domain (document.domain).
`options` - Optional parameters.
`options.tags` - The array of tags and/or shortcuts to read from the ID3 block. Default value is: `["title", "artist", "album", "track"]`
`options.dataReader` - The function used to create the data reader out of a url. It receives (`url`, `success`: callback function that returns the data reader, `fail`: callback function to inform an error setting up the reader).
In order to use this version of the Javascript ID3 Reader, you must first ensure that a dataReader module is available. By default by upload and ajax dataReaders are present.
At present, the ajax dataReader requires that you simply specify the URL you wish to download. It will then download as much of the URL as is neccessary to read the ID3 tags. E.g.:
`ID3.loadTags('http://www.example.com/music.mp3', { tags : ["title", "artist", "album"] })`
The upload dataReader, on the other hand, requires that you pass a file object as such:
`ID3.loadTags('the-url-is-really-just-a-placeholder-for-uploads', { dataReader : FileAPIReader(f), tags : ["title", "artist", "album"] })`
Whenever tags have been read, a custom event, "ID3TagsRead", will be issued, with its data being the tags obtained. Additionally, the getAllTags function can also be used on any unique URL provided if the tags for that URL have been read:
`ID3.getAllTags(url)`
`url` - The URL of the mp3 file to read, this must be the same value given to `ID3.loadTags()`.
`return value` - The tags obtained.
Tag formats vary. The ID3v1 tags are:
{
version: "1.1",
title: string,
artist: string,
album: string,
year: string,
comment: string,
track: string,
genre: string
}
For ID3v2:
{
version: "2.<major>.<revision>",
major: integer,
revision: integer,
flags: {
unsynchronisation: boolean,
extended_header: boolean,
experimental_indicator: boolean
},
size: integer,
<frame id>*: {
id: integer,
size: integer,
description: string,
data: <frame structure>
},
<shortcut>*: pointer to <frame id>.data
}
For AAC:
{
album: string,
artist: string,
year: integer,
title: string,
genre: string,
track: integer,
composer': string,
encoder: string,
copyright: string,
picture: {
format: string,
data: bytes[]
},
grouping: string,
keyword: string,
lyrics: string,
genre: string
}
A comprehensive list of all tags defined in the specification can be found here
| Back | FazBrowse Home | New Git URL |