# How to implement simulcast?

**URL:** <https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623>\
**Category:** Help\
**Created:** [September 22, 2022, 10:55am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623 "2022-09-22T10:55:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![peeratattt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/peeratattt/32/573_2.png) [@peeratattt](https://react-native-webrtc.discourse.group/u/peeratattt)\
**Post date:** [September 22, 2022, 10:55am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/1 "2022-09-22T10:55:31Z")

</div>

i need to implement simulcast on react native webrtc, and set two size of video, i don’t found info for implement it

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [September 23, 2022, 8:43am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/2 "2022-09-23T08:43:37Z")

</div>

I’m not entirely sure if we’ve actually implemented that feature yet.  
We’re open to contributions though.

---

<div class="post-metadata">

**Author:** ![peeratattt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/peeratattt/32/573_2.png) [@peeratattt](https://react-native-webrtc.discourse.group/u/peeratattt)\
**Post date:** [September 26, 2022, 1:53am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/3 "2022-09-26T01:53:24Z")

</div>

Can you open to contributions?

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [September 26, 2022, 8:45am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/4 "2022-09-26T08:45:45Z")

</div>

I can see you’ve opened an issue on GitHub 👍  
For future reference we’re open to contributions over [here](https://github.com/react-native-webrtc/react-native-webrtc/).

---

<div class="post-metadata">

**Author:** ![peeratattt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/peeratattt/32/573_2.png) [@peeratattt](https://react-native-webrtc.discourse.group/u/peeratattt)\
**Post date:** [September 26, 2022, 9:00am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/5 "2022-09-26T09:00:20Z")

</div>

@8BallBomBom But i don’t receive info hahaha, what should we do?

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [September 26, 2022, 9:36am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/6 "2022-09-26T09:36:12Z")

</div>

I’m not entirely sure of all the specifics but theres an example [here](https://gist.github.com/hissinger/7dbd1fc2ddfc7a8df9a7094c1dc15bc5).

You also need to use [this](https://react-native-webrtc.discourse.group/t/announcing-react-native-webrtc-106-beta-with-unified-plan-support/1625) pre-release version of the RN WebRTC module as the new track and transceivers handling is required.

---

<div class="post-metadata">

**Author:** ![golgetahir](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/golgetahir/32/656_2.png) [@golgetahir](https://react-native-webrtc.discourse.group/u/golgetahir)\
**Post date:** [October 3, 2022, 9:59am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/7 "2022-10-03T09:59:26Z")

</div>

Hi @8BallBomBom

The related change you suggested does not update SDP, not sure but I think sendEncodings part is not implemented in the module for sending the simulcast.

I get something like:  
a=fmtp:122 apt=123  
a=rtpmap:125 ulpfec/90000  
a=ssrc-group:FID 2891755832 1645302191  
a=ssrc:2891755832 cname:SahDPJVJbchTmi20  
a=ssrc:2891755832 msid:a3b8d1d7-7ca0-4b46-9513-2c8199b9e020 87d2a85b-903b-4ab5-a660-dc7d8cd70341  
a=ssrc:1645302191 cname:SahDPJVJbchTmi20  
a=ssrc:1645302191 msid:a3b8d1d7-7ca0-4b46-9513-2c8199b9e020 87d2a85b-903b-4ab5-a660-dc7d8cd70341

But when you give the transreceiver options like that in chrome you see:

a=rtcp-fb:41 goog-remb  
a=rtcp-fb:41 transport-cc  
a=rtcp-fb:41 ccm fir  
a=rtcp-fb:41 nack  
a=rtcp-fb:41 nack pli  
a=rtpmap:42 rtx/90000  
a=fmtp:42 apt=41  
a=rtpmap:114 red/90000  
a=rtpmap:115 rtx/90000  
a=fmtp:115 apt=114  
a=rtpmap:116 ulpfec/90000  
a=rid:h send  
a=rid:m send  
a=rid:l send  
a=simulcast:send h;m;l

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 3, 2022, 12:46pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/8 "2022-10-03T12:46:24Z")

</div>

Thanks for the heads up, will look into it a bit more.

**Edit:**  
You are correct, sendEncodings doesn’t seem to be implemented as a transceiver init parameter.  
So as it stands support for **Simulcast** may not be fully there yet.  
But i haven’t tested to confirm.

That being said, there is an implementation of calling `setParameters` on the RTPSender.  
@golgetahir Can you test to confirm if that works?

---

<div class="post-metadata">

**Author:** ![golgetahir](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/golgetahir/32/656_2.png) [@golgetahir](https://react-native-webrtc.discourse.group/u/golgetahir)\
**Post date:** [October 3, 2022, 3:36pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/10 "2022-10-03T15:36:35Z")

</div>

@8BallBomBom Hi again,

Normally on web, that parameter is read-only and when you set the encodings with setParameters Uncaught (in promise) DOMException: Read-only field modified in setParameters().

In the react-native-webrtc, it actually set the parameter. However, it has no effect on SDP neither have more than one remote outbound video stream.

However, as an answer, manually changing the SDP seems to be working as I see more than one outbound RTP video streams on stats like the logs:

LOG {“active”: true, “bytesSent”: 1088396, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “frameHeight”: 720, “frameWidth”: 1280, “framesEncoded”: 218, “framesPerSecond”: 24, “framesSent”: 218, “headerBytesSent”: 22676, “hugeFramesSent”: 211, “id”: “RTCOutboundRTPVideoStream\_136728387”, “keyFramesEncoded”: 2, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 1039, “pliCount”: 14, “qpSum”: 4019, “qualityLimitationDurations”: {“bandwidth”: 9.288, “cpu”: 0, “none”: 0.21, “other”: 0}, “qualityLimitationReason”: “bandwidth”, “qualityLimitationResolutionChanges”: 1, “remoteId”: “RTCRemoteInboundRtpVideoStream\_136728387”, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “h”, “ssrc”: 136728387, “timestamp”: 1664809667089.581, “totalEncodeTime”: 5.756, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 358.002, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}  
LOG {“active”: true, “bytesSent”: 0, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “framesEncoded”: 0, “framesSent”: 0, “headerBytesSent”: 0, “hugeFramesSent”: 0, “id”: “RTCOutboundRTPVideoStream\_1651138696”, “keyFramesEncoded”: 0, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 0, “pliCount”: 0, “qualityLimitationDurations”: {“bandwidth”: 9.288, “cpu”: 0, “none”: 0.21, “other”: 0}, “qualityLimitationReason”: “bandwidth”, “qualityLimitationResolutionChanges”: 1, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “m”, “ssrc”: 1651138696, “timestamp”: 1664809667089.581, “totalEncodeTime”: 0, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 0, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}  
LOG {“active”: true, “bytesSent”: 0, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “framesEncoded”: 0, “framesSent”: 0, “headerBytesSent”: 244, “hugeFramesSent”: 0, “id”: “RTCOutboundRTPVideoStream\_808685676”, “keyFramesEncoded”: 0, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 1, “pliCount”: 0, “qualityLimitationDurations”: {“bandwidth”: 9.288, “cpu”: 0, “none”: 0.21, “other”: 0}, “qualityLimitationReason”: “bandwidth”, “qualityLimitationResolutionChanges”: 1, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “l”, “ssrc”: 808685676, “timestamp”: 1664809667089.581, “totalEncodeTime”: 0, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 0, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}

Can you confirm manually munging SDP to what I shared in my first comment is working ?

```
  let newSDP = ""
  let lines = offer.sdp.split('\n')
  for(let i = 0; i < lines.length; i++){
    if(lines[i].includes('a=ssrc-group:FID')){
      break;
    }
    newSDP += lines[i] + "\n";
  }
  newSDP += "a=rid:h send \n"+
            "a=rid:m send \n"+
            "a=rid:l send \n"+
            "a=simulcast:send h;m;l \n";
  offer.sdp = newSDP;
  console.log(offer)

```

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 3, 2022, 8:41pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/11 "2022-10-03T20:41:22Z")

</div>

No worries about the mobile development.  
Bit unusual, wasn’t aware that `setParameters` had any read only parameters.  
I’ll have a lookie, see if i can get things working and get back to you.

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 5, 2022, 9:12am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/12 "2022-10-05T09:12:05Z")

</div>

I can confirm the SDP Munging method does work but isn’t ideal.  
Currently going through testing an implementation of `sendEncodings`.  
Will report back soon.

---

<div class="post-metadata">

**Author:** ![golgetahir](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/golgetahir/32/656_2.png) [@golgetahir](https://react-native-webrtc.discourse.group/u/golgetahir)\
**Post date:** [October 5, 2022, 9:44am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/13 "2022-10-05T09:44:37Z")

</div>

If you need anything please feel free to ping me @8BallBomBom I can even help on development if I can but I’m not really experienced on mobile. 😆

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 5, 2022, 10:06am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/14 "2022-10-05T10:06:56Z")

</div>

Contributions are always appreciated 🙂

I’ve managed to get `sendEncodings` working on Android so far.  
Will be testing and looking to also get iOS nudged out 👍  
Once things have been pushed i’ll link the pull request and then hopefully it will be in the next release.

**Edit:**  
Tracked over [here](https://github.com/react-native-webrtc/react-native-webrtc/pull/1188) currently.

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 10, 2022, 1:27pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/15 "2022-10-10T13:27:51Z")

</div>

Thanks to Saghul for testing and fixing things up, should be included with the next release soon 👍

---

<div class="post-metadata">

**Author:** ![peeratattt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/peeratattt/32/573_2.png) [@peeratattt](https://react-native-webrtc.discourse.group/u/peeratattt)\
**Post date:** [October 10, 2022, 1:54pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/16 "2022-10-10T13:54:21Z")

</div>

Can you share example code for public simulcast? @8BallBomBom

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 11, 2022, 3:34am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/17 "2022-10-11T03:34:35Z")

</div>

I’ll be looking to provide example projects soon but i can confirm that the example posted [here](https://gist.github.com/hissinger/7dbd1fc2ddfc7a8df9a7094c1dc15bc5) will output the correct SDP once a new module release has gone out.

---

<div class="post-metadata">

**Author:** ![golgetahir](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/golgetahir/32/656_2.png) [@golgetahir](https://react-native-webrtc.discourse.group/u/golgetahir)\
**Post date:** [October 20, 2022, 8:40am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/18 "2022-10-20T08:40:47Z")

</div>

Thanks a lot @8BallBomBom I’ve seen the commit is merged and I’ve tried on Android, seems like it is working. The logs I gathered here:

LOG {“active”: true, “bytesSent”: 0, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “framesEncoded”: 0, “framesSent”: 0, “headerBytesSent”: 0, “hugeFramesSent”: 0, “id”: “RTCOutboundRTPVideoStream\_4131707387”, “keyFramesEncoded”: 0, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 0, “pliCount”: 0, “qualityLimitationDurations”: {“bandwidth”: 0.512, “cpu”: 0, “none”: 9.1, “other”: 0}, “qualityLimitationReason”: “none”, “qualityLimitationResolutionChanges”: 1, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “m”, “ssrc”: 4131707387, “timestamp”: 1666255083683.586, “totalEncodeTime”: 0, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 0, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}  
LOG {“active”: true, “bytesSent”: 0, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “framesEncoded”: 0, “framesSent”: 0, “headerBytesSent”: 244, “hugeFramesSent”: 0, “id”: “RTCOutboundRTPVideoStream\_468313530”, “keyFramesEncoded”: 0, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 1, “pliCount”: 0, “qualityLimitationDurations”: {“bandwidth”: 0.512, “cpu”: 0, “none”: 9.1, “other”: 0}, “qualityLimitationReason”: “none”, “qualityLimitationResolutionChanges”: 1, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “l”, “ssrc”: 468313530, “timestamp”: 1666255083683.586, “totalEncodeTime”: 0, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 0, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}  
LOG {“active”: true, “bytesSent”: 1438526, “codecId”: “RTCCodec\_0\_Outbound\_96”, “encoderImplementation”: “OMX.Exynos.VP8.Encoder”, “firCount”: 0, “frameHeight”: 720, “frameWidth”: 1280, “framesEncoded”: 209, “framesPerSecond”: 24, “framesSent”: 209, “headerBytesSent”: 45972, “hugeFramesSent”: 12, “id”: “RTCOutboundRTPVideoStream\_47212017”, “keyFramesEncoded”: 1, “kind”: “video”, “mediaSourceId”: “RTCVideoSource\_1”, “mediaType”: “video”, “mid”: “0”, “nackCount”: 0, “packetsSent”: 1554, “pliCount”: 0, “qpSum”: 7209, “qualityLimitationDurations”: {“bandwidth”: 0.512, “cpu”: 0, “none”: 9.1, “other”: 0}, “qualityLimitationReason”: “none”, “qualityLimitationResolutionChanges”: 1, “remoteId”: “RTCRemoteInboundRtpVideoStream\_47212017”, “retransmittedBytesSent”: 0, “retransmittedPacketsSent”: 0, “rid”: “h”, “ssrc”: 47212017, “timestamp”: 1666255083683.586, “totalEncodeTime”: 2.749, “totalEncodedBytesTarget”: 0, “totalPacketSendDelay”: 25.346, “trackId”: “DEPRECATED\_RTCMediaStreamTrack\_sender\_1”, “transportId”: “RTCTransport\_0\_1”, “type”: “outbound-rtp”}

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [October 20, 2022, 3:47pm UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/19 "2022-10-20T15:47:52Z")

</div>

Thanks for testing, fantastic news 😃

---

<div class="post-metadata">

**Author:** ![peeratattt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/peeratattt/32/573_2.png) [@peeratattt](https://react-native-webrtc.discourse.group/u/peeratattt)\
**Post date:** [December 2, 2022, 9:57am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/21 "2022-12-02T09:57:43Z")

</div>

how are you about example project?

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [December 2, 2022, 10:14am UTC](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623/22 "2022-12-02T10:14:04Z")

</div>

Sadly nothing yet.  
But there are still plans to provide a few example projects along with a signalling backend server.  
Best bet is to keep an eye over [here](https://github.com/react-native-webrtc/examples).

[Next page](https://react-native-webrtc.discourse.group/t/how-to-implement-simulcast/1623.md?page=2)
