问题
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