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` 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,16 +119,7 @@ customElements.whenDefined('ha-hls-player').then(() => {
); );
} }
}} }}
@loadeddata=${(ev) => { @loadeddata=${(ev) => this._loadedDataHandler(ev)}
dispatchMediaLoadedEvent(this, ev, {
player: this,
capabilities: {
supportsPause: true,
hasAudio: mayHaveAudio(this._video),
},
technology: ['hls'],
});
}}
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)} @volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
@play=${() => dispatchMediaPlayEvent(this)} @play=${() => dispatchMediaPlayEvent(this)}
@pause=${() => dispatchMediaPauseEvent(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 { static get styles(): CSSResultGroup {
return [ return [
super.styles, super.styles,