In my project I have a WebRTC connection, whose audio stream I direct to the source element under the audio.
This is how I set it in code:
pc = new RTCPeerConnection(config);
// connect audio / video
pc.addEventListener('track', function (evt) {
if (evt.track.kind === 'video')
document.getElementById('video').srcObject = evt.streams[0];
else
document.getElementById('audio').srcObject = evt.streams[0];
});
And this is my HTML:
<audio controls>
<source id="audio">
</audio>
The audio is playing, but the volume control is disabled.
I tried to control the volume myself, using the volume attribute but it didn't change anything…
Is there a way to control audio's volume when it is received from WebRTC audio stream?