From f379710b21e7088829a3623a62c75df6a85e721f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 23 Aug 2024 23:25:14 +0200 Subject: [PATCH] fix(MediaMTX): fix connection issue Signed-off-by: Stefan Dej --- src/components/webcams/streamers/WebrtcMediaMTX.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/webcams/streamers/WebrtcMediaMTX.vue b/src/components/webcams/streamers/WebrtcMediaMTX.vue index 6e0259e95..152498390 100644 --- a/src/components/webcams/streamers/WebrtcMediaMTX.vue +++ b/src/components/webcams/streamers/WebrtcMediaMTX.vue @@ -203,6 +203,7 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { try { const res = await fetch(this.url, { method: 'OPTIONS' }) + if (res.status !== 200) new Error('bad status code') await this.onIceServers(res) } catch (err) { this.log('error: Cannot connect to backend') @@ -211,6 +212,8 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { } async onIceServers(res: Response) { + this.log('start onIceServers') + const iceServers = this.linkToIceServers(res.headers.get('Link')) this.log('ice servers:', iceServers)