Stream video php
<p>I am trying to get my php video handler file to serve up videos and am testing it on the file handler page itself without luck.</p>

<p><strong>Weird behaviour:</strong> A window just pops up asking me if I want to download the file, even if I delete the readfile(). If I change video/x-flv to video/flv then a player loads in my window but the file does not play. Also if I take away that header all together my browser crashes.</p>

<p>I figured this script should place the video in the browser at the least and have it be playable in the browser if I am testing the file directly with the browser. The file path is correct after the query... Also the file is outside of my web directory but I don't think that should matter because I can serve images outside the directory successfully using a similar script. Anyone have any ideas?</p>

<pre><code>$sql="SELECT file_name FROM video WHERE vid_id=?";
$stmt=$conn-&gt;prepare($sql);
$result=$stmt-&gt;execute(array($ID));

while($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
$file_name = $row['file_name'].".flv";
}

$path="/home/g/Desktop/processed/".$file_name."";


//check if image is readible and type
if (is_readable($path)) {
header('Content-Length: '.filesize($path)); // provide file size
header("Expires: -1");
header('Content-Type: video/x-flv');

$content=readfile($path);


}
else {
error_log("Can't serve video: $file_name");
}
</code></pre>
