Add auto unmute support.

This commit is contained in:
Dermot Duffy
2022-02-01 20:40:34 -08:00
parent f46a15d76e
commit 632569b1ef
10 changed files with 260 additions and 70 deletions
+14 -1
View File
@@ -56,6 +56,20 @@ customElements.whenDefined('ha-camera-stream').then(() => {
this._playerRef.value?.pause();
}
/**
* Mute the video.
*/
public mute(): void {
this.muted = true;
}
/**
* Unmute the video.
*/
public unmute(): void {
this.muted = false;
}
/**
* Master render method.
* @returns A rendered template.
@@ -82,7 +96,6 @@ customElements.whenDefined('ha-camera-stream').then(() => {
? html`
<frigate-card-ha-hls-player
${ref(this._playerRef)}
autoplay
playsinline
.allowExoPlayer=${this.allowExoPlayer}
.muted=${this.muted}
+14 -1
View File
@@ -34,6 +34,20 @@ customElements.whenDefined('ha-hls-player').then(() => {
this._videoRef.value?.pause();
}
/**
* Mute the video.
*/
public mute(): void {
this.muted = true;
}
/**
* Unmute the video.
*/
public unmute(): void {
this.muted = false;
}
// =====================================================================================
// Minor modifications from:
// - https://github.com/home-assistant/frontend/blob/dev/src/components/ha-hls-player.ts
@@ -42,7 +56,6 @@ customElements.whenDefined('ha-hls-player').then(() => {
return html`
<video
${ref(this._videoRef)}
?autoplay=${this.autoPlay}
.muted=${this.muted}
?playsinline=${this.playsInline}
?controls=${this.controls}