Custom mediaStream for audio

I need to have a participant in a group AV call use a custom mediaStream that has been processed in a separate audioContext using some filters. How can I set this as the audio channel for the mediaStream in a small group call?


Hi @dangieschen,

If I understand correctly, you want to play some sort of audio to the callers that does not come from the microphone?

Yup, that’s the general idea. It’s a special mic that I need to split into 2 mono channels and only send one. My first thought was to add a video track to the mediaStream I’ve already got working and assign that to the default video HTML Element that’s already being used. I’m working on that now. See any potential issues?

The only issue would be if you needed more than 6 people in the call as video calls do not support as many audio only calls.

Great! that works. We probably don’t need more than 3-4 people max in a room. Thanks

I’m still hitting some snags. I can see where I can set the destination for the a stream here:

but is there a way to get access to the actual stream that’s coming in so I can split the stereo signal splitter, add some gainNodes to both mono signals, recombine them with a merger then set that as the audio source so I have the ability to mute/unmute each “side” separately? I have all of that code worked out I just can’t figure out how to get the actual MediaStream object that’s being sent from the remote participant. It seems like with the SDK I’m only able to provide a destination for the stream.


Also, I’m getting an error attempting to use more detailed constraints with useMedia().

The library JS show this as the signature:

export function useMedia(constraints: { audio: boolean; video: boolean }): MediaAccess | undefined;

However, we have a very specific request we need to make because we use specific hardware and have to access that specific device for our app to work. This is the code I’m trying to get working:

  audio: {
    deviceId: { exact: this._deviceId },
    channelCount: 2,
    echoCancellation: false,
    autoGainControl: false,
  video: true

I assume these constraints are just passed on to getUserMedia() so allowing a more detailed constraint object shouldn’t break anything I don’t think (unless that’s not what is actually going on under the hood of course).

More info on possible constraint values:

Any thoughts on this?

Thanks again!