How to get raw audio data in server-side mediasoup-client?

Is it possible to get raw opus-encoded audio data from peers in Node.js application?

I want to be able to get chunks of audio data in some kind of microservice and pass them into another javascript library (e.g. into Google Cloud Speech-to-Text like in this example)

As far as I can understand the only choice now is to use mediasoup-client-aiortc, connect to the mediasoup server, set up correct properties to get opus-encoded audio from peers, create transport, create consumers and access consumer.track.

However, I’m stuck here as I can’t find anything in MediaStreamTrack spec on how to get actual data.

Am I missing something? Thank you in advance!

You should consume in server side by using some external RTP stack. There are someones in JavaScript but I cannot recommend anyone.

Or wait for this to be implemented, but it will take long time: https://github.com/versatica/mediasoup/issues/433

1 Like