Page 1 of 1

continuous streaming

Posted: Tue Aug 24, 2010 8:12 pm
by shawngoldw
I have an interesting situation, well at least I think it is :wink: .

There is a computer running an application called nicecast, which allows a computer to stream audio to anyone who wants to listen. To listen to the stream you need to download a m3u file which has one item, the ip of the user's computer with a specific port. If you open up the m3u in say, itunes on another computer, you can hear the continuos stream from the original computer.

The problem with this is that the household computer does not have enough bandwidth to stream the audio to multiple people simultaneously. This person trying to stream already has a web server for their website, which I have built for them.

Using php, I want to contact the broadcaster's computer from the web server so that only one connection is being made to the user's broadcasting computer. Then I want to have the web server rebroadcast it.

I am not sure how to go about creating a persistent connection to the broadcasting computer, and how to continuously stream from the server.

I was thinking for the connection to the broadcasting computer I can just start a script to read from that port and it will go on until the broadcast stops. I don't know how to about the second part though, how to continuously broadcast the stream from the server.


A bit of a long post, but any advice would be appreciated.

Thanks,
Shawn

Re: continuous streaming

Posted: Tue Aug 24, 2010 8:21 pm
by Mark^Bastard
You would need to use PHP CLI to do this, which will no doubt require shell access on your web server.

You are affectively writing an app that you launch. This app would use sockets to connect to the remote server and to serve to the clients.

I've never done this before but I imagine you'd read chunks of data from the source and then send them out to the clients, possibly with an infinite loop constantly running.