Fix media loading to work for HA >= 2021.11

This commit is contained in:
Dermot Duffy
2021-10-30 01:00:25 -07:00
parent 38abccd5c5
commit 6ec4ad067e
2 changed files with 17 additions and 16 deletions
+2 -5
View File
@@ -43,21 +43,18 @@ customElements.whenDefined('ha-camera-stream').then(() => {
return html``;
}
// Below .src/@load bindings tweaked to work pre/post:
// - https://github.com/home-assistant/frontend/commit/e963735dbabdc2fea8a95aea325952560c727625
return html`
${this._shouldRenderMJPEG
? html`
<img
@load=${(e) => {
// TODO: This block can be removed a safe distance from HA 2021.11.
if (typeof this._elementResized != 'undefined') {
this._elementResized();
}
dispatchMediaShowEvent(this, e);
}}
.src=${
(typeof this._connected == 'undefined' ||
this._connected)
.src=${typeof this._connected == 'undefined' || this._connected
? computeMJPEGStreamUrl(this.stateObj)
: ''}
.alt=${`Preview of the ${computeStateName(this.stateObj)} camera.`}