Created
April 20, 2012 14:02
-
-
Save kathangeorg/2428918 to your computer and use it in GitHub Desktop.
HTML5 Video
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
?><?php | |
$defaultPath = "videos/"; // Verzeichnis im Upload-Ordner mit abschliessendem "/". Bsp.: "ordner1/ordner11/" | |
$defaultImage = "standard.jpg"; //Name des anzuzeigenden Standardbildes | |
#Default settings Vorschaubild | |
$img_width = 300; | |
$img_height = 300; | |
$htmlPath = $cfgClient[$client]['path']['htmlpath']; | |
$frontendPath = $cfgClient[$client]['path']['frontend']; | |
$uplPath = $htmlPath.$cfgClient[$client]['upload']; | |
$uplPathFS = $frontendPath.$cfgClient[$client]['upload']; | |
$submitLink = '<a href="javascript:if (document.tplcfgform.send) {document.tplcfgform.send.value = 0}; document.tplcfgform.submit();"><img src="images/submit.gif" border="0" align="absmiddle" /></a>'; | |
$selectedPath = "CMS_VALUE[1]"; | |
$selectedImage = "CMS_VALUE[2]"; | |
if ($selectedPath == '' || $selectedPath == '0') $selectedPath = $defaultPath; | |
if ($selectedImage == '' || $selectedImage == 'noselectedImage') { | |
if ($selectedPath == $defaultPath) { | |
$selectedImage = $defaultImage; | |
} | |
} | |
$imgPath = $uplPath.$selectedPath; | |
$imgPathFS = $uplPathFS.$selectedPath; | |
if (!function_exists(parseImagePaths)) { | |
function parseImagePaths($fullPath,$arr,$upl) { | |
$smallPath = str_replace($upl, '', $fullPath); | |
if ($handler = @opendir($fullPath)) { | |
while(($file = readdir($handler)) !== FALSE) { | |
if(!preg_match('/^\./s',$file)) { | |
if(is_dir($fullPath.'/'.$file)) { | |
$fileName = $smallPath.'/'.$file.'/'; | |
$arr[] = substr($fileName,1,strlen($fileName)); | |
$newPath = $fullPath.'/'.$file; | |
//chdir($newPath); | |
$arr = parseImagePaths($newPath,$arr,$upl); | |
} | |
} | |
} | |
//chdir('..'); | |
//@closedir($handler); | |
} | |
@closedir($handler); | |
return $arr; | |
} | |
} | |
if (!function_exists(parseImageFiles)) { | |
function parseImageFiles($fullPath,$arr) { | |
$handler = @opendir($fullPath); | |
while ($file = @readdir($handler)) { | |
if(is_file($fullPath.$file)) { | |
$arr[] = $file; | |
} | |
} | |
@closedir($handler); | |
return $arr; | |
} | |
} | |
unset($htmlcode); | |
$arrPaths = array(); | |
$arrPaths = parseImagePaths($uplPathFS,$arrPaths,$uplPathFS); | |
asort($arrPaths); | |
$htmlcode .= " | |
<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"> | |
<tr><td style=\"padding:5px\">Bildverzeichnis wählen: </td></tr> | |
<tr><td style=\"padding:5px\">"; | |
$htmlcode .= "<select name=\"CMS_VAR[1]\">"; | |
$htmlcode .= "<option value=\"0\" selected=\"selected\">Bitte wählen</option>"; | |
foreach ($arrPaths as $arrPath) { | |
$htmlcode .= "<option value=\"".$arrPath."\"".($arrPath==$selectedPath?" selected=\"selected\"":"").">".$arrPath."</option>"; | |
} | |
$htmlcode .= "</select> "; | |
$htmlcode .= $submitLink; | |
$htmlcode .= "</td></tr>"; | |
$htmlcode .= "</table>"; | |
echo $htmlcode; | |
unset($htmlcode); | |
$htmlcode = ' | |
<table border="0" cellpadding="5" cellspacing="0"> | |
<tr> | |
<td width="200"></td> | |
<td width="20" align="center">aktiv</td> | |
<td width="20" align="center">inaktiv</td> | |
</tr> | |
<tr> | |
<td width="200">HTML5 Video</td> | |
<td width="20" align="center"><input type="radio" name="' . "CMS_VAR[111]" . '" value="an"' . ("CMS_VALUE[111]" == "an" ? ' checked="checked"' : '') . '></td> | |
<td width="20" align="center"><input type="radio" name="' . "CMS_VAR[111]" . '" value="aus"' . ("CMS_VALUE[111]" == "aus" || "CMS_VALUE[111]" == "" ? ' checked="checked"' : '') . '></td> | |
</tr> | |
</table> | |
'; | |
echo $htmlcode; | |
unset($htmlcode); | |
?><?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$debug_v = false; | |
$defaultPath = "videos/"; // Verzeichnis im Upload-Ordner mit abschliessendem "/". Bsp.: "ordner1/ordner11/" | |
$defaultImage = "standard.jpg"; //Name des anzuzeigenden Standardbildes | |
$htmlPath = $cfgClient[$client]['path']['htmlpath']; | |
$frontendPath = $cfgClient[$client]['path']['frontend']; | |
$uplPath = $htmlPath.$cfgClient[$client]['upload']; | |
$uplPathFS = $frontendPath.$cfgClient[$client]['upload']; | |
print ($debug_v == true ? $htmlPath . '<br>' : '' ); | |
print ($debug_v == true ? $frontendPath . '<br>' : '' ); | |
print ($debug_v == true ? $uplPath . '<br>' : '' ); | |
print ($debug_v == true ? $uplPathFS . '<br>' : '' ); | |
$submitLink = '<a href="javascript:if (document.tplcfgform.send) {document.tplcfgform.send.value = 0}; document.tplcfgform.submit();"><img src="images/submit.gif" border="0" align="absmiddle" /></a>'; | |
$selectedPath = "CMS_VALUE[1]"; | |
$dir = $uplPathFS . $selectedPath; | |
$selectedImage = "CMS_VALUE[2]"; | |
if ($selectedPath == '' || $selectedPath == '0') $selectedPath = $defaultPath; | |
//print ( $dir ); | |
if ( "CMS_VALUE[111]" == "an" ) { | |
// Open a known directory, and proceed to read its contents | |
$echohtml = ''; | |
if (is_dir($dir)) { | |
//print ( 'is_dir'); | |
$echohtml = ' | |
<a id="inline" href="front_content.php?idart='.$idart.'#data">'. | |
get_image($idart, 9988, 190, 173, $crop=true, $title="") | |
.'</a> | |
<div style="display:none"><div id="data"> | |
<video id="video" width="854" height="480" poster="'.$uplPath.$selectedPath . 'poster.jpg" controls="controls" preload="none"> | |
'; | |
if ($dh = opendir($dir)) { | |
while (($file = readdir($dh)) !== false) { | |
if (is_file($dir . $file)) { | |
$filetype = explode(".", $file); | |
print ($debug_v == true ? '<pre>' : '' ); | |
print_r ($debug_v == true ? $filetype : '' ); | |
print ($debug_v == true ? '</pre>' : '' ); | |
switch ( $filetype[1] ) { | |
case 'mp4': | |
$echohtml_mp4 .= ' | |
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 --> | |
<source src="'.$uplPath.$selectedPath .$file.'" /> | |
'; | |
$ff = ' | |
<!-- Flash fallback for non-HTML5 browsers without JavaScript --> | |
<object width="854" height="480" type="application/x-shockwave-flash" data="js/mediaelements/player.swf"> | |
<param name="movie" value="js/mediaelements/player.swf" /> | |
<param name="flashvars" value="controls=true&file='.$uplPath.$selectedPath.$file.'" /> | |
<!-- Image as a last resort --> | |
<!--<img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" />--> | |
</object> | |
'; | |
break; | |
case 'webm': | |
$echohtml_webm .= ' | |
<!-- WebM/VP8 for Firefox4, Opera, and Chrome --> | |
<source type="video/webm" src="'.$uplPath.$selectedPath .$file.'" /> | |
'; | |
break; | |
case 'ogv': | |
$echohtml_ogv .= ' | |
<!-- Ogg/Vorbis for older Firefox and Opera versions --> | |
<source type="video/ogg" src="'.$uplPath.$selectedPath .$file.'" /> | |
'; | |
break; | |
default: | |
} | |
//echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; | |
} | |
} | |
closedir($dh); | |
} | |
$echohtml .= $echohtml_mp4 . $echohtml_ogv . $echohtml_webm . $ff . ' | |
<!-- Optional: Add subtitles for each language --> | |
<!--<track kind="subtitles" src="subtitles.srt" srclang="en" />--> | |
<!-- Optional: Add chapters --> | |
<!--<track kind="chapters" src="chapters.srt" srclang="en" />--> | |
</video> | |
</div> | |
</div> | |
'; | |
} | |
$echohtml .= ''; | |
echo $echohtml; | |
} | |
if ($selectedImage == '' || $selectedImage == 'noselectedImage') { | |
if ($selectedPath == $defaultPath) { | |
$selectedImage = $defaultImage; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--<script src="js/mediaelements/mediaelement-and-player.min.js"></script> | |
<link rel="stylesheet" href="js/mediaelements/mediaelementplayer.css" /> | |
<script type="text/javascript"> | |
jQuery(document).ready(function () { | |
// jQuery('video,audio').mediaelementplayer(); | |
}); | |
</script>--> | |
<!--<script type="text/javascript" src="js/jquery.mousewheel-3.0.2.pack.js"></script> | |
<script type="text/javascript" src="js/jquery.fancybox-1.3.1.pack.js"></script> | |
<link rel="stylesheet" type="text/css" href="js/jquery.fancybox-1.3.1.css" media="screen" />--> | |
<!--[if IE]> | |
<link rel="stylesheet" type="text/css" href="js/jquery.fancybox-1.3.1_ie.css" media="screen" /> | |
<![endif]--> | |
<script type="text/javascript"> | |
jQuery(document).ready(function () { | |
$("a#inline").fancybox({ | |
'hideOnContentClick': false, | |
'autoScale': false | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment