Cleanup and change from switch to select element
Signed-off-by: Rejdukien <Rejdukien@users.noreply.github.com>
This commit is contained in:
parent
b204373dd9
commit
cbd9d6ea75
@ -45,10 +45,10 @@
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="py-2">
|
||||
<v-switch v-model="adaptiveFps" hide-details label="(Experimental) Adaptive FPS" class="mt-0"></v-switch>
|
||||
<v-select v-model="serviceMethod" :items="serviceMethodItems" hide-details label="Service Method" class="mt-0"></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row v-if="adaptiveFps">
|
||||
<v-row v-if="serviceMethod == 1">
|
||||
<v-col class="py-2">
|
||||
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
|
||||
</v-col>
|
||||
@ -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: {
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user