I have a php script that grabs a file and sends it on it’s way (I use the script to prevent longterm hotlinking). It works great for downloading and streaming videos to flash applications. Problem is that I can’t get the videos to play through to iphone (or other apple devices) when used. Here are the headers I’m using:
header("Pragma: public");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT");
header("Cache-Control: must-revalidate, post-check=3600, pre-check=18600");
header("Cache-Control: public", false);
header("Content-Description: File Transfer");
header("Content-Type: video/mp4");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=\\"trailerdl.". $extension ."\\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file_real));
// Send file for download
if ($stream = fopen($file_real, 'rb')){
while(!feof($stream) && connection_status() == 0){
//reset time limit for big files
set_time_limit(0);
print(fread($stream,1024*8));
flush();
}
fclose($stream);
}
I’ve tried disabling the content-disposition, but that didn’t help. Is there a way to get iPhone to work with a PHP script that sends the mobile-ready mp4 file on its way?
All feedback appreciated.
Cheers!
Ryan