From 48b7d0eb2099ca33f3f84e64b9407b2016260ff1 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Fri, 26 Nov 2021 21:23:16 -0800 Subject: [PATCH] Only register WebRTC callbacks once. --- src/components/live.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/live.ts b/src/components/live.ts index 4868d810..3d119ca6 100644 --- a/src/components/live.ts +++ b/src/components/live.ts @@ -225,6 +225,7 @@ export class FrigateCardLiveWebRTC extends LitElement { protected hass?: HomeAssistant & ExtendedHomeAssistant; protected _webRTCElement: HTMLElement | null = null; + protected _callbacksAdded = false; /** * Create the WebRTC element. May throw. @@ -264,6 +265,10 @@ export class FrigateCardLiveWebRTC extends LitElement { * Updated lifecycle callback. */ public updated(): void { + if (this._callbacksAdded) { + return; + } + // Extract the video component after it has been rendered and generate the // media load event. this.updateComplete.then(() => { @@ -291,6 +296,7 @@ export class FrigateCardLiveWebRTC extends LitElement { } dispatchPauseEvent(this); }; + this._callbacksAdded = true; } }); }