Disable autoplay on embedded viewers

This commit is contained in:
2021-03-11 18:52:55 +01:00
parent bfbea8f591
commit 2d56c9c228
4 changed files with 14 additions and 9 deletions

View File

@@ -50,6 +50,7 @@ maintenance_mode = false
// Init initializes the Pixeldrain Web UI controllers // Init initializes the Pixeldrain Web UI controllers
func Init(r *httprouter.Router, prefix string, setLogLevel bool) { func Init(r *httprouter.Router, prefix string, setLogLevel bool) {
log.Colours = true
log.Info("Starting web UI server (PID %v)", os.Getpid()) log.Info("Starting web UI server (PID %v)", os.Getpid())
// Seed the RNG // Seed the RNG

View File

@@ -17,10 +17,12 @@ function AudioViewer(viewer, file, next) {
this.container.appendChild(document.createElement("br")) this.container.appendChild(document.createElement("br"))
this.element = document.createElement("audio") this.element = document.createElement("audio")
this.element.autoplay = "autoplay"
this.element.controls = "controls" this.element.controls = "controls"
this.element.style.width = "90%" this.element.style.width = "90%"
this.element.addEventListener("ended", () => { this.next() }, false) this.element.addEventListener("ended", () => { this.next() }, false)
if (!embeddedViewer) {
this.element.autoplay = "autoplay"
}
this.source = document.createElement("source") this.source = document.createElement("source")
this.source.src = this.file.get_href this.source.src = this.file.get_href

View File

@@ -7,10 +7,12 @@ function VideoViewer(viewer, file, next) {
this.vidContainer.classList = "image-container" this.vidContainer.classList = "image-container"
this.vidElement = document.createElement("video") this.vidElement = document.createElement("video")
this.vidElement.autoplay = "autoplay"
this.vidElement.controls = "controls" this.vidElement.controls = "controls"
this.vidElement.classList = "center drop_shadow" this.vidElement.classList = "center drop_shadow"
this.vidElement.addEventListener("ended", () => { this.next() }, false) this.vidElement.addEventListener("ended", () => { this.next() }, false)
if (!embeddedViewer) {
this.vidElement.autoplay = "autoplay"
}
this.videoSource = document.createElement("source") this.videoSource = document.createElement("source")
this.videoSource.src = this.file.get_href this.videoSource.src = this.file.get_href

View File

@@ -152,7 +152,7 @@ func (wc *WebController) loginForm(td *TemplateData, r *http.Request) (f Form) {
f.FieldVal("username"), f.FieldVal("username"),
f.FieldVal("password"), f.FieldVal("password"),
); err != nil { ); err != nil {
log.Error("Error while logging in: %s", err) log.Debug("Login failed: %s", err)
formAPIError(err, &f) formAPIError(err, &f)
} else { } else {
// Request was a success // Request was a success