Hide buttons that don't work during casting

This commit is contained in:
Dermot Duffy
2022-06-25 09:51:30 -07:00
parent 9905dde925
commit 7fafc46347
+13 -5
View File
@@ -483,8 +483,8 @@ export class FrigateCard extends LitElement {
} }
if ( if (
this._view?.isViewerView() || !this._isBeingCasted() &&
(this._view?.is('timeline') && !!this._view?.media) (this._view?.isViewerView() || (this._view?.is('timeline') && !!this._view?.media))
) { ) {
buttons.push({ buttons.push({
icon: 'mdi:download', icon: 'mdi:download',
@@ -507,7 +507,7 @@ export class FrigateCard extends LitElement {
}); });
} }
if (screenfull.isEnabled) { if (screenfull.isEnabled && !this._isBeingCasted()) {
buttons.push({ buttons.push({
icon: screenfull.isFullscreen ? 'mdi:fullscreen-exit' : 'mdi:fullscreen', icon: screenfull.isFullscreen ? 'mdi:fullscreen-exit' : 'mdi:fullscreen',
...this._getConfig().menu.buttons.fullscreen, ...this._getConfig().menu.buttons.fullscreen,
@@ -1646,6 +1646,14 @@ export class FrigateCard extends LitElement {
super.disconnectedCallback(); super.disconnectedCallback();
} }
/**
* Determine if the card is currently being casted.
* @returns
*/
protected _isBeingCasted(): boolean {
return !!navigator.userAgent.match(/CrKey\//);
}
/** /**
* Determine if the aspect ratio should be enforced given the current view and * Determine if the aspect ratio should be enforced given the current view and
* context. * context.
@@ -1861,9 +1869,9 @@ export class FrigateCard extends LitElement {
: `` : ``
} }
${!this._message && this._getConfig().elements ${!this._message && this._getConfig().elements
// Elements need to render after the main views so it can render 'on ? // Elements need to render after the main views so it can render 'on
// top'. // top'.
? html` <frigate-card-elements html` <frigate-card-elements
${ref(this._refElements)} ${ref(this._refElements)}
.hass=${this._hass} .hass=${this._hass}
.elements=${this._getConfig().elements} .elements=${this._getConfig().elements}