使用 WebRTC 应用程序禁用自动增益控制 [英] Disabling Auto Gain Conctrol with WebRTC App

查看:27
本文介绍了使用 WebRTC 应用程序禁用自动增益控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在默认情况下禁用 WebRTC自动增益控制功能",方法是将一些 javascript 代码应用到应用程序文件中?

is there a way to disable the WebRTC "auto gain control feature" by default, by applying some javascript code to the app files?

我使用的是 simplewebrtc.

i am using simplewebrtc.

推荐答案

您可以使用约束关闭音频处理(使用 https fiddle 适用于 Chrome):

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 显然在以下情况下关闭所有音频处理echoCancellation: false 已指定.

Chrome apparently turns off all audio processing when echoCancellation: false is specified.

Firefox 没有这样做 ,所以包括 autoGainControl: falsenoiseSuppression: false 现在也是如此.

Firefox doesn't do that yet, so include autoGainControl: false and noiseSuppression: false as well for now.

Chrome 和 Firefox (64+) 似乎 默认 autoGainControltrue.

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

旧版 Firefox 将默认autoGainControlfalsenoiseSuppressiontrue,但与所有设备设置一样,默认值可能因浏览器、设备甚至设备而异,所以如果你关心一个设置,限制它.

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.

这三个设置也可以在 Chrome 和 Firefox 中单独控制.

All three settings can also be controlled individually in Chrome and Firefox.

这篇关于使用 WebRTC 应用程序禁用自动增益控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆