Generalize camera endpoints.

This commit is contained in:
Dermot Duffy
2023-02-18 11:03:12 -08:00
parent 5767e98501
commit f5ce02fe4a
13 changed files with 219 additions and 132 deletions
+12 -9
View File
@@ -1461,15 +1461,18 @@ class FrigateCard extends LitElement {
* @returns The URL or null if unavailable.
*/
protected _getCameraURLFromContext(): string | null {
const view = this._view;
const selectedCameraID = view?.camera;
const media = view?.queryResults?.getSelectedResult() ?? null;
return this._hass && view && selectedCameraID
? this._cameraManager?.getCameraURL(selectedCameraID, {
...(media && { media: media }),
...(view && { view: view.view }),
}) ?? null
: null;
if (!this._view) {
return null;
}
const selectedCameraID = this._view.camera;
const media = this._view.queryResults?.getSelectedResult() ?? null;
const endpoints =
this._cameraManager?.getCameraEndpoints(selectedCameraID, {
view: this._view.view,
...(media && { media: media }),
}) ?? null;
return endpoints?.ui?.endpoint ?? null;
}
/**