consumer#resume/pause not working as it should
Bug Report
Your environment
- Operating system: WSL Ubuntu
- Node version: 21.6.2
- npm version: 10.5.0
- gcc/clang version: GCC v11.4.0
- mediasoup version: 3.13.23
- mediasoup-client version: 3.7.6
Issue description
When a consumer is created with paused: true, toggling the paused state of the consumer subsequently does not change the state of the consumer. The code and logs can be seen below.
Code Snippet
async toggleConsumer(consumerId: string) {
const consumer = this.consumers[consumerId];
if (!consumer) throw new NotFoundException('Consumer not found');
this.logger.debug(`Consumer State before toggling: paused = ${consumer.paused}`);
if (consumer.paused) await consumer.resume();
await consumer.pause();
this.logger.debug(`Consumer State after toggling: paused = ${consumer.paused}`);
const ans = { paused: consumer.paused };
return ans;
}
Logs
if (consumer.paused) await consumer.resume(); await consumer.pause();
You are literally pausing it after resuming it so of course it will be paused.
No bug here. There are tons of unit tests about this.
if (consumer.paused) await consumer.resume(); await consumer.pause();
You are literally pausing it after resuming it so of course it will be paused.
No bug here. There are tons of unit tests about this.
Oh. I'm so sorry about this, I can't believe I didn't see that after looking at it over 10 times. Thanks.