From e2a79e24a1b0c0baeb7f8e417889d4b55c5e4abe Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 29 Nov 2020 21:48:14 +0100 Subject: [PATCH] Mute local audio when streaming video. --- static/sfu.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/sfu.js b/static/sfu.js index 90bfed4..3149613 100644 --- a/static/sfu.js +++ b/static/sfu.js @@ -900,6 +900,15 @@ async function addFileMedia(file) { c.stream = stream; stream.onaddtrack = function(e) { let t = e.track; + if(t.kind === 'audio') { + let presenting = !!findUpMedia('local'); + let muted = getSettings().localMute; + if(presenting && !muted) { + setLocalMute(true); + updateSettings({localMute: true}); + displayWarning('You have been muted'); + } + } c.pc.addTrack(t, stream); c.labels[t.id] = t.kind; c.onstats = gotUpStats;