emamuc Posted July 18, 2011 Share Posted July 18, 2011 Hi Everyone, I'm developing a session secured area for video playback. The videofiles shall be served by php to control the sessions. This is my markup: {foreach from=$res item=r} <div class="title">{$r.name|stripslashes}</div> <video id="player" class="projekktor" title="{$r.name|stripslashes}" width="480" height="270" controls> <source src="get_video?id={$r.id}&type=mp4" type="video/mp4" /> </video> <div class="description">{$r.desc|stripslashes}</div> {/foreach} The source <source src="get_video?id={$r.id}&type=mp4" type="video/mp4" /> is played well, when loaded directly in a browser, but the movie isn't loaded when I specify the script as source to the video-tag. This is the relevant part in my get_video.php: $con = mysql_connect($dbhost,$dbuser,$dbpass); @mysql_select_db($db) or die( "Unable to select database"); $vid = mysql_real_escape_string($_GET['id']); $type = mysql_real_escape_string($_GET['type']); $result = mysql_query('SELECT path, filename FROM `videos` where `id`="'.$vid.'"'); if ($result) { while ($res = mysql_fetch_array($result)){ $path = $res['path']; $file = $res['filename']; } $extensions = array('mp4','ogv','webm'); if(in_array($type,$extensions)){ $file = $path.$file.".".$type; if (is_file($file)) { if (isset($_SERVER['HTTP_RANGE'])) { header("Content-type: video/".$type); rangeDownload($file); } else { $file_size = (string)(filesize($file)); header('Content-Type: video/'.$type); header('Content-Length: '.$file_size); readfile($file); exit(); } I tried several HTML5 Players and the generic video tag. None of it want to work. Does anyone have a suggestion? Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/242236-secure-html5-playback-area/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.