Search code examples
flutterwebrtcmediastreamflutter-webrtc

How to get audio volume (as stream) from WebRTC's MediaStream in Flutter?


I am using flutter mediasoup client to stream video+audio from the server. This works well in general.

However, I now want to measure audio level (ie, loud/soft) from the incoming audio stream so that I can display an audio level indicator widget.

The underlying stream is this webrtc class, but there doesn't seem to be any API to directly extract audio level.

I found this thread in flutter-webrtc repo, but it led to no concrete solution.

So, I wonder if anyone has had any success in extracting audio level from webrtc media stream.

Thank you.


Solution

  • I also posted this question in flutter-webrtc github repo and got a response that eventually led to a solution in my case:

    https://github.com/flutter-webrtc/flutter-webrtc/issues/833