Fix media browser (#22875)

This commit is contained in:
Ivan Kara 2024-11-19 18:24:36 +07:00 committed by GitHub
parent 2c1931adb1
commit 3282785cf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,6 +20,8 @@ class HaHLSPlayer extends LitElement {
@property() public entityid?: string; @property() public entityid?: string;
@property() public url?: string;
@property({ attribute: "poster-url" }) public posterUrl?: string; @property({ attribute: "poster-url" }) public posterUrl?: string;
@property({ type: Boolean, attribute: "controls" }) @property({ type: Boolean, attribute: "controls" })
@ -94,14 +96,19 @@ class HaHLSPlayer extends LitElement {
super.updated(changedProps); super.updated(changedProps);
const entityChanged = changedProps.has("entityid"); const entityChanged = changedProps.has("entityid");
const urlChanged = changedProps.has("url");
if (!entityChanged) { if (entityChanged) {
return; this._getStreamUrlFromEntityId();
} else if (urlChanged && this.url) {
this._cleanUp();
this._resetError();
this._url = this.url;
this._startHls();
} }
this._getStreamUrl();
} }
private async _getStreamUrl(): Promise<void> { private async _getStreamUrlFromEntityId(): Promise<void> {
this._cleanUp(); this._cleanUp();
this._resetError(); this._resetError();