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-row>
|
<v-row>
|
||||||
<v-col class="py-2">
|
<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-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row v-if="adaptiveFps">
|
<v-row v-if="serviceMethod == 1">
|
||||||
<v-col class="py-2">
|
<v-col class="py-2">
|
||||||
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
|
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
@ -65,7 +65,11 @@
|
|||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
rotationEnabled: false
|
rotationEnabled: false,
|
||||||
|
serviceMethodItems: [
|
||||||
|
{ value: 0, text: 'MJPEG-Streamer' },
|
||||||
|
{ value: 1, text: 'MJPEG-Streamer (Adaptive)' },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -74,8 +78,6 @@
|
|||||||
return this.$store.state.gui.webcam.url;
|
return this.$store.state.gui.webcam.url;
|
||||||
},
|
},
|
||||||
set(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 } });
|
return this.$store.dispatch('gui/setSettings', { webcam: { url } });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -119,12 +121,12 @@
|
|||||||
return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } });
|
return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
adaptiveFps: {
|
serviceMethod: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.gui.webcam.adaptiveFps;
|
return this.$store.state.gui.webcam.serviceMethod;
|
||||||
},
|
},
|
||||||
set(useAdaptiveFps) {
|
set(selectedMethod) {
|
||||||
return this.$store.dispatch('gui/setSettings', { webcam: { adaptiveFps: useAdaptiveFps } });
|
return this.$store.dispatch('gui/setSettings', { webcam: { serviceMethod: selectedMethod } });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
targetFps: {
|
targetFps: {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
document.addEventListener("focus", () => this.handleRefreshChange(), false);
|
document.addEventListener("focus", () => this.handleRefreshChange(), false);
|
||||||
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
|
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
|
||||||
|
|
||||||
if(this.webcamConfig.adaptiveFps) {
|
if(this.webcamConfig.serviceMethod == 1) {
|
||||||
this.requestMjpeg();
|
this.requestMjpeg();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +54,11 @@
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
subHeading() {
|
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() {
|
url() {
|
||||||
if(!this.webcamConfig.adaptiveFps) {
|
if(!this.webcamConfig.serviceMethod) {
|
||||||
let basicUrl = this.webcamConfig.url
|
let basicUrl = this.webcamConfig.url
|
||||||
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
||||||
|
|
||||||
@ -67,10 +67,6 @@
|
|||||||
return decodeURIComponent(params.toString())
|
return decodeURIComponent(params.toString())
|
||||||
} else {
|
} else {
|
||||||
return this.imageData;
|
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() {
|
requestMjpeg() {
|
||||||
if(!this.isVisible)
|
if(!this.isVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.request_start_time = performance.now();
|
this.request_start_time = performance.now();
|
||||||
let basicUrl = this.webcamConfig.url
|
let basicUrl = this.webcamConfig.url
|
||||||
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
|
||||||
@ -133,9 +130,8 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
visibilityChanged(isVisible, entry) {
|
visibilityChanged(isVisible) {
|
||||||
this.isVisible = isVisible;
|
this.isVisible = isVisible;
|
||||||
console.log(entry);
|
|
||||||
if(isVisible)
|
if(isVisible)
|
||||||
this.requestMjpeg();
|
this.requestMjpeg();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user