WebClient: use standard HTML5 video tag
video-js does not work well with CSP Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
1a765c7ff7
commit
50a9ac0163
5 changed files with 8 additions and 81 deletions
1
static/vendor/video-js/video-js.min.css
vendored
1
static/vendor/video-js/video-js.min.css
vendored
File diff suppressed because one or more lines are too long
41
static/vendor/video-js/video.min.js
vendored
41
static/vendor/video-js/video.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -56,12 +56,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
|
|
||||||
{{- define "commonjs"}}
|
{{- define "commonjs"}}
|
||||||
<script type="text/javascript" {{- if .}} nonce="{{.}}"{{- end}}>
|
<script type="text/javascript" {{- if .}} nonce="{{.}}"{{- end}}>
|
||||||
if (window.top != window.self) {
|
|
||||||
window.top.location.replace(window.self.location.href);
|
|
||||||
}
|
|
||||||
//{{- if .}}
|
|
||||||
window.VIDEOJS_NO_DYNAMIC_STYLE = true
|
|
||||||
//{{- end }}
|
|
||||||
window.addEventListener("pageshow", function (event) {
|
window.addEventListener("pageshow", function (event) {
|
||||||
if (event.persisted) {
|
if (event.persisted) {
|
||||||
let loadings = document.querySelectorAll('[data-kt-indicator=on]');
|
let loadings = document.querySelectorAll('[data-kt-indicator=on]');
|
||||||
|
|
|
@ -18,7 +18,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
{{define "title"}}{{.Title}}{{end}}
|
{{define "title"}}{{.Title}}{{end}}
|
||||||
|
|
||||||
{{- define "extra_css"}}
|
{{- define "extra_css"}}
|
||||||
<style>
|
<style {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
||||||
.shortcut {font-family: monospace; color: #666;}
|
.shortcut {font-family: monospace; color: #666;}
|
||||||
.cm-editor {
|
.cm-editor {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
@ -169,7 +169,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
{{- define "extra_css"}}
|
{{- define "extra_css"}}
|
||||||
<link href="{{.StaticURL}}/assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css"/>
|
<link href="{{.StaticURL}}/assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css"/>
|
||||||
<link href="{{.StaticURL}}/vendor/glightbox/glightbox.min.css" rel="stylesheet" type="text/css"/>
|
<link href="{{.StaticURL}}/vendor/glightbox/glightbox.min.css" rel="stylesheet" type="text/css"/>
|
||||||
<link href="{{.StaticURL}}/vendor/video-js/video-js.min.css" rel="stylesheet" type="text/css"/>
|
|
||||||
<style {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
<style {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
||||||
.gslide-description-bg {
|
.gslide-description-bg {
|
||||||
background: var(--bs-app-bg-color) !important;
|
background: var(--bs-app-bg-color) !important;
|
||||||
|
@ -182,7 +181,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
<script src="{{.StaticURL}}/assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
<script src="{{.StaticURL}}/assets/plugins/custom/datatables/datatables.bundle.js"></script>
|
||||||
<script src="{{.StaticURL}}/vendor/glightbox/glightbox.min.js"></script>
|
<script src="{{.StaticURL}}/vendor/glightbox/glightbox.min.js"></script>
|
||||||
<script src="{{.StaticURL}}/vendor/pdfobject/pdfobject.min.js"></script>
|
<script src="{{.StaticURL}}/vendor/pdfobject/pdfobject.min.js"></script>
|
||||||
<script src="{{.StaticURL}}/vendor/video-js/video.min.js"></script>
|
|
||||||
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
||||||
//{{- if not .ShareUploadBaseURL}}
|
//{{- if not .ShareUploadBaseURL}}
|
||||||
const supportedEditExtensions = ["csv", "bat", "dyalog", "apl", "asc", "pgp", "sig", "asn", "asn1", "b", "bf",
|
const supportedEditExtensions = ["csv", "bat", "dyalog", "apl", "asc", "pgp", "sig", "asn", "asn1", "b", "bf",
|
||||||
|
@ -821,7 +819,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const parent = e.target.closest('tr');
|
const parent = e.target.closest('tr');
|
||||||
let rowData = dt.row(parent).data();
|
let rowData = dt.row(parent).data();
|
||||||
openVideoPlayer(rowData["name"], rowData["url"]);
|
openMediaPlayer(rowData["name"], rowData["url"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1457,7 +1455,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
}
|
}
|
||||||
//{{- end}}
|
//{{- end}}
|
||||||
|
|
||||||
var player;
|
|
||||||
var playerKeepAlive;
|
var playerKeepAlive;
|
||||||
|
|
||||||
function uploadFiles(files) {
|
function uploadFiles(files) {
|
||||||
|
@ -1546,32 +1543,11 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
uploadFile();
|
uploadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
function openVideoPlayer(name, url){
|
function openMediaPlayer(name, url){
|
||||||
let extension = name.slice((name.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
|
|
||||||
let videoType = 'video/mp4';
|
|
||||||
if (extension == 'webm') {
|
|
||||||
videoType = 'video/webm';
|
|
||||||
} else if (extension == 'ogg' || extension == 'ogv') {
|
|
||||||
videoType = 'video/ogg';
|
|
||||||
} else if (extension == 'mp3') {
|
|
||||||
videoType = 'audio/mpeg';
|
|
||||||
} else if (extension == 'wav') {
|
|
||||||
videoType = 'audio/wav';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player){
|
|
||||||
player = videojs('video_player', {
|
|
||||||
controls: true,
|
|
||||||
autoplay: false,
|
|
||||||
preload: 'auto'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$("#video_title").text(name);
|
$("#video_title").text(name);
|
||||||
|
$("#video_player").attr("src", url);
|
||||||
|
$("#video_player").get(0).load();
|
||||||
$('#modal_video_player').modal('show');
|
$('#modal_video_player').modal('show');
|
||||||
player.src({
|
|
||||||
type: videoType,
|
|
||||||
src: url
|
|
||||||
});
|
|
||||||
keepAlive();
|
keepAlive();
|
||||||
playerKeepAlive = setInterval(keepAlive, 300000);
|
playerKeepAlive = setInterval(keepAlive, 300000);
|
||||||
}
|
}
|
||||||
|
@ -1602,8 +1578,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#modal_video_player').on('hide.bs.modal', function () {
|
$('#modal_video_player').on('hide.bs.modal', function () {
|
||||||
player.pause();
|
$("#video_player").get(0).pause();
|
||||||
player.reset();
|
|
||||||
if (playerKeepAlive != null) {
|
if (playerKeepAlive != null) {
|
||||||
clearInterval(playerKeepAlive);
|
clearInterval(playerKeepAlive);
|
||||||
playerKeepAlive = null;
|
playerKeepAlive = null;
|
||||||
|
@ -1813,8 +1788,8 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<video id="video_player" class="video-js vjs-big-play-centered vjs-fluid">
|
<video id="video_player" width="100%" height="auto" controls preload="metadata">
|
||||||
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video</p>
|
Your browser does not support HTML5 video.
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue