Files
fnx_web/res/include/script/file_viewer/viewer_scripts/VideoViewer.js

25 lines
777 B
JavaScript
Raw Normal View History

2020-01-28 12:51:21 +01:00
function VideoViewer(viewer, file, next) {
this.viewer = viewer;
this.file = file;
this.next = next;
2020-01-20 19:55:51 +01:00
2020-01-28 12:51:21 +01:00
this.vidContainer = document.createElement("div");
this.vidContainer.classList = "image-container";
2020-01-20 19:55:51 +01:00
2020-01-28 12:51:21 +01:00
this.vidElement = document.createElement("video");
this.vidElement.autoplay = "autoplay";
this.vidElement.controls = "controls";
this.vidElement.classList = "center drop-shadow";
this.vidElement.addEventListener("ended", () => { this.next(); }, false);
2020-01-20 19:55:51 +01:00
2020-01-28 12:51:21 +01:00
this.videoSource = document.createElement("source");
this.videoSource.src = apiEndpoint+"/file/"+this.file.id;
2020-01-20 19:55:51 +01:00
2020-01-28 12:51:21 +01:00
this.vidElement.appendChild(this.videoSource);
this.vidContainer.appendChild(this.vidElement);
2020-01-27 16:56:16 +01:00
}
2020-01-20 19:55:51 +01:00
2020-01-28 12:51:21 +01:00
VideoViewer.prototype.render = function(parent) {
parent.appendChild(this.vidContainer);
2020-01-20 19:55:51 +01:00
}