Browsing articles tagged with " mp3"
Reading ID3 tags with AS3
In order to access the ID3 Tags of an MP3 remotely you need to pass the SoundLoaderContext class with the checkPolicyFile property set to true to the Sound class load method. If not Event.ID3 will not be fired since it will throw a security sandbox violation. Also you need to remember one important step that is having a cross domain policy file in the root of the server that will be serving the MP3 files.
AS3 Code
var soundLoaderContext:SoundLoaderContext = new SoundLoaderContext();
soundLoaderContext.checkPolicyFile = true;
var mp3:URLRequest = new URLRequest("weezer-pork_and_beans.mp3");
var sound:Sound = new Sound();
sound.addEventListener(Event.ID3, id3Handler);
sound.load(mp3, soundLoaderContext);
sound.play();
// ID3 events
function id3Handler(evt:Event):void {
var id3:ID3Info = evt.target.id3;
trace(id3.artist + ' - ' + id3.songName);
}
cross-domain XML
xml version="1.0">




