views:

426

answers:

2

when theres a flash video, how can i detect the current flv URL ? viewing the source doesn't reveal it. However, I wonder if theres any approach to figuring out the .flv URL (Where it's hosted at the moment it's being streamed).

I see that there are firefox add on's that does this. I wonder how these work, and whether it can be implemented purely in php and javascript.

A: 

FLV videos are basically flat files with a standard header. The first three bytes are F, L, and (get this) V. So, if you can inspect the first three bytes of a binary in JavaScript, then you can check the file header.

(Technically, the web server could give the browser any kind of file extension or MIME type. But the Flash players don't really care--they try to play a file no matter what the extension or header is.)

Stu Thompson