fix: Adapt ha-hls-player patch to HA 2024.11 code (#1679)

* Adapt `ha-hls-player` patch to HA `2024.11` code.

* Add the poster back in
This commit is contained in:
Dermot Duffy
2024-11-27 15:13:22 -08:00
committed by GitHub
parent 241719c14e
commit 030b1e7a78
+11 -7
View File
@@ -106,6 +106,7 @@ customElements.whenDefined('ha-hls-player').then(() => {
return html` return html`
<video <video
id="video" id="video"
.poster=${this.posterUrl}
?autoplay=${this.autoPlay} ?autoplay=${this.autoPlay}
.muted=${this.muted} .muted=${this.muted}
?playsinline=${this.playsInline} ?playsinline=${this.playsInline}
@@ -118,7 +119,16 @@ customElements.whenDefined('ha-hls-player').then(() => {
); );
} }
}} }}
@loadeddata=${(ev) => { @loadeddata=${(ev) => this._loadedDataHandler(ev)}
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
@play=${() => dispatchMediaPlayEvent(this)}
@pause=${() => dispatchMediaPauseEvent(this)}
></video>
`;
}
private _loadedDataHandler(ev: Event) {
super._loadedData();
dispatchMediaLoadedEvent(this, ev, { dispatchMediaLoadedEvent(this, ev, {
player: this, player: this,
capabilities: { capabilities: {
@@ -127,12 +137,6 @@ customElements.whenDefined('ha-hls-player').then(() => {
}, },
technology: ['hls'], technology: ['hls'],
}); });
}}
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
@play=${() => dispatchMediaPlayEvent(this)}
@pause=${() => dispatchMediaPauseEvent(this)}
></video>
`;
} }
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {