Only register WebRTC callbacks once.
This commit is contained in:
@@ -225,6 +225,7 @@ export class FrigateCardLiveWebRTC extends LitElement {
|
|||||||
|
|
||||||
protected hass?: HomeAssistant & ExtendedHomeAssistant;
|
protected hass?: HomeAssistant & ExtendedHomeAssistant;
|
||||||
protected _webRTCElement: HTMLElement | null = null;
|
protected _webRTCElement: HTMLElement | null = null;
|
||||||
|
protected _callbacksAdded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the WebRTC element. May throw.
|
* Create the WebRTC element. May throw.
|
||||||
@@ -264,6 +265,10 @@ export class FrigateCardLiveWebRTC extends LitElement {
|
|||||||
* Updated lifecycle callback.
|
* Updated lifecycle callback.
|
||||||
*/
|
*/
|
||||||
public updated(): void {
|
public updated(): void {
|
||||||
|
if (this._callbacksAdded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract the video component after it has been rendered and generate the
|
// Extract the video component after it has been rendered and generate the
|
||||||
// media load event.
|
// media load event.
|
||||||
this.updateComplete.then(() => {
|
this.updateComplete.then(() => {
|
||||||
@@ -291,6 +296,7 @@ export class FrigateCardLiveWebRTC extends LitElement {
|
|||||||
}
|
}
|
||||||
dispatchPauseEvent(this);
|
dispatchPauseEvent(this);
|
||||||
};
|
};
|
||||||
|
this._callbacksAdded = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user