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);
|
||||
}
|
||||
|
||||
const oldImage = oldHass
|
||||
? oldHass.states[this._config.entity].attributes.entity_picture
|
||||
: undefined;
|
||||
const newImage = this.hass.states[this._config.entity].attributes
|
||||
const oldImage =
|
||||
oldHass?.states[this._config.entity]?.attributes.entity_picture;
|
||||
const newImage = this.hass.states[this._config.entity]?.attributes
|
||||
.entity_picture;
|
||||
|
||||
if (!newImage || newImage === oldImage) {
|
||||
@ -229,11 +228,13 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
||||
return;
|
||||
}
|
||||
|
||||
fetchMediaPlayerThumbnailWithCache(this.hass, this._config.entity).then(
|
||||
({ content_type, content }) => {
|
||||
fetchMediaPlayerThumbnailWithCache(this.hass, this._config.entity)
|
||||
.then(({ content_type, content }) => {
|
||||
this._image = `data:${content_type};base64,${content}`;
|
||||
}
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
this._image = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
private _computeSecondaryTitle(stateObj: HassEntity): string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user