Disabling Auto Gain Conctrol with WebRTC App

天涯浪子 提交于 2019-11-27 03:34:00

问题


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.


回答1:


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.

Both Chrome and Firefox (64+) appear to default autoGainControl to true.

Older versions of Firefox would 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.



来源:https://stackoverflow.com/questions/37326846/disabling-auto-gain-conctrol-with-webrtc-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!