• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ID3 MetaData Streaming MP3

Guest
Jan 28, 2009 Jan 28, 2009

Copy link to clipboard

Copied

hi,

so here's one for you. I've been trying very diligently to recieve id3 metadata from a streaming mp3. I have it streaming and it works great, but I need to grab the duration in the metadata.

here's the jist of my code, i've googled this for hours and have found little help, but what I did find is here:

id3_ns = new NetStream(connection);
id3_ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
id3_ns.addEventListener(Event.ID3, id3Handler)
id3_ns.client= new CustomClientAudio();
id3_ns.play("id3:" + videoName))

ns = new NetStream(connection);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ns.play("mp3:" + videoName),0);

private function id3Handler(id3:Object):void
{
trace("duration: " + id3.duration);
}

public class CustomClientAudio
{
public function onMetaData(infoObject:Object):void
{
}
public function onPlayStatus(infoObject:Object):void{
}
}
}


The only other thing I can think of trying is see if my mp3 is screwed-up, but I don't think it is because I can see the metadata in the properties of the file.

If anyone can point me in a right direction, I would be forever greatful.


Thanks!
Drew
TOPICS
ActionScript

Views

439

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 28, 2009 Jan 28, 2009

Copy link to clipboard

Copied

LATEST
Sadly, the duration of the MP3 is not a standard entry in the ID3 tags. There is a tag, TLEN, that does exactly the right thing, but you would have had to create the MP3 in a program that adds that tag, and most don't. I've used LAME just to add that tag, and it works, but even then it does mean that you have to wait for the metadata to arrive before you know the duration, and often you need to know it ahead of time.

Some people solve the problem by having a server side function that can tell you the duration of the MP3 stream you're connecting to, but a much better, easier solution is to include the duration value in the xml that you're using to set up the url for the MP3.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines