consumer.on(“transportclose”, fn()) and consumer.on(“producerclose”, fn()) not firing on the server side consumer

I am listening to the events consumer.on(“ transportclose”, fn()) and consumer.on(“producerclose”, fn()) on server side consumer. These event are not firing when I close the browser. Is that means transports and producer are not closed on the browser? Are there any other way in mediasoup to know that client-side browser has been closed or media-stream has been stop for whatever reason?

No magic here. But you are assuming magic here.

Tell me why&how mediasoup server should detect that the user closed the browser.

Because in the document it is written that “Emitted when the associated producer is closed for whatever reason.” So closing browser would be a reason to emit the event.

No, that’s not a reason.

That mean to know the stream has been stopped by closing the browser or any other reason, I have to use my own singling method?

Yes.