header for ipod touch to download a mp4 file
Posted: Sat Oct 13, 2007 7:04 am
Hi all. I am trying to develop a web application like http://vtap.com or Google video which let user to download and playback mp4 file through Safari browser bundled with iPod touch. I can download and playback a mp4 file correctly when I access the file directly by URL (I put the mp4 file in a public area). But when I try to use a simple file proxy program to read the same file at same location and transmit it to iPod touch, it doesn't playback correctly. Everything goes fine in PC (Firefox). I think it would be a problem in header but I don't know what should I put into.
My test program is as below (http://dev.crossmedia.com.hk/ipod/stream.php):
Hope anyone can help me. Thank you.
My test program is as below (http://dev.crossmedia.com.hk/ipod/stream.php):
Code: Select all
<?php
$filename = "./ef_mv_320_h264b.mp4";
$filesize = filesize($filename);
$mime_type = 'video/mp4';
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, private, must-revalidate, max-age=0");
header("Pragma: no-cache");
header('Content-Length: '.$filesize);
header('Content-Type: '.$mime_type);
header('Content-Disposition: attachment; filename="'.basename($filename).'"');
$fp = fopen($filename,"r");
while (!feof($fp)) {
echo fread($fp, 8192);
}
fclose($fp);
?>