Add video support

This commit is contained in:
Knah Tsaeb 2019-12-24 15:16:41 +01:00
parent 5b382724cc
commit 616895d4f7

View file

@ -330,7 +330,6 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
if (preg_match("/.jpg$|.gif$|.bmp$|.png$/i", $file)) {
$path_parts = pathinfo($file);
if(file_exists($current_dir.'/'.$path_parts['filename'].'.mp4')){
//continue;
$dataVideo = ' data-video="'.$current_dir.'/'.$path_parts['filename'].'.mp4'.'" ';
if (is_file($current_dir.'/'.$path_parts['filename'].'.info.json')) {
$infoContent = json_decode(file_get_contents($current_dir.'/'.$path_parts['filename'].'.info.json'));
@ -339,6 +338,7 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
} else {
$imgComment = '<h4>'.$file . '</h4>';
}
$videoWithComment = true;
} else {
$dataVideo = null;
}
@ -383,28 +383,6 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
</p>
</div>');
}
if (preg_match("/\.ogv$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file)) {
$linkUrl = str_replace('%2F', '/', rawurlencode("$current_dir/$file"));
$path_parts = pathinfo($file);
if(file_exists($current_dir.'/'.$path_parts['filename'].'.jpg')){
$poster = $current_dir.'/'.$path_parts['filename'].'.jpg';
} else {
$poster = '';
}
$files[] = array(
"name" => $file,
"date" => filemtime($current_dir . "/" . $file),
"size" => filesize($current_dir . "/" . $file),
"html" => '<div>
<p>
<a onclick="onClick(this);return false;" href="'.$linkUrl.'">
<video onplaying="onPlay(this);return false;" controls="true" poster="'.$poster.'" width="'.$thumb_size.'" height="'.$thumb_size.'" data-desc="'.$imgComment.'">
<source src="'.str_replace('#', '%23', ($current_dir . '/' . $file)).'" type="video/mp4">
</video>
</a>' . $filename_caption . '
</p>
</div>');
}
// Other filetypes
$extension = "";
if (preg_match("/\.pdf$/i", $file)) {
@ -439,6 +417,10 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
$extension = "XLXS";
}
// Excel
if (preg_match("/\.ogv$|\.mp4$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file) && empty($videoWithComment)) {
$extension = "VIDEO";
}
// video files
if (preg_match("/\.aiff$|\.aif$|\.wma$|\.aac$|\.flac$|\.mp3$|\.ogg$|\.m4a$/i", $file)) {
$extension = "AUDIO";
}