I see. However I do not see the benefit of this and if we do this we should also emit producer.on('consumerclose'), producer.on('consumerlayerschange'), etc etc.
We need to emit producerpause in a Consumer because when a Producer is paused it affects to its Consumers. The opposite is not true.
So if you want to do something in the Producer when one of its Consumers is paused, you can do it at JS level within your application. No need to add it to mediasoup.
Indeed, they would be just convenience events that are definitely doable at app level.
But I could argue that the same is true for producerpause and producerresume not only because they are also doable at app level, but also because one needs to call producer.pause() and producer.resume() in order to trigger them. But I do agree that it’s not exactly the same case.
Right, good point. Consider that an exception. We try to never generate events that are triggered due to user actions. However, when the action is done on an entity and it affects other entities, we do generate events in those other entities.