# Mediasoup not respecting stopTracks: false

**URL:** <https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920>\
**Category:** mediasoup libraries\
**Created:** [October 23, 2020, 7:54pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920 "2020-10-23T19:54:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbis9051](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jbis9051](https://mediasoup.discourse.group/u/jbis9051)\
**Post date:** [October 23, 2020, 7:54pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/1 "2020-10-23T19:54:28Z")

</div>

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

I’m producing tracks this way:

```auto
 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

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

```

The MediaTrack is stopped.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [October 23, 2020, 8:07pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/2 "2020-10-23T20:07:12Z")

</div>

> [@jbis9051](#):
>
> ```auto
> MyInfoStore.producers[source]?.pause();
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![jbis9051](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jbis9051](https://mediasoup.discourse.group/u/jbis9051)\
**Post date:** [October 23, 2020, 9:06pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/3 "2020-10-23T21:06:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [October 23, 2020, 9:34pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/4 "2020-10-23T21:34:05Z")

</div>

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.

> [@jbis9051](#):
>
> is there anyway to stop mediasoup from pausing tracks when .pause() is called?

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

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [October 23, 2020, 10:26pm UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/5 "2020-10-23T22:26:46Z")

</div>

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](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).

---

<div class="post-metadata">

**Author:** ![jbis9051](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jbis9051](https://mediasoup.discourse.group/u/jbis9051)\
**Post date:** [October 24, 2020, 3:55am UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/6 "2020-10-24T03:55:50Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![ibc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ibc/32/1540_2.png) [@ibc](https://mediasoup.discourse.group/u/ibc)\
**Post date:** [October 24, 2020, 11:11am UTC](https://mediasoup.discourse.group/t/mediasoup-not-respecting-stoptracks-false/1920/7 "2020-10-24T11:11:37Z")

</div>

> [@jbis9051](#):
>
> 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.
