rtpForward method

Future<RtpForwarderCreated> rtpForward(
  1. dynamic roomId,
  2. String host,
  3. int port, {
  4. String? group,
  5. String? adminKey,
  6. String? ssrc,
  7. String? codec,
  8. String? ptype,
  9. int? srtpSuite,
  10. bool? alwaysOn,
  11. String? hostFamily,
  12. String? srtpCrypto,
})

rtpForward

You can add a new RTP forwarder for an existing room using the rtp_forward request.
roomId unique numeric ID of the room to add the forwarder to.
group to forward, if enabled in the room (forwards full mix if missing).
host address to forward the RTP packets to.
ssrc to use to use when streaming (optional: stream_id used if missing).
codec opus (default), pcma (A-Law) or pcmu (mu-Law).
hostFamily ipv4|ipv6, if we need to resolve the host address to an IP; by default, whatever we get.
port to forward the RTP packets to.
srtpSuite length of authentication tag (32 or 80); optional.
alwaysOn true|false, whether silence should be forwarded when the room is empty.
srtpCrypto key to use as crypto (base64 encoded key as in SDES); optional.
adminKey key to use if adminKey is set for rtp forward as well.

Implementation

Future<RtpForwarderCreated> rtpForward(dynamic roomId, String host, int port,
    {String? group, String? adminKey, String? ssrc, String? codec, String? ptype, int? srtpSuite, bool? alwaysOn, String? hostFamily, String? srtpCrypto}) async {
  var payload = {
    "request": "rtp_forward",
    "room": roomId,
    "admin_key": adminKey,
    "group": group,
    "ssrc": ssrc,
    "codec": codec,
    "ptype": ptype,
    "host": host,
    "host_family": hostFamily,
    "port": port,
    "srtp_suite": srtpSuite,
    "srtp_crypto": srtpCrypto,
    "always_on": alwaysOn
  }..removeWhere((key, value) => value == null);
  _handleRoomIdTypeDifference(payload);
  JanusEvent response = JanusEvent.fromJson(await this.send(data: payload));
  JanusError.throwErrorFromEvent(response);
  return RtpForwarderCreated.fromJson(response.plugindata?.data);
}