WebRTC and Google Chrome App - microphone volume adjustment

安稳与你 提交于 2019-12-12 03:32:21

问题


I'm trying to adjust microphone volume in Chrome App. Is is possible to do it? I'm using webrtc.


回答1:


It's possible

  • to use WebAudio and a gain filter to adjust the volume
  • to set the volume of an audio/video tag (on the receiving end)

Here is some sample code for the first option

var audioContext = new AudioContext();
var sourceStream = audioContext.createMediaStreamSource(yourStream);
var gain = audioContext.createGain();
sourceStream.connect(gain);
gain.value = 0.9;
gain.connect(audioContext.destination);

and then use audioContext.createMediaStreamDestination().stream. yourStream is the original stream that you got from getUserMedia().



来源:https://stackoverflow.com/questions/35361958/webrtc-and-google-chrome-app-microphone-volume-adjustment

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