Disabled unnessicary audio processing for webRTC Streams

This commit is contained in:
rainbow napkin 2026-10-10 03:38:13 -04:00
parent 1dfe3454b4
commit d686cf540e

View file

@ -82,20 +82,28 @@ class webRTCHandler{
} }
async startStream(){ 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 //Throw broadcasting flag
this.isBroadcasting = true; this.isBroadcasting = true;
//Get media stream from browser input //Get media stream from browser input
this.broadcastingStream = await navigator.mediaDevices.getDisplayMedia({ this.broadcastingStream = await navigator.mediaDevices.getDisplayMedia({
video: true, video: true,
audio: true audio: audioConfig
}); });
//If we didn't get any audio tracks from the DisplayMedia portion of the API //If we didn't get any audio tracks from the DisplayMedia portion of the API
if(this.broadcastingStream == null || this.broadcastingStream.getAudioTracks().length == 0){ if(this.broadcastingStream == null || this.broadcastingStream.getAudioTracks().length == 0){
try{ try{
//Bug user for an audio device //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 each track received from audio device
for(const track of tempStream.getAudioTracks()){ for(const track of tempStream.getAudioTracks()){