Update the webrtc_card provider for the latest webrtc version.

This commit is contained in:
Dermot Duffy
2023-02-27 23:14:20 -08:00
parent d59b259a74
commit a5c33f4c28
2 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -78,7 +78,10 @@ export class FrigateCardLiveWebRTCCard
* @returns The player or `null` if not found. * @returns The player or `null` if not found.
*/ */
protected _getPlayer(): HTMLVideoElement | null { protected _getPlayer(): HTMLVideoElement | null {
return this.renderRoot?.querySelector('video') as HTMLVideoElement | null; const root = this.renderRoot?.querySelector('#webrtc') as
| (HTMLElement & { video?: HTMLVideoElement })
| null;
return root?.video ?? null;
} }
protected async _getWebRTCCardElement(): Promise< protected async _getWebRTCCardElement(): Promise<
@@ -99,7 +102,7 @@ export class FrigateCardLiveWebRTCCard
hass: HomeAssistant; hass: HomeAssistant;
setConfig: (config: Record<string, unknown>) => void; setConfig: (config: Record<string, unknown>) => void;
}; };
const config = {...this.cameraConfig.webrtc_card}; const config = { ...this.cameraConfig.webrtc_card };
if (!config.url && !config.entity && this.cameraEndpoints?.webrtcCard) { if (!config.url && !config.entity && this.cameraEndpoints?.webrtcCard) {
// This will never need to be signed, it is just used internally by the // This will never need to be signed, it is just used internally by the
// card as a stream name lookup. // card as a stream name lookup.
+3 -1
View File
@@ -863,12 +863,14 @@ export class FrigateCardLiveProvider
${ref(this._providerRef)} ${ref(this._providerRef)}
.hass=${this.hass} .hass=${this.hass}
.cameraConfig=${this.cameraConfig} .cameraConfig=${this.cameraConfig}
@frigate-card:media:loaded=${() => { @frigate-card:media:loaded=${(ev: Event) => {
if (provider === 'image') { if (provider === 'image') {
// Only count the media has loaded if the required provider is // Only count the media has loaded if the required provider is
// the image (not just the temporary image shown during // the image (not just the temporary image shown during
// loading). // loading).
this._videoMediaShowHandler(); this._videoMediaShowHandler();
} else {
ev.stopPropagation();
} }
}} }}
> >