Disabled unnessicary audio processing for webRTC Streams
This commit is contained in:
parent
1dfe3454b4
commit
d686cf540e
1 changed files with 10 additions and 2 deletions
|
|
@ -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()){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue