Don't add audio track is webrtc player is muted
parent
01d2ef13c6
commit
1228f17ffb
|
@ -220,9 +220,10 @@ export class HaCameraStream extends LitElement {
|
||||||
if (
|
if (
|
||||||
hlsStreams.hasVideo &&
|
hlsStreams.hasVideo &&
|
||||||
hlsStreams.hasAudio &&
|
hlsStreams.hasAudio &&
|
||||||
!webRtcStreams.hasAudio
|
!webRtcStreams.hasAudio &&
|
||||||
|
!this.muted
|
||||||
) {
|
) {
|
||||||
// webRTC stream is missing audio, use HLS
|
// webRTC stream is missing audio and video is not muted, use HLS
|
||||||
return [{ type: STREAM_TYPE_HLS, visible: true }];
|
return [{ type: STREAM_TYPE_HLS, visible: true }];
|
||||||
}
|
}
|
||||||
if (webRtcStreams.hasVideo) {
|
if (webRtcStreams.hasVideo) {
|
||||||
|
|
|
@ -308,6 +308,10 @@ class HaWebRtcPlayer extends LitElement {
|
||||||
if (!this._remoteStream) {
|
if (!this._remoteStream) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// If the track is audio and the player is muted, we do not add it to the stream.
|
||||||
|
if (event.track.kind === "audio" && this.muted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._remoteStream.addTrack(event.track);
|
this._remoteStream.addTrack(event.track);
|
||||||
if (!this.hasUpdated) {
|
if (!this.hasUpdated) {
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
|
|
Loading…
Reference in New Issue