Package | com.curlyben.media |
Class | public class ID3TagReader |
Inheritance | ID3TagReader ![]() |
var id3reader:ID3TagReader = new ID3TagReader(); id3reader.addEventListener(ID3TagReader.EV_TAGFOUND, tagFoundHandler); ... private function tagFoundHandler(event:ID3Event):void { if(parseFloat(event.ID3Tag.version) >= 2.0) // handle 2.x tag else // handle 1.x tag }
Property | Description |
ID3Tag.album | The album title |
ID3Tag.artist | The song/item artist |
ID3Tag.comment | The stream name |
ID3Tag.genre | The stream genre |
ID3Tag.songName | The song/item name |
ID3Tag.track | The song/item track |
ID3Tag.year | The copyright year |
public function Main():void { var tagger:ID3TagReader = new ID3TagReader(); tagger.addEventListener(ID3TagReader.EV_TAGFOUND, id3EventHandler); tagger.ReadTag(new URLRequest("http://domain.tld/one_minute.mp3")); } ... private function id3EventHandler(event:ID3Event):void { var tlen:uint = parseInt(event.ID3Tag.GetText("TLEN").value); trace(tlen); // "60000" }
public var picloader:Loader; public function Main():void { var tagger:ID3TagReader = new ID3TagReader(); tagger.addEventListener(ID3TagReader.EV_TAGFOUND, id3EventHandler); tagger.ReadTag(new URLRequest("http://domain.tld/one_minute.mp3")); } ... private function id3EventHandler(event:ID3Event):void { var picbytes:ByteArray = event.ID3Tag.GetPicture(/cover/i).picture; this.picloader = new Loader(); this.picloader.loadBytes(picbytes); }
public function Main():void { var tagger:ID3TagReader = new ID3TagReader(); tagger.addEventListener(ID3TagReader.EV_TAGFOUND, id3EventHandler); tagger.ReadTag(new URLRequest("http://domain.tld/one_minute.mp3")); } ... private function id3EventHandler(event:ID3Event):void { var license:String = event.ID3Tag.GetComment(/license/i).value; trace(license); // "Creative Commons BY 3.0 Unported" }
public textField:TextField; public function Main():void { var tagger:ID3TagReader = new ID3TagReader(); tagger.addEventListener(ID3TagReader.EV_TAGFOUND, id3EventHandler); tagger.ReadTag(new URLRequest("http://domain.tld/one_minute.mp3")); ... } ... private function id3EventHandler(event:ID3Event):void { // "WOAF" is the frame ID for the ID3v2.3.0 // specification official audio file webpage. var url:String = event.ID3Tag.GetLink("WOAF").value; textField.htmlText = "<a href=' + url + ' target='_blank'>Related Link</a>"; }
var id3reader:ID3TagReader = new ID3TagReader(); id3reader.addEventListener(ID3TagReader.EV_ICYMETAFOUND, tagFoundHandler); ... private function tagFoundHandler(event:ID3Event):void { trace("The StreamTitle is: " + event.ID3Tag.icy_streamtitle); ... }
Property | Description | Available |
ID3Tag.album | The album title | sometimes |
ID3Tag.artist | The song/item artist | normally |
ID3Tag.comment | The stream name | normally |
ID3Tag.genre | The stream genre | normally |
ID3Tag.songName | The song/item name | normally |
ID3Tag.track | The song/item track | sometimes |
ID3Tag.year | The copyright year | no |
ID3Tag.icy_url | The server webpage | normally |
ID3Tag.icy_streamurl | The live item webpage | normally |
ID3Tag.icy_streamtitle | The live item title | normally |
Method | Defined by | ||
---|---|---|---|
Creates an instance of ID3TagReader.
| ID3TagReader | ||
ClearCache():void
Clears the tag cache.
| ID3TagReader | ||
InspectCache(res_url:String):ID3Info
Returns a copy of a cached ID3Info object.
| ID3TagReader | ||
ReadTag(url:URLRequest, redherring:String = null):void
Reads any ID3 tags in the specified resource.
| ID3TagReader |
Event | Summary | Defined by | ||
---|---|---|---|---|
This event is triggered when an ID3v2 version 3+ extended header is found. | ID3TagReader | |||
This event is triggered when a icecast/shoutcast meta block is found and available. | ID3TagReader | |||
This event is triggered when no ID3 tag information is available for a resource. | ID3TagReader | |||
This event is triggered when a tag is found to be damaged, corrupt or otherwise unusable. | ID3TagReader | |||
This event is triggered when an ID3 tag is found and available. | ID3TagReader |
Constant | Defined by | ||
---|---|---|---|
EV_EXTENDED_NI : String = "extendedNotImplemented" [static]
Defines the value of the type property of an extendedNotImplemented event object.
| ID3TagReader | ||
EV_ICYMETAFOUND : String = "icyMetaFound" [static]
Defines the value of the type property of an icyMetaFound event object.
| ID3TagReader | ||
EV_NOTAGFOUND : String = "noTagFound" [static]
Defines the value of the type property of an noTagFound event object.
| ID3TagReader | ||
EV_TAGERROR : String = "tagError" [static]
Defines the value of the type property of an tagError event object.
| ID3TagReader | ||
EV_TAGFOUND : String = "tagFound" [static]
Defines the value of the type property of an tagFound event object.
| ID3TagReader |
ID3TagReader | () | constructor |
public function ID3TagReader()
Creates an instance of ID3TagReader.
ClearCache | () | method |
public function ClearCache():void
Clears the tag cache.
Because of the non-blocking behaviour of ReadTag, ID3TagReader keeps a Dictionary of pending read requests
internally.
This Dictionary can be cleared programmatically in case developers require the abillity to purge expired
MP3 ID3Tag data.
InspectCache | () | method |
public function InspectCache(res_url:String):ID3Info
Returns a copy of a cached ID3Info object.
Parametersres_url:String — The URL of the cached object to find.
|
ID3Info — A copy of the cached object, null if no such object is cached.
|
ReadTag | () | method |
public function ReadTag(url:URLRequest, redherring:String = null):void
Reads any ID3 tags in the specified resource.
Parametersurl:URLRequest — A URLRequest pointing to the resource containing ID3 tags.
|
|
redherring:String (default = null ) — A URL pointing to a RedHerring proxy to use to handle the read request.A side effect of the static nature of the RedHerring URL within the com.curlyben namespace is that setting a RedHerring URL in any com.curlyben class will also change the RedHerring address those classes will use. |
extendedNotImplemented | event |
com.curlyben.events.ID3Event
This event is triggered when an ID3v2 version 3+ extended header is found. Parsing ID3v2 extended headers is not performed by this version of ID3TagReader.
icyMetaFound | event |
com.curlyben.events.ID3Event
This event is triggered when a icecast/shoutcast meta block is found and available.
For information about working with
tags see: How to extract information from icecast/shoutcast tags
noTagFound | event |
com.curlyben.events.ID3Event
This event is triggered when no ID3 tag information is available for a resource.
tagError | event |
com.curlyben.events.ID3Event
This event is triggered when a tag is found to be damaged, corrupt or otherwise unusable.
tagFound | event |
com.curlyben.events.ID3Event
This event is triggered when an ID3 tag is found and available.
For information about working with
tags see: How to extract information from ID3 tags
EV_EXTENDED_NI | constant |
public static const EV_EXTENDED_NI:String = "extendedNotImplemented"
Defines the value of the type property of an extendedNotImplemented event object.
EV_ICYMETAFOUND | constant |
public static const EV_ICYMETAFOUND:String = "icyMetaFound"
Defines the value of the type property of an icyMetaFound event object.
For information about working with
tags see: How to extract information from icecast/shoutcast tags
EV_NOTAGFOUND | constant |
public static const EV_NOTAGFOUND:String = "noTagFound"
Defines the value of the type property of an noTagFound event object.
EV_TAGERROR | constant |
public static const EV_TAGERROR:String = "tagError"
Defines the value of the type property of an tagError event object.
EV_TAGFOUND | constant |
public static const EV_TAGFOUND:String = "tagFound"
Defines the value of the type property of an tagFound event object.
For information about working with
tags see: How to extract information from ID3 tags