'Web Audio API Constraints and AudioContext Graph

I am doing some audio processing with web audio api using JavaScript and I need an advice.

I am trying to do something like this.

const stream = await navigator.mediaDevices.getUserMedia 
{
    audio: true,
}

// Adding some constraints to the stream
for await(const track of stream.getAudioTracks()){
    await track.applyConstraints({echoCancellation:true, noiseSuppresion:false,....});
}


// Creating source and destination 
const source = context.createMediaStreamSource(stream);
const destination = context.createMediaStreamDestination();

// Filtering some audio
source.connect(filter);
filter.connect(destination);

// Applying new constraints after filtering
for await(const destTrack of destination.stream.getAudioTracks()){
    await destTrack.applyConstraints({autoGainControl:true...});
}

But after trying to apply new constarints to the destination I get error OverconstrainedError {name: 'OverconstrainedError', message: 'Cannot satisfy constraints', constraint: ''}. Why is error.constraint === '' ? How resolve this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source