Revoke old camera image after new one has loaded (#2772)

This commit is contained in:
Paulus Schoutsen 2019-02-17 09:06:50 -08:00 committed by GitHub
parent da80bfa3c7
commit 3b008b6359
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,15 +167,14 @@ class HuiImage extends LitElement {
if (!this.hass || !this.cameraImage) {
return;
}
if (this._cameraImageSrc) {
URL.revokeObjectURL(this._cameraImageSrc);
this._cameraImageSrc = undefined;
}
try {
const { content_type: contentType, content } = await fetchThumbnail(
this.hass,
this.cameraImage
);
if (this._cameraImageSrc) {
URL.revokeObjectURL(this._cameraImageSrc);
}
this._cameraImageSrc = URL.createObjectURL(
b64toBlob(content, contentType)
);