Skip to content

Commit

Permalink
fix: Adapt ha-hls-player patch to HA 2024.11 code (#1679)
Browse files Browse the repository at this point in the history
* Adapt `ha-hls-player` patch to HA `2024.11` code.

* Add the poster back in
  • Loading branch information
dermotduffy authored Nov 27, 2024
1 parent 241719c commit 030b1e7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/patches/ha-hls-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -118,23 +119,26 @@ 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)}
></video>
`;
}

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,
Expand Down

0 comments on commit 030b1e7

Please sign in to comment.