I find the following solution from the mediasoup discourse group while I was searching solution to the same problem: either audio or video is sent to the consumer; I couldn’t send send both the video and audio to the consumer,
the solution doesn’t seem to work for my case;
try {
media_stream = await getUserMedia(mediaInputSource);
// console.log('media_stream :', media_stream)
const track = media_stream.getVideoTracks()[0];
const audioTrack = media_stream.getAudioTracks()[0];
const params = { track };
const params2 = { audioTrack };
if (chk_Simulcast.checked) {
params.encodings = [
{ maxBitrate: 100000 },
{ maxBitrate: 300000 },
{ maxBitrate: 900000 },
];
params.codecOptions = {
videoGoogleStartBitrate : 1000
};
}
videoProducer = await transport.produce(params);
audioProducer = await transport.produce(params2)
}
catch (err) {
publish_status.innerHTML = err;
}