[icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash

Dave St John groups at mediacast1.com
Sun Nov 30 01:12:08 UTC 2003



Here is some code i wrote to send a mp3 file to a shoutcast server, with a little modification im sure you could change it and use it to connect to icecast2 and write various things etc... not sure but here it is
------------------------------------------------------
<?php
$port = '8000';
$ip = '127.0.0.1';
$fileplay = './whatever.mp3';
$password = 'changme' //password to access server
 

$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); // Create the Socket
$connection = socket_connect($socket,''.$ip.'',''.$port.'); //connect to the SHOUTcast server

while($connection = socket_read($socket,2046)) 
{ 
$filesz = filesize(''.$fileplay.'');//enter in a single filename here in same directory or enter in full path
$fp = fopen (''.$fileplay.'', "rb"); 
$fr = fread ($fp, $filesz);
socket_write($connection,"$password\r\n");
socket_write($connection,"Content-Type:audio/mpeg\r\n"); //ogg is application/ogg
socket_write($connection,"Cache-Control:no-cache\r\n");
socket_write($connection,"Pragma:no-cache\r\n");
socket_write($connection,"Connection:close\r\n");
socket_write($connection,"icy-notice1:test1\r\n"); 
socket_write($connection,"icy-notice2:test2\r\n");
socket_write($connection,"icy-name:test server\r\n");
socket_write($connection,"icy-genre:industrial\r\n");
socket_write($connection,"$fr\r\n");
socket_write($connection,"Connection:keep-alive\r\n");
socket_write($connection,"icy-br:128\r\n\r\n"); 

<p><p>} 
?>
--------------------------------------------------------

php must be compile with socket support i.e. '--with-sockets'
otherwise the above will not work.
the icy headers apparently will work as well, search the mailing list as i discussed this a few days or weeks ago, to much code netween now and then
to remember the exact date ;)

<p><p>Dave St John
Mediacast1 Administration
----- Original Message ----- 
From: "Macsym" <macsym69 at yahoo.fr>
To: <icecast at xiph.org>
Sent: Saturday, November 29, 2003 10:54 AM
Subject: RE: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash

<p>> Hi Moritz,
> Thanks for everything.
> About the log line:
> 192.168.0.3 - - [27/Nov/2003:04:42:58 Romance Standard Time] "GET /mystream
>  HTTP/1.1" 200 328981 "(null)" "-" 13712464
> 
> How can I set up my php script to send hardcoded header information for the
> parameter "referrer"? Do you think the value: 
> fputs($sock, "referrer: "-"\n");
> 
> should be OK?
> 
> Also, does anybody know what the last number (13712464) in the log is? It is
> not the number of the log line because this number was recurrent on several
> tests.
> 
> MAX
> 
> -----Original Message-----
> From: owner-icecast at xiph.org [mailto:owner-icecast at xiph.org] On Behalf Of
> gtgbr at gmx.net
> Sent: Saturday, November 29, 2003 11:20 AM
> To: icecast at xiph.org
> Subject: [icecast] Re: [icecast-dev] Hot Topic: Icecast in Macromedia Flash
> 
> Hi,
> 
> 
> I moved this to icecast@, since none of these are icecast development
> related questions and issues.
> 
> Macsym wrote:
> > I didn't know so many people in the Icecast-Dev list were running Linux
> PPC!
> 
> Oh well, I'm neither a developer nor running Linux PPC. ;)
> 
> > Anyway, I understand that you guys don't have the time to help me with
> that
> > because you wouldn't be able to run the flash player anyway! Because of
> > that, I think I will send the topic to the regular Icecast mailing list
> > (where I might find more people running Linux, Mac OS or Windows).
> 
> I have some Windows boxes around where I have Flashplayer installed.
> However, since I'm switching OSes faster than my socks (I am
> multi-booting), and I am not *allowed* to install/use Flash on the other
> most important OS (OpenBSD, even though it would work), I am avoiding
> flashy sites as good as possible. I can't say I find Flash's
> discriminating license or its habit of eating CPU cycles and RAM
> appealing at all.
> 
> Actually, I believe your Flash-based streaming client is only good to
> obfuscate the real address of the streaming server, to keep people from
> easily dumping the stream to disk or just play it in their favorite
> player...
> 
> > There are still some kinds of information I can only get from the dev
> list:
> > 
> > -Does anybody know where I can find a document that explains the changes
> in
> > the core architecture between Icecast1 and Icecast2 (Flash was working
> with
> > Icecast1)?
> 
> Hey, I can answer that! :)
> 
> Everything is different, Icecast 2 is a re-write.
> 
> > -Does Icecast need to receive some kinds of headers from the player before
> > sending the stream? If yes, what are these headers?
> 
> Nothing special that I know of - it's plain HTTP, and clients only need
> to send a simple GET request to start listening to a stream. Others may
> slap me now for spreading false information, however, I'm pretty sure
> I'm close to the mark.
> 
> > -Can somebody translate me this access log line:
> > 192.168.0.3 - - [27/Nov/2003:04:42:58 Romance Standard Time] "GET
> /mystream
> > HTTP/1.1" 200 328981 "(null)" "-" 13712464
> 
> 200 is the return code the server replied. 200 means "OK", iirc. The
> other number is the amount of bytes transferred, (null) is what the
> server got from the client as the referer (it should be "-" for "no
> referer") and "-" is a place holder for the user-agent, which the client
> should've sent. However, I do not know what the final number is supposed
> to mean ... I don't know it from Apache, and my icecast access.log
> usually has that one as a zero, but not always.
> 
> 
> Moritz
> --- >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.
> 
> 
> --- >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.
> 

<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 mailing list