Dave St John
2004-Aug-06 14:23 UTC
[icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
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@yahoo.fr> To: <icecast@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@xiph.org [mailto:owner-icecast@xiph.org] On Behalf Of > gtgbr@gmx.net > Sent: Saturday, November 29, 2003 11:20 AM > To: icecast@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@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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Macsym
2004-Aug-06 14:23 UTC
[icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
Hi Dave, I remember I read your post, but when I read it, nobody had answered you yet. Thank you very much for the script, it seems to be more complete than mine. I am new to php, to create a script, I usually edit it in notepad and save it as *.php. How can I compile the script '--with-sockets' under windows? Thanks again MAX ________________________________________ From: owner-icecast@xiph.org [mailto:owner-icecast@xiph.org] On Behalf Of Dave St John Sent: Sunday, November 30, 2003 2:12 AM To: icecast@xiph.org Subject: Re: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash 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 ;) Dave St John Mediacast1 Administration ----- Original Message ----- From: "Macsym" <macsym69@yahoo.fr> To: <icecast@xiph.org> Sent: Saturday, November 29, 2003 10:54 AM Subject: RE: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash> 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 forthe> 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? Itis> not the number of the log line because this number was recurrent onseveral> tests. > > MAX > > -----Original Message----- > From: owner-icecast@xiph.org [mailto:owner-icecast@xiph.org] On Behalf Of > gtgbr@gmx.net > Sent: Saturday, November 29, 2003 11:20 AM > To: icecast@xiph.org > Subject: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash> > 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 playerbefore> > 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@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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Dave St John
2004-Aug-06 14:23 UTC
[icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
Under windows all you need to do is edit your php.ini file under C:\WINDOWS\ (xp) or C:\WINNT (2000) Look for the the following lines ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; then find ;extension=php_shmop.dll extension=php_sockets.dll ;extension=php_sybase_ct.dll ;extension=php_tokenizer.dll make sure sockets is uncommented you will also need to set the path you where your extension directory resides, which you can do here ; Directory in which the loadable extensions (modules) reside. extension_dir = C:\apache\php\extensions\ (this is where i had mine set to) Keep in mind also that i have not tested any of that under windows, so it may vary, i tested that under linux. Hope that sheds some light for ya. Dave St John Mediacast1 Administration ----- Original Message ----- From: "Macsym" <macsym69@yahoo.fr> To: <icecast@xiph.org> Sent: Sunday, November 30, 2003 7:36 AM Subject: RE: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash <p>Hi Dave, I remember I read your post, but when I read it, nobody had answered you yet. Thank you very much for the script, it seems to be more complete than mine. I am new to php, to create a script, I usually edit it in notepad and save it as *.php. How can I compile the script '--with-sockets' under windows? Thanks again MAX ________________________________________ From: owner-icecast@xiph.org [mailto:owner-icecast@xiph.org] On Behalf Of Dave St John Sent: Sunday, November 30, 2003 2:12 AM To: icecast@xiph.org Subject: Re: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash 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 <p>$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@yahoo.fr> To: <icecast@xiph.org> Sent: Saturday, November 29, 2003 10:54 AM Subject: RE: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash> 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 forthe> 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? Itis> not the number of the log line because this number was recurrent onseveral> tests. > > MAX > > -----Original Message----- > From: owner-icecast@xiph.org [mailto:owner-icecast@xiph.org] On Behalf Of > gtgbr@gmx.net > Sent: Saturday, November 29, 2003 11:20 AM > To: icecast@xiph.org > Subject: [icecast] Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash> > 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 playerbefore> > 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@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@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@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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Possibly Parallel Threads
- Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
- Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
- Re: [icecast-dev] Hot Topic: Icecast in Macromedia Flash
- Re: [icecast-dev] Hot Topic: Icecast in MacromediaFlash
- Re: [icecast-dev] Hot Topic: Icecast in Macromedia Flash