11/24/2009 3:46:50 AM
Title:
Get metadata from streaming mp3
Hi..
I have a problem getting the metadata of a mp3 file streamed using flash media server.
I've no problem getting the metadata of a flv file.
I know that mp3 uses ID3 metadata instead of the normal metadata that flv uses.
So is there any way i can get the metadata of a mp3 file so that i can get the duration of the mp3?
thanks~~~
11/24/2009 4:00:46 AM
no currently there is no other way to get total duration of mp3 file , unless its loaded completely at client system.I have used ID3 only to get meta info.
11/24/2009 4:15:22 AM
so how did u use id3 to get the metadata?
can u show me some code samples?
11/24/2009 4:45:28 AM
I use the following code to read ID3 informatio from a mp3 file running in flex application, Check this example :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="readID3Info()">
<mx:Script>
<![CDATA[
private var sound:Sound;
private function readID3Info():void{
sound = new Sound(new URLRequest("test.mp3"));
sound.addEventListener(Event.ID3, onID3);
}
private function onID3(event:Event):void {
trace( sound.id3.album );
trace(sound.id3.artist)
trace(sound.id3.comment)
trace(sound.id3.genre)
trace(sound.id3.songName)
trace(sound.id3.track)
trace(sound.id3.year)
}
]]>
</mx:Script>
</mx:Application>