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

29 lines
861 B
JavaScript
Raw Normal View History

2020-01-28 12:51:21 +01:00
function VideoViewer(viewer, file, next) {
2020-02-04 19:37:46 +01:00
this.viewer = viewer
2021-03-11 18:52:55 +01:00
this.file = file
this.next = next
2020-01-20 19:55:51 +01:00
2020-02-04 19:37:46 +01:00
this.vidContainer = document.createElement("div")
this.vidContainer.classList = "image-container"
2020-01-20 19:55:51 +01:00
2020-02-04 19:37:46 +01:00
this.vidElement = document.createElement("video")
this.vidElement.controls = "controls"
this.vidElement.playsInline = "playsInline"
2020-03-10 17:06:52 +01:00
this.vidElement.classList = "center drop_shadow"
2020-02-04 19:37:46 +01:00
this.vidElement.addEventListener("ended", () => { this.next() }, false)
2021-03-11 18:52:55 +01:00
if (!embeddedViewer) {
this.vidElement.autoplay = "autoplay"
}
2020-01-20 19:55:51 +01:00
2020-02-04 19:37:46 +01:00
this.videoSource = document.createElement("source")
this.videoSource.src = this.file.get_href
this.videoSource.type = this.file.mime_type
2020-01-20 19:55:51 +01:00
2020-02-04 19:37:46 +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
2021-03-11 18:52:55 +01:00
VideoViewer.prototype.render = function (parent) {
2020-02-04 19:37:46 +01:00
parent.appendChild(this.vidContainer)
2020-01-20 19:55:51 +01:00
}