Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p>Make sure to camouflage a mp4 as a path instead of a php request url for example <code>&lt;video src=/junk/junk.mp4&gt; instead of &lt;video src=video.php?name=junk&gt;</code></p></li> <li><p>do a htaccess route to a php file, when user request a path route that to a php file that is going to read the video file secured in a location. for example ... </p></li> </ol> <blockquote> <p>RewriteRule ^junk/(.*) /preview.php?media=$1 [QSA,L]</p> </blockquote> <ol> <li><p>now in php , make sure to cater to safari (ipad/iphone) request too...</p> <pre><code>&lt;?php class VideoGroup1 { public function preview() { $id = substr($_REQUEST['media'],0,strrpos($_REQUEST['media'],".")); $thisMedia = Pillar_Manage_Media::fetchMedia($id); //echo Foundry_Useful::unsealit($thisMedia['path']).$thisMedia['mediaid']; $file = Foundry_Useful::unsealit($thisMedia['path']).$thisMedia['mediaid'].".mp4"; $filesize = filesize($file); $offset = 0; $length = $filesize; if ( isset($_SERVER['HTTP_RANGE']) ) { $partialContent = true; preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches); $offset = intval($matches[1]); $length = intval($matches[2]) - $offset; } else { $partialContent = false; } $file = fopen($file, 'r'); fseek($file, $offset); $data = fread($file, $length); fclose($file); if ( $partialContent ) { header('HTTP/1.1 206 Partial Content'); header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize); } header('Content-Type: video/mp4'); header('Content-Length: ' . $filesize); header('Content-Disposition: attachment; filename="' . $file . '"'); header('Accept-Ranges: bytes'); print($data); }//End Function preview }//END Class VideoGroup1 </code></pre></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload