# Producer.pause() still uploading streams

**URL:** <https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167>\
**Category:** mediasoup libraries\
**Created:** [July 26, 2019, 1:32pm UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167 "2019-07-26T13:32:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aetheon](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/aetheon/32/39_2.png) [@aetheon](https://mediasoup.discourse.group/u/aetheon)\
**Post date:** [July 26, 2019, 1:32pm UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/1 "2019-07-26T13:32:01Z")

</div>

Hi there,

When tuning off a camera/mic demo if I call [producer.pause](https://mediasoup.org/documentation/v3/mediasoup-client/api/#producer-pause) followed by the WS request to pause it [server side](https://mediasoup.org/documentation/v3/mediasoup/api/#producer-pause) I can still see network being used by the RTCOutboundRTPVideoStream.

The demo is (closing)[[https://github.com/versatica/mediasoup-demo/blob/a8f415cb0e792d39eb044b9d11df498f27535a19/app/lib/RoomClient.js#L1047](https://github.com/versatica/mediasoup-demo/blob/a8f415cb0e792d39eb044b9d11df498f27535a19/app/lib/RoomClient.js#L1047)] the producer which creates RTCOutboundRTPVideoStreams after turning off and on.

I’m using Chrome 75.

Question 1:  
By reading the documentation I would assume producer.pause() would stop using the network. Am I missing something here.

Question 2:  
When calling close() and recreating the producer, is it normal to several RTCOutboundRTPVideoStreams be shown in webrtc-internals?

Tks.

---

<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:** [July 26, 2019, 4:14pm UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/2 "2019-07-26T16:14:52Z")

</div>

> [@aetheon](#):
>
> Question 1:  
> By reading the documentation I would assume producer.pause() would stop using the network. Am I missing something here.

[producer.pause()](https://github.com/versatica/mediasoup-client/blob/v3/lib/Producer.js#L225) just sets the “paused” flag and calls `this._track.enabled = false`, which means that it will send much less bitrate and it will just send silence packets (if audio) or black frames (if video).

mediasoup-client does not mangle the SDPs to completely sending silence or black frames when pausing the Producer. It would be done but it’s an absolute pain we prefer not to deal with.

> [@aetheon](#):
>
> Question 2:  
> When calling close() and recreating the producer, is it normal to several RTCOutboundRTPVideoStreams be shown in webrtc-internals?

Yes, because it also shows the closed ones (which no longer have activity).

---

<div class="post-metadata">

**Author:** ![mkh](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/mkh/32/145_2.png) [@mkh](https://mediasoup.discourse.group/u/mkh)\
**Post date:** [August 7, 2019, 5:16am UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/3 "2019-08-07T05:16:41Z")

</div>

> [@ibc](#):
>
> [producer.pause()](https://github.com/versatica/mediasoup-client/blob/v3/lib/Producer.js#L225) just sets the “paused” flag and calls `this._track.enabled = false` , which means that it will send much less bitrate and it will just send silence packets (if audio) or black frames (if video).

Does it include `consumer.pause()` too? Unfortunately on Safari the video gets black after `consumer.pause()` even if the media player is paused before.

---

<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:** [August 7, 2019, 10:40am UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/4 "2019-08-07T10:40:07Z")

</div>

Yes, `consumer.pause()` in mediasoup-client also sets `this._track.enabled = false`.

If this is a problem for you you can just avoid calling `consumer.pause()`in the client, but IMHO yours is a problem at UI level. IMHO disabling the remote track when “pausing” it is a good practice since it avoids such a track from being rendered/played. Anyway it’s a bit unnecessary since no RTP will be received if you also call `pause()` in the server side Consumer (or its associated Producer).

---

<div class="post-metadata">

**Author:** ![mkh](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/mkh/32/145_2.png) [@mkh](https://mediasoup.discourse.group/u/mkh)\
**Post date:** [August 7, 2019, 12:38pm UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/5 "2019-08-07T12:38:10Z")

</div>

Not calling `consumer.pause()` in the client fixed the problem 👌.  
I think it’s a bug with Safari since I’m using the native media player.

---

<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:** [December 2, 2019, 11:10pm UTC](https://mediasoup.discourse.group/t/producer-pause-still-uploading-streams/167/6 "2019-12-02T23:10:51Z")

</div>


