cleanup adaptive mjpeg-streamer functions

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-02-24 22:41:08 +01:00
parent c22d0c2040
commit fbdacef932

View File

@ -15,7 +15,7 @@
</v-toolbar-title> </v-toolbar-title>
</v-toolbar> </v-toolbar>
<v-card-text class="px-0 py-0 content"> <v-card-text class="px-0 py-0 content">
<img :src="url" class="webcamImage" :style="webcamStyle" @load="onLoad" alt="Webcam"/> <img :src="url" class="webcamImage" :style="webcamStyle" @load="onLoad" alt="Webcam" v-if="['mjpegstreamer', 'mjpegstreamer-adaptive'].includes(this.webcamConfig.service)" />
</v-card-text> </v-card-text>
</v-card> </v-card>
</template> </template>
@ -58,15 +58,15 @@
}), }),
url() { url() {
if(this.webcamConfig.service === 'mjpegstreamer-adaptive') { if (this.webcamConfig.service === 'mjpegstreamer' && this.webcamConfig.url.indexOf("?") !== -1) {
return this.imageData;
} else {
let basicUrl = this.webcamConfig.url let basicUrl = this.webcamConfig.url
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
const params = new URLSearchParams(basicUrl) const params = new URLSearchParams(basicUrl)
params.set('bypassCache', ""+this.refresh) params.set('bypassCache', ""+this.refresh)
return decodeURIComponent(params.toString()) return decodeURIComponent(params.toString())
} else if (this.webcamConfig.service === 'mjpegstreamer-adaptive') {
return this.imageData
} else {
return this.webcamConfig.url
} }
}, },