0

I have video running as a live stream and an editor can add captions at any time. Also when microphones are clicked in the broadcast room they move the camera and then update the caption. The flash video pulls a text file every 3 seconds for the new caption. The video takes an average of 7secs delay to get to the web users though and so I need to write some php to hold the update somewhere and then write it 7 seconds later to the text file.

I need to update away from a Java demon that needs to keep a socket open at the moment.

I have thought of trying out a queue or a cron job. Cron does not do second updates and queue seems to mean running a java demon again, and have not found a way or pausing yet. The caption needs to stay in a text file and must not do a db call, but the api can be changed in any simple way to delay the updates.

So Jason object generated through the api (only 1-5k) held for 7seconds and then written to text file.

tristanbailey
  • 4,427
  • 1
  • 26
  • 30
  • I have read the posts like this on checking it every second http://stackoverflow.com/questions/1726116/run-a-php-script-every-second-using-cli But want to think of best way to make it wait 7secs for each update (there could be many streams) – tristanbailey Apr 16 '12 at 10:25

1 Answers1

0

You should look into long polling and real time updates, then do some sort of loop that pushes content when specified.

You can setup a very simple webservice with something like Pubnub or Pusher. And then do some sort of loop in the server side of your choice that pushes contents with the right intervals to make sure data is there.

Please be aware that the design you mention has race conditions all over, so take that in consideration when building it.

Carlos Barbosa
  • 1,422
  • 2
  • 23
  • 42