[icecast] Icecast in Macromedia Flash
macsym69 at yahoo.fr
Fri Nov 28 20:59:49 PST 2003
This topic was already published in the icecast development list but it did
not interest many people there because it is related to Macromedia Flash and
apparently all the development team is running Linux PPC (the flash plugin
is not available for Linux PPC). For this reason, I was advised to transfer
this topic to this regular icecast list.
Sorry for those who subscribed to both icecast and icecast-dev lists; you
will receive two times this message.
So here is the thing: I am trying to build an mp3 player in Macromedia Flash
that would work with Icecast. Using Flash as a mp3 player instead of Winamp,
XMMS,. could democratize Icecast because the Flash plugin is
cross-platform/cross-browser, it is installed on almost every computer
connected to the internet (Windows, MAC, Linux - but NOT linux PPC) and it
will be embedded into a webpage.
I successfully imported an Icecast live stream into Flash with this simple
TestIcecast = new Sound();
For those who don't know flash, here is the process of creating a flash
animation: you edit the code into a .fla file, then export this code into a
.swf file (the flash animation) and then embed this flash animation into a
HERE IS THE PROBLEM: the code above works perfectly in a standalone swf file
but not when the swf is embedded into a webpage.
I analyzed the logs of my icecast server to understand what is happening:
When I run the swf in standalone mode (not embedded), the ACCESS log is:
192.168.0.3 - - [27/Nov/2003:04:37:46 Romance Standard Time] "GET /mystream
HTTP/1.1" 200 246535 "(null)" "http://192.168.0.4:37/mystream" 13712368.
When I run the webpage in which the swf is embedded in, I can see the swf
contacts the server but no stream is played. The ACCESS log is:
192.168.0.3 - - [27/Nov/2003:04:42:58 Romance Standard Time] "GET /mystream
HTTP/1.1" 200 328981 "(null)" "-" 13712464
I both case, the ERROR log is:
[.]Source found for client
It means the swf, even when embedded, can access the stream (but it doesn't
play anything). Anyway, I noticed the only difference between the two ACCESS
logs is the "http://192.168.0.4:37/mystream" (in first log) instead of "-"
(in second log) that appears behind "(null)". Please not that I made other
tests with Winamp and the habitual information that appears behind "(null)"
I thought the problem might come from the headers that Icecast need to
receive from regular players (Winamp,.) before sending the stream because I
think my Flash animation doesn't send any header information when embedded
into a webpage (headers information is send by the browser instead). For
this reason I tried to use a php script that sends hardcoded header
information (Content-type: audio/mpeg; GET <path of the stream> HTTP/1.1;
protocol: \"http\") to the server. Then I call the URL of this script into
my flash code instead of the URL of the stream. The php script is:
$streamname = "192.168.0.4"; // put in whatever stream you want to play
$port = "37"; // put in the port of the stream
$path = "/mystream"; // put in any extra path, this is usually just a /
$sock = fsockopen($streamname,$port);
fputs($sock, "GET $path HTTP/1.1\n");
fputs($sock, "protocol: \"http\"\n");
fputs($sock, "Connection: close\n\n");
I still have the same problem even with the script: I can listen to the
stream when I run the swf in standalone mode but NOT when it is embedded
into a webpage. I also analyzed the access logs of Icecast when I call the
php script into my flash animation instead of the direct source URL (this
test was realized with the swf embedded):
192.168.0.5 - - [27/Nov/2003:04:54:03 Romance Standard Time] "GET /mystream
HTTP/1.1" 200 94383 "(null)" "-" 4549088
You can notice that it creates the exact same log if I use the php or the
direct stream source when I test my swf embedded.
Is there any header information missing in my php script? What header
information do I have to add in order to send the
"http://192.168.0.4:37/mystream" information (instead of "-") that appears
after "(null)" into the ACCESS log (mentioned above)? Do you think the
problem might come from the macromedia Flash player's security policy? Note
that the same problem happens with Shoutcast.
Thank you very much for any help!
<p>--- >8 ----
List archives: http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Icecast