
How to do PHP streaming.
First of all, this is my first post here. :d
I've been trying to get a fake php file to stream .flv for sometime now. All the rest of the post make it sound so easy, but why am I have such trouble?
I embed the player like so with the embed tag and send the flashvars that I'm suppose to, streamscript=path/to/mystreamer.php, so maybe it's my php script.
$file = 'director/html/blabla/'.$_GET["file"];
$pos = (isset($_GET["pos"])) ? intval($_GET["pos"]): 0;
header("Content-Type: video/x-flv");
header('Content-Length: ' . filesize($file));
if($pos > 0) {
print("FLV");
print(pack('C',1));
print(pack('C',1));
print(pack('N',9));
print(pack('N',9));
}
$fh = fopen($file,"rb");
fseek($fh, $pos);
fpassthru($fh);
fclose($fh);
As you can see I pretty much copied the stream.php file provided by JeroenW's example. I don't see what I'm missing. But one thing I would like to know is how does GET['file'] know which file I'm trying to access? What's the value of that argument? Should I also send the 'file=url' flashvar aswell as the 'streamscript' flashvar?
I really don't know what I'm doing as I'm new to flash video and what not. So I'm pretty stumped as to what to do... What to do? :s