rtpForward method
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);
}