Is it possible to apply constraints to a running live audio track? It doesn't seem to work for me, at least on Chrome v80.
Suppose I have a stream:
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
autoGainControl: true
channelCount: 2
echoCancellation: true
noiseSuppression: true
},
video: false
});
Now, later on I want to change some of those parameters:
for (const track of stream.getAudioTracks()) {
track.applyConstraints({
autoGainControl: false,
echoCancellation: false,
noiseSuppression: false
});
}
This has no effect. If I call track.getConstraints(), I see my new constraints but audibly they have no effect until I reload the page and apply them from the beginning. Additionally, when I call track.getSettings(), I see that my new constraints haven't been applied.
I have also tried calling track.enabled = false before applying the constraints, with track.enabled = true afterwards, with no luck.
Any advice on how to get this to work without making a fresh call to getUserMedia()?