Skip to content

Commit 3282785

Browse files
authored
Fix media browser (#22875)
1 parent 2c1931a commit 3282785

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Diff for: src/components/ha-hls-player.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class HaHLSPlayer extends LitElement {
2020

2121
@property() public entityid?: string;
2222

23+
@property() public url?: string;
24+
2325
@property({ attribute: "poster-url" }) public posterUrl?: string;
2426

2527
@property({ type: Boolean, attribute: "controls" })
@@ -94,14 +96,19 @@ class HaHLSPlayer extends LitElement {
9496
super.updated(changedProps);
9597

9698
const entityChanged = changedProps.has("entityid");
99+
const urlChanged = changedProps.has("url");
97100

98-
if (!entityChanged) {
99-
return;
101+
if (entityChanged) {
102+
this._getStreamUrlFromEntityId();
103+
} else if (urlChanged && this.url) {
104+
this._cleanUp();
105+
this._resetError();
106+
this._url = this.url;
107+
this._startHls();
100108
}
101-
this._getStreamUrl();
102109
}
103110

104-
private async _getStreamUrl(): Promise<void> {
111+
private async _getStreamUrlFromEntityId(): Promise<void> {
105112
this._cleanUp();
106113
this._resetError();
107114

0 commit comments

Comments
 (0)