Using AudioLevelObserver with multiple routers

Hi,
I have a design question: when I use multiple routers, how can I monitor the audio level for a group of producers belonging to the same room and spanning different routers?
A simple solution could be creating only one AudioLevelObserver per router and adding all audio producers to it, tracking audio “level” events and sending them to the corresponding rooms. The drawback is that the “silence” event does not make sense because producers can be part of different rooms. It’s not clear to me if this approach could lead to some performance issues.

You can just create an AudioLevelObserver in each Router by adding all audio Producers belonging to the same “meta-room” into them, and then correlate “volume” events in all them.

I found an error in the documentation: https://mediasoup.org/documentation/v3/mediasoup/api/#rtpObserver-addProducer
The addProducer method requires a dictionary with producerId property set (https://github.com/versatica/mediasoup-demo/blob/56c369e43c92217aca082544c4c0603ac59d32d8/server/lib/Room.js#L603), but the Producer class has the id property, not producerId.

1 Like

Thanks, fixed.

Heyo.

How do you think one should go about “correlating” different ALOs?

I’m working on a similar problem that requires “aggregating” ALO states

Thanks!