Record of some of the computer tech I deal with so that it's documented at least somewhere.

Thursday 26 June 2008

FLV streaming with PHP

I found the original at :
http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

It writes flv headers for one flv type only, amongst other snags

I was going to post the code here but Blogger is annoying for code pastes.

http://www.maht0x0r.net/flv.inc

New features :
* Flushes the buffer
* Forces position to int
* Preserves flv headers
* Turned into a function
* Goes 404 if it can't open the flv
* Demonstrates using basename to trim file name to prevent directory traversal
* Skipped some filename checks that were site only (relying on file extensions for authorization seems pointless to me, plus I don't always us file extensions)

I tested it with the JW media player

I had to add "server.max-write-idle = 3600" to lighttpd.conf because it was (obviously) timing out.
I know lighttpd has flv streaming, this php is for a project that runs somewhere else.

No comments: