Page 1 of 1

Streaming audio as Radio station

Posted: Thu Oct 07, 2010 1:31 am
by bennythemink
Hi folks,

Just was wondering if anyone has had any experience in this? I've set up a xmoovstream server http://stream.xmoov.com/ in a LAMP architecture to stream audio. All is working well, i can connect to the server, press play and stream the audio file. But I'd like it to be radio broadcast like, as in the admin presses play and anyone who then navigates to the stream URL 30 seconds later picks up the transmission from 30 seconds into the track.

Any suggestions in how to do this? I'm guessing maybe creating a custom php server that connects to the stream and lets people connect and listen to the track through sockets? am I completely off in this suggestion?

Thanks for any advice,
Benny

Re: Streaming audio as Radio station

Posted: Thu Oct 07, 2010 7:15 am
by josh
Keep a master clock in the database. Have a script running in an infinite loop, sleeping for 250ms at a time, updating the master clock. Ajax clients can ping the server to sync their local clock. This could be done infrequently just keep the clock running client side as well.

Use the clock value in the request to your video/audio file

Re: Streaming audio as Radio station

Posted: Thu Oct 07, 2010 8:57 am
by mkz
There are protocols for "live" streaming, such as ShoutCast, if that's any help.

Re: Streaming audio as Radio station

Posted: Mon Oct 25, 2010 10:52 pm
by blither
I would just have a script create a play list for your "live" broadcast that would calculate all of the play time for each track and total it up, then you record the start time of the broadcast. Since you know the length and the start time you can calculate where they should be in which track when they connect to the server. This solution allows for you to not need a script constantly running in the background, and even better it is only a small modification to the actual player section of your code since it could be given a file to load, it probably will be a little more involved for the calculator part though.

Also, I would probably have all of the tracks in the playlist load or at least a link to where they need to be streamed from, this way you don't need to query the server again for track listings. You could even get fancy with it and have it call your server for any updates to the track listings.

edit: provided more details