Mediasoup not respecting stopTracks: false

I’m either doing something wrong, or I found a bug.

I’m producing tracks this way:

 MyInfo.producers[source] = await MyInfo.transports.sending!.produce({
     stopTracks: false, // I tell mediasoup not to stop the tracks as per the docs https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions
     track: stream.getTracks()[0],
     appData: { source },
});

Despite passing stopTracks: false, when I call

    MyInfoStore.producers[source]?.pause();

The MediaTrack is stopped.

Paused does not mean stopped. Stopped means destroyed, completely.

Not exactly sure what you mean, but is there anyway to stop mediasoup from pausing tracks when .pause() is called?

Not sure what is not clear yet. A stopped track is destroyed. Forever. It will never play again.

A paused track is just paused (muted). You can resume it later.

Yes. Don’t call producer.pause() if you don’t want to pause it.

Mediasoup is Open Source, so you can just go straight to source and see what happens exactly when .pause() is called: https://github.com/versatica/mediasoup-client/blob/e295078983ba660804f61754397baca395f76873/src/Producer.ts#L281-L310

It doesn’t call track.stop() there, it just pauses video by disabling track (optionally replacing track with null to avoid any data being sent).

@nazar-pc @ibc

Thank you. After seeing the source, I understand. I think the docs are a bit unclear

Whether mediasoup-client should call stop() on tracks handled by this producer. If set to false , the app is responsible of stopping tracks given to transport.produce() or produce.replaceTrack() .

That implies that mediasoup will not manipulate the tracks at all (including pausing them). Maybe it should be clarified. I assumed that mediasoup just stop sending video data instead of pausing the stream when .pause() was called.

Honestly I don’t think you understand yet the difference between stopping and pausing a track. Please read the documentation of the MediaStreamTrack stop() method in the W3C site.