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()){