Streaming Music
Moderator: General Moderators
Streaming Music
Is it possible to stream music with PHP? I'm looking to create an online radio script, nothing too advanced (just plays random music files) but am wondering how I would stream the music. I know I want to use PHP for the back-end for adding and editing the playlist, but streaming is something I've never done before. Can someone shed some light on this?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Streaming Music
I think there as a php based streaming solution around somewhere. Have you searched? I think it may be pseudo-streaming, but it may do what you want.
(#10850)
Re: Streaming Music
I see a lot of stuff for streaming video (Flash etc.) but nothing with audio.arborint wrote:I think there as a php based streaming solution around somewhere. Have you searched? I think it may be pseudo-streaming, but it may do what you want.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Streaming Music
Audio streaming typically uses the same players as video players -- just no video window. Flash is commonly used for both.
(#10850)
Re: Streaming Music
Well somehow I still havn't found anything. Most I found was something with Real Media Player which wouldn't work to my knowledge with live streaming (i.e I believe Real is just for one song at a time).arborint wrote:Audio streaming typically uses the same players as video players -- just no video window. Flash is commonly used for both.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Streaming Music
Streaming is definitely possible with PHP, just fpassthru() the file. If you want to limit the bandwidth you can stream so much data and then sleep for a second, wash, rinse, repeat.
Re: Streaming Music
So how exactly does that work?Kieran Huggins wrote:Streaming is definitely possible with PHP, just fpassthru() the file. If you want to limit the bandwidth you can stream so much data and then sleep for a second, wash, rinse, repeat.
Code: Select all
<?php
header("Cache-Control: ");
header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
$fp = fopen("Airbase.mp3", 'rb');
fpassthru($fp);
exit;
?>http://youthapologetics.net/test/test.php
Any idea?