Improve handling of non-Frigate cameras.

This commit is contained in:
Dermot Duffy
2022-01-14 21:31:16 -08:00
parent 64af74ae26
commit 73caa5d52a
8 changed files with 87 additions and 45 deletions
+11 -2
View File
@@ -1,4 +1,5 @@
// TODO readme
// TODO autodetect live provider from cameras configuration, or allow explicit setting.
// TODO verify README links worked correctly (e.g. basic cameras configuration)
import {
CSSResultGroup,
@@ -371,7 +372,8 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
const config = getOverriddenConfig(
this.liveConfig,
this.liveOverrides,
conditionState) as LiveConfig;
conditionState,
) as LiveConfig;
return html` <div class="embla__slide">
<frigate-card-live-provider
@@ -832,6 +834,13 @@ export class FrigateCardLiveJSMPEG extends LitElement {
this._jsmpegCanvasElement = document.createElement('canvas');
this._jsmpegCanvasElement.className = 'media';
if (!this.cameraConfig?.camera_name) {
return dispatchErrorMessageEvent(
this,
localize('error.no_camera_name') + `: ${JSON.stringify(this.cameraConfig)}`,
);
}
const url = await this._getURL();
if (url) {
this._jsmpegVideoPlayer = this._createJSMPEGPlayer(url);