Quantify streamed video

201 views Asked by At

I'm developing a PHP application which will charge users for the videos they watch. The business model is "everyone pays for how much she watches". For this purpose, I need to;

  1. Implement secure video (FLV) access. (Authorized sessions will gain access)
  2. Calculate how much video (FLV) data is sent from the server.

    A trivial solution for this is to read FLV with PHP ("fread") and send it to client chunk by chunk (just "echo"). However I have real performance concerns about this method, because the application server has 1.7GB Rams and just a single core.

    In short run we're expecting to get large number of impressions, however we would like to upgrade hardware as late as possible. That's why, I want to implement the requirement with the minimum overhead, in the most effective way.

    I'm not tied to a webserver. I prefer Apache 2.2, however lighttpd can also be deployed if it offers a feature for the implementation.

Any idea is appreciated.

Thanks!

3

There are 3 answers

0
Lashae On BEST ANSWER

So to sum up and for future reference I decided to go with the php fread method, since no satisfactory alternative is suggested.

Thanks to all contributers.

1
Pasta On

The PHP fread solution looks like the way to go, but with the server restriction, I think you will need to tweak the flash player. The flash player could send the server messages based on how much of the video has been played. This might be something to think about. Take a look at the JW FLV Media player, the customisation and Javascript integration will allow you to send xmlhttprequests to the server.

1
TheHippo On

Why not using some videostreaming servers like Red5, I'm sure they have triggers that could perform writing some statistics to a db or something similar.
Another advantage would be that user could skip forward in the video.