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
+14 -10
View File
@@ -106,6 +106,7 @@ customElements.whenDefined('ha-hls-player').then(() => {
return html`
<video
id="video"
.poster=${this.posterUrl}
?autoplay=${this.autoPlay}
.muted=${this.muted}
?playsinline=${this.playsInline}
@@ -118,16 +119,7 @@ customElements.whenDefined('ha-hls-player').then(() => {
);
}
}}
@loadeddata=${(ev) => {
dispatchMediaLoadedEvent(this, ev, {
player: this,
capabilities: {
supportsPause: true,
hasAudio: mayHaveAudio(this._video),
},
technology: ['hls'],
});
}}
@loadeddata=${(ev) => this._loadedDataHandler(ev)}
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
@play=${() => dispatchMediaPlayEvent(this)}
@pause=${() => dispatchMediaPauseEvent(this)}
@@ -135,6 +127,18 @@ customElements.whenDefined('ha-hls-player').then(() => {
`;
}
private _loadedDataHandler(ev: Event) {
super._loadedData();
dispatchMediaLoadedEvent(this, ev, {
player: this,
capabilities: {
supportsPause: true,
hasAudio: mayHaveAudio(this._video),
},
technology: ['hls'],
});
}
static get styles(): CSSResultGroup {
return [
super.styles,