diff --git a/src/components/panels/Settings/WebcamPanel.vue b/src/components/panels/Settings/WebcamPanel.vue index 33a0f036..f64cf61d 100644 --- a/src/components/panels/Settings/WebcamPanel.vue +++ b/src/components/panels/Settings/WebcamPanel.vue @@ -45,10 +45,10 @@ - + - + @@ -65,7 +65,11 @@ }, data: function() { return { - rotationEnabled: false + rotationEnabled: false, + serviceMethodItems: [ + { value: 0, text: 'MJPEG-Streamer' }, + { value: 1, text: 'MJPEG-Streamer (Adaptive)' }, + ] } }, computed: { @@ -74,8 +78,6 @@ return this.$store.state.gui.webcam.url; }, set(url) { - if(this.$store.state.gui.webcam.adaptiveFps) - url = url.replace("action=stream", "action=snapshot"); return this.$store.dispatch('gui/setSettings', { webcam: { url } }); } }, @@ -119,12 +121,12 @@ return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } }); } }, - adaptiveFps: { + serviceMethod: { get() { - return this.$store.state.gui.webcam.adaptiveFps; + return this.$store.state.gui.webcam.serviceMethod; }, - set(useAdaptiveFps) { - return this.$store.dispatch('gui/setSettings', { webcam: { adaptiveFps: useAdaptiveFps } }); + set(selectedMethod) { + return this.$store.dispatch('gui/setSettings', { webcam: { serviceMethod: selectedMethod } }); } }, targetFps: { diff --git a/src/components/panels/WebcamPanel.vue b/src/components/panels/WebcamPanel.vue index 25a8e4f7..85897d57 100644 --- a/src/components/panels/WebcamPanel.vue +++ b/src/components/panels/WebcamPanel.vue @@ -40,7 +40,7 @@ document.addEventListener("focus", () => this.handleRefreshChange(), false); document.addEventListener("visibilitychange", this.handleRefreshChange, false); - if(this.webcamConfig.adaptiveFps) { + if(this.webcamConfig.serviceMethod == 1) { this.requestMjpeg(); } @@ -54,11 +54,11 @@ }), subHeading() { - return "Webcam" + (this.webcamConfig.adaptiveFps ? " - FPS: " + Math.round(1000 / this.time) : ""); + return "Webcam" + (this.webcamConfig.serviceMethod == 1 ? " - FPS: " + Math.round(1000 / this.time) : ""); }, url() { - if(!this.webcamConfig.adaptiveFps) { + if(!this.webcamConfig.serviceMethod) { let basicUrl = this.webcamConfig.url if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?" @@ -67,10 +67,6 @@ return decodeURIComponent(params.toString()) } else { return this.imageData; - /*return 'data:image/jpeg;base64,' + btoa( - new Uint8Array(this.blobData) - .reduce((data, byte) => data.String.fromCharCode(byte), '') - )*/ } }, @@ -121,6 +117,7 @@ requestMjpeg() { if(!this.isVisible) return; + this.request_start_time = performance.now(); let basicUrl = this.webcamConfig.url if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?" @@ -133,9 +130,8 @@ }) }, - visibilityChanged(isVisible, entry) { + visibilityChanged(isVisible) { this.isVisible = isVisible; - console.log(entry); if(isVisible) this.requestMjpeg(); }