From 7c23d9ee075bc4f681eab26bc12c50410cdcdb54 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 7 Dec 2024 22:59:43 +0100 Subject: [PATCH] fix(Webcam): add ICE Candidates check to support older camera-streamer versions (#2069) Signed-off-by: Stefan Dej --- src/components/webcams/streamers/WebrtcCameraStreamer.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/webcams/streamers/WebrtcCameraStreamer.vue b/src/components/webcams/streamers/WebrtcCameraStreamer.vue index ef8422685..78825ff78 100644 --- a/src/components/webcams/streamers/WebrtcCameraStreamer.vue +++ b/src/components/webcams/streamers/WebrtcCameraStreamer.vue @@ -136,7 +136,12 @@ export default class WebrtcCameraStreamer extends Mixins(BaseMixin, WebcamMixin) this.pc.addTransceiver('video', { direction: 'recvonly' }) - this.pc.onicecandidate = (e: RTCPeerConnectionIceEvent) => this.onIceCandidate(e, iceResponse.id) + if ('iceServers' in iceResponse) { + this.pc.onicecandidate = (e: RTCPeerConnectionIceEvent) => this.onIceCandidate(e, iceResponse.id) + } else { + this.log('No ICE servers returned, so the current camera-streamer version may not support them') + } + this.pc.onconnectionstatechange = () => this.onConnectionStateChange() this.pc.ontrack = (e) => this.onTrack(e)