'Get decibels of a stream captured by navigator.mediaDevices.getUserMedia

I'm trying to make a webrtc application and I need to know when the user is talking so I can show other users that I'm talking. For capturing the microphone I use this code:

localStream = await navigator.mediaDevices.getUserMedia({ video: false, audio: true })

And I send the localStream to other users using peerjs. I have the stream. I need a way of detecting when the user is talking.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source