joinRoom method

Future<void> joinRoom(
  1. dynamic roomId, {
  2. dynamic id,
  3. String? group,
  4. String? pin,
  5. int? expectedLoss,
  6. String? display,
  7. String? token,
  8. bool? muted,
  9. String? codec,
  10. String? preBuffer,
  11. int? quality,
  12. int? volume,
  13. int? spatialPosition,
  14. String? secret,
  15. String? audioLevelAverage,
  16. String? audioActivePackets,
  17. bool? record,
  18. String? filename,
})

you use a join request to join an audio room, and wait for the joined event; this event will also include a list of the other participants, if any;

roomId : numeric ID of the room to join
id : unique ID to assign to the participant; optional, assigned by the plugin if missing
group : "group to assign to this participant (for forwarding purposes only; optional, mandatory if enabled in the room)
pin : "password required to join the room, if any; optional
display : "display name to have in the room; optional
token : "invitation token, in case the room has an ACL; optional
muted : true|false, whether to start unmuted or muted
codec : "codec to use, among opus (default), pcma (A-Law) or pcmu (mu-Law)
preBuffer : number of packets to buffer before decoding this participant (default=room value, or DEFAULT_PREBUFFERING)
bitrate : bitrate to use for the Opus stream in bps; optional, default=0 (libopus decides)
quality : 0-10, Opus-related complexity to use, the higher the value, the better the quality (but more CPU); optional, default is 4
expectedLoss : 0-20, a percentage of the expected loss (capped at 20%), only needed in case FEC is used; optional, default is 0 (FEC disabled even when negotiated) or the room default
volume : percent value, <100 reduces volume, >100 increases volume; optional, default is 100 (no volume change)
spatialPosition : in case spatial audio is enabled for the room, panning of this participant (0=left, 50=center, 100=right)
secret : "room management password; optional, if provided the user is an admin and can't be globally muted with mute_room
audioLevelAverage : "if provided, overrides the room audioLevelAverage for this user; optional
audioActivePackets : "if provided, overrides the room audioActivePackets for this user; optional
record : true|false, whether to record this user's contribution to a .mjr file (mixer not involved)
filename : "basename of the file to record to, -audio.mjr will be added by the plugin

Implementation

Future<void> joinRoom(dynamic roomId,
    {dynamic id,
    String? group,
    String? pin,
    int? expectedLoss,
    String? display,
    String? token,
    bool? muted,
    String? codec,
    String? preBuffer,
    int? quality,
    int? volume,
    int? spatialPosition,
    String? secret,
    String? audioLevelAverage,
    String? audioActivePackets,
    bool? record,
    String? filename}) async {
  Map<String, dynamic> payload = {
    "request": "join",
    "room": roomId,
    "id": id,
    "group": group,
    "pin": pin,
    "display": display,
    "token": token,
    "muted": muted,
    "codec": codec,
    "prebuffer": preBuffer,
    "expected_loss": expectedLoss,
    "quality": quality,
    "volume": volume,
    "spatial_position": spatialPosition,
    "secret": secret,
    "audio_level_average": audioLevelAverage,
    "audioActivePackets": audioActivePackets,
    "record": record,
    "filename": filename
  }..removeWhere((key, value) => value == null);
  _handleRoomIdTypeDifference(payload);
  JanusEvent response = JanusEvent.fromJson(await this.send(data: payload));
  JanusError.throwErrorFromEvent(response);
}