Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-15-2003, 01:00 AM   #1
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default get ID3 tags with LIVE mp3 stream

Hi Everybody,

I am building a player for LIVE mp3 streaming in Flash 2004. I have a small problem to publish the ID3 tags sent by my streaming server. I use this simple code:

mystream = new Sound();
mystream.loadSound(“http://my.streaming.server.com/mystream.mp3”, true);
mystream.start();
mystream.onID3 = function(){
metadata = mystream.id3.album;
}

“Metadata” is a dynamic text that shows the ID3 tags.

HERE IS THE PROBLEM:
I am importing LIVE streaming, not “on demand”. It means my animation doesn’t import a series of mp3 songs in a row (it’s not a XML/Flash mp3 player) but a CONTINUOUS live stream in mp3. I am trying to import the ID3 tags of the songs streamed by my streaming server. Unfortunately, my animation only records the ID3 tags of the first song played when I connect to the streaming server… When the server streams another song, my animation, still show the ID3 tags of the first song. Please note that my server only sends the ID3 tags when a new song is played. It means that if my animation connects to the server in the middle of a song, it won’t get the ID3 tags until the server plays a new song. Also, the server sends the ID3 tags at the beginning of the song, because it is streamed (it differs from “loadsounding” a static mp3 file).


How can I change my code to ask Flash to update the ID3 tags in the dynamic text “metadata” every time the streaming server sends a new song?


Thank you very much in advance,

MAX
macsym is offline   Reply With Quote
Old 12-15-2003, 02:47 AM   #2
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

Just add an onSoundComplete function with the new info u want when the old sound ends
farafiro is offline   Reply With Quote
Old 12-15-2003, 10:31 AM   #3
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default

Hi Farafiro,

Thank you for your quick answer. Unfortunately, it doesn't solve my issue. One again, I am talking about a LIVE streaming that works 365/7/24. I am using Flash as a front end client for my streaming server instead of Winamp, Realone, WMP... I guess my first post was confusing.

Because the stream is live and CONTINUOUS, the sound NEVER completes. Here is the process:
An encoder plays a song, encodes it in mp3 and sends it to the server. When the song finishes, it sends a new song to the server. The flash animation connects to the server and plays the stream currently sent by the encoder. Flash always download the same “loadsound” which refers to the stream’s URL. It never switches to another song (because it listens to a LIVE stream). When the encoder finishes playing a song, it sends a new one to the server with the appropriate ID3 tags. So, it’s the ENCODER that plays a new song when a song is completed…

So my problem is: when I connect to the server, if the currently played song is “X”, Flash won’t display any ID3 tags (because the encoder only sends the ID3 tags at the beginning of a song). When X finishes, the encoder plays “Y” and sends the ID3 tags, and Flash successfully displays the ID3 tags of Y. When Y finishes, the encoder plays “Z” and sends the ID3 tags but Flash still displays the ID3 tags of “Y” because it downloads only one time the ID3 tags of a “loadsound”. So I would like Flash to update the ID3 tags every time the encoder sends a new song to the server. In other words, I would like to clear the content of the variable “mystream.id3.album” and updates it with the new content (the new ID3 tags).

Do you have an idea of how I could do it?
macsym is offline   Reply With Quote
Old 12-15-2003, 10:45 AM   #4
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

hmmmmmm
so, u r after the ID3
there are 2 versions - as of my knowlage - of the ID3
v.1 has the ID3 at the end of the song, and v.2 has it at the begining (or vise versa)
so, it's got nothing to do with flash
farafiro is offline   Reply With Quote
Old 12-15-2003, 10:58 AM   #5
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default

Hi Farafiro,

ID3 tags are part of mp3 files. As you say, they are avaible either at the end or at the beginning of the file (when speaking about a static mp3 file). When speaking about LIVE streaming, it's different. The stream is in mp3 format but it's NOT a static mp3 file. Flash downloads the streaming flow, NOT THE mp3 file.
The encoder reads the ID3 tags (at the beginning) when it encodes a file and sends them to the server within the streaming flow. It means Flash doesn't retreive the ID3 tags included in the original mp3 file played by the encoder but it retrieves the tags from the streaming flow. It is the reason why they always appear at the beggining of the song.

How can I ask Flash to update the id3 tags included in the FLOW every time the encoder plays a new song?

Thanks in advance!
MAX
macsym is offline   Reply With Quote
Old 12-15-2003, 11:09 AM   #6
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

I'm not quite sure of what u r saying but u can read mor about how flash deals with ID3s' on the AS reference
and as I've said b4, I'd use the onSoundComplete as it's linked to the sound object not to the song
so, whenever it gets to the end, the onSoundComplete gets called
try it and tell me
farafiro is offline   Reply With Quote
Old 12-15-2003, 11:42 AM   #7
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default

Hi Farafiro,

could you please help me integrating the onSOundcomplete function in my code? I am not sure how to do it...

here is the code:

mystream = new Sound();
mystream.loadSound(“http://my.streaming.server.com/mystream.mp3”, true);
mystream.start();
mystream.onID3 = function(){
metadata = mystream.id3.album;
}

"metadata" is a dynamic text that shows the ID3 tags.

Thank you very much in advance,

MAX
macsym is offline   Reply With Quote
Old 12-16-2003, 02:45 AM   #8
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

is it - the metadata - an instance name or a variable name??
ActionScript Code:
//here I assume that it is an instance name myStream.onSoundComplete = function(){ _root.metadata.text = this.id3.album }
farafiro is offline   Reply With Quote
Old 12-16-2003, 09:43 AM   #9
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default

Hi Farafiro,

"metadata" is a variable name of a dynamic text.

Thanks for your help!
MAX
macsym is offline   Reply With Quote
Old 12-17-2003, 05:04 AM   #10
macsym
Registered User
 
Join Date: Jul 2002
Location: Barcelona Spain
Posts: 46
Send a message via Yahoo to macsym
Default

Hi Farafiro,

Did you get any successful result with the “onSoundcomplete” function?

I would like to illustrate what I am trying to do with an example. Imagine you could load a playlist (.m3u or .pls) in Flash (which is impossible).

Let’s say test.m3u is a playlist that contains 3 mp3 files: test1.mp3, test2.mp3 and test3.mp3. If you could load test.m3u in Flash, test1, test2 and test3 would be played one after the other. The problem is that Flash would display the ID3 tags of test1 and always keep it; because it only loads ONLY ONE sound (test.m3u) even if 3 songs are played in reality. It means that even when test2 and test3 are played, the ID3 tags of test1 will still remain… What I am trying to do is update the new Id3 tags when test2 and test3 are played.

As I said before, it is not possible to load a playlist in Flash but you can compare a live stream (which is possible to load) as a playlist because ONLY ONE file is loaded while SEVERAL songs are really played.

I hope it clarifies the problem :-)

MAX
macsym is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:16 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.