mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-10 11:30:01 +00:00
Don't add audio track if webrtc player is muted (#25767)
This commit is contained in:
@@ -86,7 +86,8 @@ export class HaCameraStream extends LitElement {
|
||||
const streams = this._streams(
|
||||
this._capabilities?.frontend_stream_types,
|
||||
this._hlsStreams,
|
||||
this._webRtcStreams
|
||||
this._webRtcStreams,
|
||||
this.muted
|
||||
);
|
||||
return html`${repeat(
|
||||
streams,
|
||||
@@ -190,7 +191,8 @@ export class HaCameraStream extends LitElement {
|
||||
(
|
||||
supportedTypes?: StreamType[],
|
||||
hlsStreams?: { hasAudio: boolean; hasVideo: boolean },
|
||||
webRtcStreams?: { hasAudio: boolean; hasVideo: boolean }
|
||||
webRtcStreams?: { hasAudio: boolean; hasVideo: boolean },
|
||||
muted?: boolean
|
||||
): Stream[] => {
|
||||
if (__DEMO__) {
|
||||
return [{ type: MJPEG_STREAM, visible: true }];
|
||||
@@ -220,9 +222,10 @@ export class HaCameraStream extends LitElement {
|
||||
if (
|
||||
hlsStreams.hasVideo &&
|
||||
hlsStreams.hasAudio &&
|
||||
!webRtcStreams.hasAudio
|
||||
!webRtcStreams.hasAudio &&
|
||||
!muted
|
||||
) {
|
||||
// webRTC stream is missing audio, use HLS
|
||||
// webRTC stream is missing audio and audio is not muted, use HLS
|
||||
return [{ type: STREAM_TYPE_HLS, visible: true }];
|
||||
}
|
||||
if (webRtcStreams.hasVideo) {
|
||||
|
||||
@@ -321,6 +321,10 @@ class HaWebRtcPlayer extends LitElement {
|
||||
if (!this._remoteStream) {
|
||||
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);
|
||||
if (!this.hasUpdated) {
|
||||
await this.updateComplete;
|
||||
|
||||
Reference in New Issue
Block a user