简体   繁体   English

通过JavaScript中的Web Audio API静音/取消静音和更改音量

[英]Muting/unmutting & changing volume via Web Audio API in JavaScript

I have a few quick questions regarding the Web Audio API. 我有一些关于Web Audio API的快速问题。 I am developing in JavaScript (AngularJS). 我正在使用JavaScript(AngularJS)进行开发。

A great demo app that I am using is at: https://webaudiodemos.appspot.com/AudioRecorder/index.html 我正在使用的一个很棒的演示应用程序位于: https//webaudiodemos.appspot.com/AudioRecorder/index.html

Once I grant access to my audio microphone in my Chrome browser, using the Audio API, is there a way to: 在我的Chrome浏览器中授予对音频麦克风的访问权限后,使用音频API,有一种方法可以:

  1. Mute and un-mute the microphone? 将麦克风静音和取消静音?
  2. Manually changing the microphone volume from JavaScript? 从JavaScript手动更改麦克风音量?
  3. An Audio API function returning a Boolean flag (or any object) letting me know if the microphone is inaccessible (not working)? 一个Audio API函数返回一个布尔标志(或任何对象),让我知道麦克风是否不可访问(不工作)?

I have found a few links on StackOverflow, but they have not given me the key information that I can use for my need: 我在StackOverflow上找到了一些链接,但他们没有向我提供我可以根据需要使用的关键信息:

1) Just run the MediaStreamSource node through a Gain node, and set gain to 0 or 1 to mute or unmute. 1)只需通过Gain节点运行MediaStreamSource节点,并将gain设置为0或1以静音或取消静音。

2) Ditto. 2)同上。 Just use the same gain node. 只需使用相同的增益节点。

3) Not really - what do you mean by "not working"? 3)不是真的 - “不工作”是什么意思? If it's really not working, you'll never get the stream. 如果它真的不起作用,你永远不会得到流。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM