# Simulcast control

**URL:** <https://mediasoup.discourse.group/t/simulcast-control/5728>\
**Category:** mediasoup libraries\
**Created:** [December 13, 2023, 10:18am UTC](https://mediasoup.discourse.group/t/simulcast-control/5728 "2023-12-13T10:18:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Staerwrathn](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/staerwrathn/32/2329_2.png) [@Staerwrathn](https://mediasoup.discourse.group/u/Staerwrathn)\
**Post date:** [December 13, 2023, 10:18am UTC](https://mediasoup.discourse.group/t/simulcast-control/5728/1 "2023-12-13T10:18:45Z")

</div>

Hello,

I am trying the simulcast feature and I was wondering how it was controlled

So on the producer (client) side, I set an array of `RTCRtpEncodingParameters` in the `encodings` property of the `ProducerOptions`.

But then is there anything else that should be done?

I see that there is the preferedLayer option on the consumer side but it’s optional and will take the highest by default, which is fine.

But then how will the consumers “know” when to swap to swap layers? Is it based on the `maxOutgoingBitrate` of the transport? Is it based on the available bitrate?

Or should/can I manually decide, on the consumer in which conditions (or when) to change layer?

---

<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 13, 2023, 10:38am UTC](https://mediasoup.discourse.group/t/simulcast-control/5728/2 "2023-12-13T10:38:14Z")

</div>

Preferred layers in the consumer will set maximum layers the consumer should receive. Then mediasoup will decide which layers will be sent to the endpoint based on estimated bandwidth (it will try to honor preferred layers if there is enough bandwidth for them, assuming that the producer is generating those layers).

---

<div class="post-metadata">

**Author:** ![Staerwrathn](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/staerwrathn/32/2329_2.png) [@Staerwrathn](https://mediasoup.discourse.group/u/Staerwrathn)\
**Post date:** [December 13, 2023, 11:50am UTC](https://mediasoup.discourse.group/t/simulcast-control/5728/3 "2023-12-13T11:50:37Z")

</div>

Thanks for the clarification,

so there is nothing more to do that declaring the layers on the producer options except if I want to set a preferred layer, and it should just work out of the box? That sounds great.

> Then mediasoup will decide which layers will be sent to the endpoint based on estimated bandwidth (it will try to honor preferred layers if there is enough bandwidth for them

So if I set a maximum outgoing bitrate on the sending RTC transport on the server, all the consumers on that transport will adapt to respect that bitrate cap?

---

<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 13, 2023, 12:22pm UTC](https://mediasoup.discourse.group/t/simulcast-control/5728/4 "2023-12-13T12:22:39Z")

</div>

> [@Staerwrathn](#):
>
> So if I set a maximum outgoing bitrate on the sending RTC transport on the server, all the consumers on that transport will adapt to respect that bitrate cap?

Yes, as the documentation of that method says.
