Lib-jitsi-meet- Share chrome tab with audio

Hello devs give me a hand please, I would like to know how to make possible sharing a Chrome tab with audio (selecting the little checkbox in the Dialog of screens) to share the sound and video from the tab and also be able to turn on/turn off my mic. At the moment I can share the video, and I’m using replaceTrack method from the documentation lib-jitsi-meet API (low level) | Jitsi Meet to exchange the audio, using that Ii can share the tab’s audio correctly but the audioTrack of the mic it’s lost. What is the right way to proceed to accomplish the goal?.

You need to mix the 2 audio tracks locally in a new audio stream.

Hi saghul , thanks to respond. So I mixed the audios with the mixer:

  const mixer = JitsiMeetJS.createAudioMixer();
    mixer.addMediaStream(micAudio.stream as MediaStream); // access to stream property because the addMediaStream doesn't use JitsiLocalTrack

    mixer.addMediaStream(tabAudio.stream as MediaStream); // same as above
    const mixedStream = mixer.start(); 

This is right? After that I’m trying to use the mixedStream with the addTrack or replaceTrack methods but they don’t use MediaStream parameters, What do you think ?

Yep looks good. You then need to get the audio track out of that stream.

What do I have to do with the audio track of the mixed stream? I have the audio track:

const audioMixedTrack = mixedStream.getAudioTracks()[0]

I’m trying to add it to the conference (addTrack) or replaceTrack but it has no effect. It’s not a normal JitsilocalTrack , what step am I missing ?

You can use the setEffect API. Here is how we use it in Jitsi Meet: jitsi-meet/AudioMixerEffect.js at master · jitsi/jitsi-meet · GitHub