Files
fnx_web/res/include/script/file_viewer/viewer_scripts/VideoViewer.js
2020-02-04 19:37:46 +01:00

25 lines
746 B
JavaScript

function VideoViewer(viewer, file, next) {
this.viewer = viewer
this.file = file
this.next = next
this.vidContainer = document.createElement("div")
this.vidContainer.classList = "image-container"
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)
this.videoSource = document.createElement("source")
this.videoSource.src = this.file.get_href
this.vidElement.appendChild(this.videoSource)
this.vidContainer.appendChild(this.vidElement)
}
VideoViewer.prototype.render = function(parent) {
parent.appendChild(this.vidContainer)
}