mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Fix media player card (#471)
This commit is contained in:
parent
7d86f30a6b
commit
ed233364ec
@ -238,23 +238,23 @@ class HaMediaPlayerCard extends window.hassMixins.EventsMixin(Polymer.Element) {
|
|||||||
var dummy;
|
var dummy;
|
||||||
if (picture) {
|
if (picture) {
|
||||||
dummy = document.createElement('IMG');
|
dummy = document.createElement('IMG');
|
||||||
dummy.onload = function () {
|
dummy.onload = () => {
|
||||||
this.$.cover.style.backgroundImage = 'url(' + picture + ')';
|
this.$.cover.style.backgroundImage = 'url(' + picture + ')';
|
||||||
dummy.onerror = dummy.onload = null;
|
dummy.onerror = dummy.onload = null;
|
||||||
dummy.src = '';
|
dummy.src = '';
|
||||||
dummy = null;
|
dummy = null;
|
||||||
}.bind(this);
|
};
|
||||||
dummy.onerror = function () {
|
dummy.onerror = () => {
|
||||||
this.$.cover.style.backgroundImage = '';
|
this.$.cover.style.backgroundImage = '';
|
||||||
this.toggleClass('no-cover', true, this.$.cover.parentElement);
|
this.$.cover.parentElement.classList.add('no-cover');
|
||||||
dummy.onerror = dummy.onload = null;
|
dummy.onerror = dummy.onload = null;
|
||||||
dummy.src = '';
|
dummy.src = '';
|
||||||
dummy = null;
|
dummy = null;
|
||||||
}.bind(this);
|
};
|
||||||
if (this._timeout_id) {
|
if (this._timeout_id) {
|
||||||
clearTimeout(this._timeout_id);
|
clearTimeout(this._timeout_id);
|
||||||
}
|
}
|
||||||
this._timeout_id = setTimeout(function () {
|
this._timeout_id = setTimeout(() => {
|
||||||
if (dummy) {
|
if (dummy) {
|
||||||
// Background load still inflight. Clear real image.
|
// Background load still inflight. Clear real image.
|
||||||
this.$.cover.style.backgroundImage = '';
|
this.$.cover.style.backgroundImage = '';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user