From d686cf540e758ee6f873037833969d82ac454ad4 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Sat, 10 Oct 2026 03:38:13 -0400 Subject: [PATCH] Disabled unnessicary audio processing for webRTC Streams --- www/js/channel/webRTCHandler.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/www/js/channel/webRTCHandler.js b/www/js/channel/webRTCHandler.js index 4210431..1febfa5 100644 --- a/www/js/channel/webRTCHandler.js +++ b/www/js/channel/webRTCHandler.js @@ -82,20 +82,28 @@ class webRTCHandler{ } async startStream(){ + //Set custom audio config to prevent browsers from cooking audio like it's coming out of a shitty webcam with loud echoing speakers + const audioConfig = { + channels: 2, + autoGainControl: false, + echoCancellation: false, + noiseSuppression: false + } + //Throw broadcasting flag this.isBroadcasting = true; //Get media stream from browser input this.broadcastingStream = await navigator.mediaDevices.getDisplayMedia({ video: true, - audio: true + audio: audioConfig }); //If we didn't get any audio tracks from the DisplayMedia portion of the API if(this.broadcastingStream == null || this.broadcastingStream.getAudioTracks().length == 0){ try{ //Bug user for an audio device - const tempStream = await navigator.mediaDevices.getUserMedia({video: false, audio: true}); + const tempStream = await navigator.mediaDevices.getUserMedia({video: false, audio: audioConfig}); //For each track received from audio device for(const track of tempStream.getAudioTracks()){