mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +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;
|
||||
if (picture) {
|
||||
dummy = document.createElement('IMG');
|
||||
dummy.onload = function () {
|
||||
dummy.onload = () => {
|
||||
this.$.cover.style.backgroundImage = 'url(' + picture + ')';
|
||||
dummy.onerror = dummy.onload = null;
|
||||
dummy.src = '';
|
||||
dummy = null;
|
||||
}.bind(this);
|
||||
dummy.onerror = function () {
|
||||
};
|
||||
dummy.onerror = () => {
|
||||
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.src = '';
|
||||
dummy = null;
|
||||
}.bind(this);
|
||||
};
|
||||
if (this._timeout_id) {
|
||||
clearTimeout(this._timeout_id);
|
||||
}
|
||||
this._timeout_id = setTimeout(function () {
|
||||
this._timeout_id = setTimeout(() => {
|
||||
if (dummy) {
|
||||
// Background load still inflight. Clear real image.
|
||||
this.$.cover.style.backgroundImage = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user