Mediasoup Demo: the video producer is being closed instead of just pausing it.

Hi here,
I’m just curious. I saw code in mediasoup demo turning off the webcam, the video producer is being closed instead of just pausing it but for audio producer is being paused. what is the reason?

This is the most common use case if we turn off audio and then turn on we want our audio to be reached to other users immediately.

Now if we close the audio producer instead of pausing, then it will give a little delay because it will have to create all that stuff for audio again from start.

But if we pause it and then resume it then it is just a matter of milliseconds because everything is already setup we are just resuming the stream flow.

Incase of video we don’t need this immediate transmission and also it is considered a privacy issue if we keep the camera in use even if user have turned off the video.

You can close the audio producer as well i do it all the time, the delay is not much just 2-3 seconds but better is to keep it paused for ux.

1 Like

@zaidiqbalsoftech has the point,

But the demo is just a demo in order to show how the library can be used, and for self testing. You may want to do it in another way.

1 Like

Absolutely right.

Thank you! :smile: