Setup avi and wmv convert process.
This commit is contained in:
parent
2666609e72
commit
0d7d799693
@ -49,14 +49,8 @@ const disableEdits = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const showMedia = async (mediaLoc, type) => {
|
const showMedia = async (mediaLoc, type) => {
|
||||||
let path = document.getElementById("path").innerHTML;
|
|
||||||
let tempRef = mediaLoc.toLowerCase();
|
|
||||||
let fullMedia = path + mediaLoc;
|
|
||||||
|
|
||||||
let iframe = document.createElement("IFRAME");
|
let iframe = document.createElement("IFRAME");
|
||||||
|
let video = document.createElement("VIDEO");
|
||||||
let video = document.createElement("VIDEO");
|
|
||||||
|
|
||||||
let outterDiv = document.createElement("DIV");
|
let outterDiv = document.createElement("DIV");
|
||||||
let popOutDiv = document.createElement("DIV");
|
let popOutDiv = document.createElement("DIV");
|
||||||
let closeDiv = document.createElement("DIV");
|
let closeDiv = document.createElement("DIV");
|
||||||
@ -65,6 +59,9 @@ const showMedia = async (mediaLoc, type) => {
|
|||||||
let aTag = document.createElement("A");
|
let aTag = document.createElement("A");
|
||||||
let imgTag = document.createElement("IMG");
|
let imgTag = document.createElement("IMG");
|
||||||
let closeText = document.createTextNode("X");
|
let closeText = document.createTextNode("X");
|
||||||
|
let path = document.getElementById("path").innerHTML;
|
||||||
|
let tempRef = mediaLoc.toLowerCase();
|
||||||
|
let fullMedia = path + mediaLoc;
|
||||||
|
|
||||||
closeDiv.className = "closeBttn";
|
closeDiv.className = "closeBttn";
|
||||||
closeDiv.title = "Close";
|
closeDiv.title = "Close";
|
||||||
@ -90,7 +87,7 @@ const showMedia = async (mediaLoc, type) => {
|
|||||||
imgDiv.appendChild(imgTag);
|
imgDiv.appendChild(imgTag);
|
||||||
|
|
||||||
if ((/\.(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg|mp4|mp3|webm|flac|ogg|pdf)$/i).test(tempRef)) {
|
if ((/\.(mkv|avi|flv|mov|m4v|mpg|wmv|mpeg|mp4|mp3|webm|flac|ogg|pdf)$/i).test(tempRef)) {
|
||||||
if ((/\.(mkv)$/i).test(tempRef)) {
|
if ((/\.(mkv|avi|wmv)$/i).test(tempRef)) {
|
||||||
const params = "remuxVideo=true&mediaPth=" + fullMedia;
|
const params = "remuxVideo=true&mediaPth=" + fullMedia;
|
||||||
let response = await fetch("resources/php/filesystemActions.php",
|
let response = await fetch("resources/php/filesystemActions.php",
|
||||||
{method: "POST", body: new URLSearchParams(params)});
|
{method: "POST", body: new URLSearchParams(params)});
|
||||||
@ -136,6 +133,7 @@ const showMedia = async (mediaLoc, type) => {
|
|||||||
if (type === "video") {
|
if (type === "video") {
|
||||||
// This is questionable in usage since it loads the full video
|
// This is questionable in usage since it loads the full video
|
||||||
// before showing; but, seeking doesn't work otherwise...
|
// before showing; but, seeking doesn't work otherwise...
|
||||||
|
// video.src = fullMedia;
|
||||||
let response = await fetch(fullMedia, {method: "GET"});
|
let response = await fetch(fullMedia, {method: "GET"});
|
||||||
var vidSrc = URL.createObjectURL(await response.blob()); // IE10+
|
var vidSrc = URL.createObjectURL(await response.blob()); // IE10+
|
||||||
video.src = vidSrc;
|
video.src = vidSrc;
|
||||||
|
@ -150,7 +150,6 @@ function remuxVideo($FILE) {
|
|||||||
|
|
||||||
include 'config.php';
|
include 'config.php';
|
||||||
if ($size > $TMPFOLDERSIZE) {
|
if ($size > $TMPFOLDERSIZE) {
|
||||||
|
|
||||||
$files = glob($PTH . '*');
|
$files = glob($PTH . '*');
|
||||||
foreach($files as $file){
|
foreach($files as $file){
|
||||||
if(is_file($file))
|
if(is_file($file))
|
||||||
@ -159,7 +158,17 @@ function remuxVideo($FILE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('(mkv)', $EXTNSN) === 1) {
|
if (preg_match('(mkv)', $EXTNSN) === 1) {
|
||||||
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -codec copy ' . $PTH . $HASHED_NAME;
|
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -codec copy -strict -2 ' . $PTH . $HASHED_NAME;
|
||||||
|
shell_exec($COMMAND . " > /dev/null &");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('(avi)', $EXTNSN) === 1) {
|
||||||
|
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -c:v libx264 -crf 21 -c:a aac -b:a 192k -ac 2 ' . $PTH . $HASHED_NAME;
|
||||||
|
shell_exec($COMMAND . " > /dev/null &");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('(wmv)', $EXTNSN) === 1) {
|
||||||
|
$COMMAND = 'ffmpeg -i "' . $FILE . '" -movflags +faststart -c:v libx264 -crf 23 -c:a aac -strict -2 -q:a 100 ' . $PTH . $HASHED_NAME;
|
||||||
shell_exec($COMMAND . " > /dev/null &");
|
shell_exec($COMMAND . " > /dev/null &");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user