is there a way to disable the WebRTC "auto gain control feature" by default, by applying some javascript code to the app files?
i am using simplewebrtc.
You can turn off audio processing using constraints (use https fiddle for Chrome):
var constraints = {
audio: {
echoCancellation: false,
noiseSuppression: false,
autoGainControl: false,
}
};
navigator.mediaDevices.getUserMedia(constraints)
.then(stream => audio.srcObject = stream)
.catch(e => log(e));
var log = msg => div.innerHTML += msg + "<br>";
<audio id="audio" controls autoplay></audio><br>
<div id="div"></div>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
Chrome apparently turns off all audio processing when echoCancellation: false
is specified.
Firefox doesn't do that yet, so include autoGainControl: false
and noiseSuppression: false
as well for now (recent additions to the spec that rely on adapter.js here except in Firefox Nightly).
Firefox currently tends to default autoGainControl
to false
and noiseSuppression
to true
, but like all device settings, defaults may vary from browser to browser, device to device or even the situation, so if you care about a setting, constrain it.
All three settings can also be controlled individually in Chrome and Firefox (again, use adapter.js to avoid vendor prefixes).
来源:https://stackoverflow.com/questions/37326846/disabling-auto-gain-conctrol-with-webrtc-app