Allow the user to specify image URL for image live provider.

This commit is contained in:
Dermot Duffy
2023-02-26 19:47:33 -08:00
parent 5e927a23b0
commit 6d2d31f709
9 changed files with 66 additions and 46 deletions
+2 -1
View File
@@ -51,8 +51,9 @@ export class FrigateCardLiveImage extends LitElement implements FrigateCardMedia
return html` <frigate-card-image
.imageConfig=${{
mode: 'camera' as const,
mode: this.cameraConfig.image.url ? 'url' as const : 'camera' as const,
refresh_seconds: this._playing ? this.cameraConfig.image.refresh_seconds : 0,
url: this.cameraConfig.image.url,
// Don't need to pass layout options as FrigateCardLiveProvider has
// already taken care of this for us.
}}
+8 -6
View File
@@ -723,12 +723,14 @@ export class FrigateCardLiveProvider
// If the play call fails, and the media is not already muted, mute it first
// and then try again. This works around some browsers that prevent
// auto-play unless the video is muted.
this._providerRef.value?.play().catch((ev) => {
if (ev.name === 'NotAllowedError' && !this.isMuted()) {
this.mute();
this._providerRef.value?.play().catch();
}
});
if (this._providerRef.value?.play) {
this._providerRef.value?.play().catch((ev) => {
if (ev.name === 'NotAllowedError' && !this.isMuted()) {
this.mute();
this._providerRef.value?.play().catch();
}
});
}
}
public pause(): void {