Make webm videos auto-loop by default.

This commit is contained in:
jgen 2014-04-28 00:57:49 -04:00
parent 76fd27f87c
commit a0a39784d4
2 changed files with 23 additions and 8 deletions

View File

@ -147,7 +147,12 @@ class VideoFileHandler extends DataHandlerExtension {
require_once('lib/getid3/getid3/getid3.php'); require_once('lib/getid3/getid3/getid3.php');
$getID3 = new getID3; $getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($file); $ThisFileInfo = $getID3->analyze($file);
if (isset($ThisFileInfo['mime_type']) && ($ThisFileInfo['mime_type'] == "video/webm" || $ThisFileInfo['mime_type'] == "video/quicktime" || $ThisFileInfo['mime_type'] == "application/ogg" || $ThisFileInfo['mime_type'] == 'video/x-flv')) { if (isset($ThisFileInfo['mime_type']) && (
$ThisFileInfo['mime_type'] == "video/webm" ||
$ThisFileInfo['mime_type'] == "video/quicktime" ||
$ThisFileInfo['mime_type'] == "application/ogg" ||
$ThisFileInfo['mime_type'] == 'video/x-flv')
) {
return TRUE; return TRUE;
} }
} }

View File

@ -7,28 +7,38 @@ class VideoFileHandlerTheme extends Themelet {
$ext = strtolower($image->get_ext()); $ext = strtolower($image->get_ext());
if ($ext == "mp4") { if ($ext == "mp4") {
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br><script language='JavaScript' type='text/javascript'> $html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
<script language='JavaScript' type='text/javascript'>
if( navigator.userAgent.match(/Firefox/i) || if( navigator.userAgent.match(/Firefox/i) ||
navigator.userAgent.match(/Opera/i) || navigator.userAgent.match(/Opera/i) ||
(navigator.userAgent.match(/MSIE/i) && parseFloat(navigator.appVersion.split('MSIE')[1]) < 9)){ (navigator.userAgent.match(/MSIE/i) && parseFloat(navigator.appVersion.split('MSIE')[1]) < 9)){
document.write(\"<object data='$data_href/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'></object>\"); document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'></object>\");
} }
else { else {
document.write(\"<video controls='controls' autoplay='autoplay'>\"); document.write(\"<video controls autoplay loop'>\");
document.write(\"<source src='" . make_link("/image/" . $image->id) . "' type='video/mp4' />\"); document.write(\"<source src='" . make_link("/image/" . $image->id) . "' type='video/mp4' />\");
document.write(\"<object data='$data_href/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'></object>\"); document.write(\"<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'></object>\");
} }
</script> </script>
<noscript>Javascript appears to be disabled. Please enable it and try again.</noscript>"; <noscript>Javascript appears to be disabled. Please enable it and try again.</noscript>";
} elseif ($ext == "flv") { } elseif ($ext == "flv") {
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br><object data='$data_href/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'><param value='#000000' name='bgcolor'><param name='allowFullScreen' value='true'><param value='high' name='quality'><param value='opaque' name='wmode'><param value='source=$ilink&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'></object>"; $html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
<object data='{$data_href}/lib/Jaris/bin/JarisFLVPlayer.swf' id='VideoPlayer' type='application/x-shockwave-flash' height='" . strval($image->height + 1). "px' width='" . strval($image->width) . "px'>
<param value='#000000' name='bgcolor'>
<param name='allowFullScreen' value='true'>
<param value='high' name='quality'>
<param value='opaque' name='wmode'>
<param value='source={$ilink}&amp;type=video&amp;streamtype=file&amp;controltype=0' name='flashvars'>
</object>";
} elseif ($ext == "ogv") { } elseif ($ext == "ogv") {
$html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br><video controls='controls' autoplay='autoplay'> $html = "Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
<video controls autoplay loop>
<source src='" . make_link("/image/" . $image->id) . "' type='video/ogg' /> <source src='" . make_link("/image/" . $image->id) . "' type='video/ogg' />
</video>"; </video>";
} elseif ($ext == "webm") { } elseif ($ext == "webm") {
$ie_only = "<!--[if IE]><p>To view webm files with IE, please <a href='http://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->"; $ie_only = "<!--[if IE]><p>To view webm files with IE, please <a href='http://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
$html = $ie_only ."Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br><video controls='controls' autoplay='autoplay'> $html = $ie_only ."Video not playing? <a href='" . $image->parse_link_template(make_link('image/$id/$id%20-%20$tags.$ext')) . "'>Click here</a> to download the file.<br/>
<video controls autoplay loop>
<source src='" . make_link("/image/" . $image->id) . "' type='video/webm' /> <source src='" . make_link("/image/" . $image->id) . "' type='video/webm' />
</video>"; </video>";
} }