mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Update hui-media-control-card.ts (#4919)
This commit is contained in:
parent
23f34fa7ae
commit
924c7804c9
@ -213,10 +213,9 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
|||||||
applyThemesOnElement(this, this.hass.themes, this._config.theme);
|
applyThemesOnElement(this, this.hass.themes, this._config.theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldImage = oldHass
|
const oldImage =
|
||||||
? oldHass.states[this._config.entity].attributes.entity_picture
|
oldHass?.states[this._config.entity]?.attributes.entity_picture;
|
||||||
: undefined;
|
const newImage = this.hass.states[this._config.entity]?.attributes
|
||||||
const newImage = this.hass.states[this._config.entity].attributes
|
|
||||||
.entity_picture;
|
.entity_picture;
|
||||||
|
|
||||||
if (!newImage || newImage === oldImage) {
|
if (!newImage || newImage === oldImage) {
|
||||||
@ -229,11 +228,13 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchMediaPlayerThumbnailWithCache(this.hass, this._config.entity).then(
|
fetchMediaPlayerThumbnailWithCache(this.hass, this._config.entity)
|
||||||
({ content_type, content }) => {
|
.then(({ content_type, content }) => {
|
||||||
this._image = `data:${content_type};base64,${content}`;
|
this._image = `data:${content_type};base64,${content}`;
|
||||||
}
|
})
|
||||||
);
|
.catch(() => {
|
||||||
|
this._image = undefined;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _computeSecondaryTitle(stateObj: HassEntity): string {
|
private _computeSecondaryTitle(stateObj: HassEntity): string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user