createRoom method
- dynamic roomId, {
- bool permanent = true,
- String? description,
- String? secret,
- String? pin,
- int? defaultBitRate,
- int? defaultExpectedLoss,
- bool? isPrivate,
- bool? audioLevelExt,
- bool? audioLevelEvent,
- int? audioActivePackets,
- int? audioLevelAverage,
- List<
String> ? allowed, - bool? record,
- String? recordFile,
- String? recordDir,
- String? defaultPreBuffering,
- String? allowRtpParticipants,
- int? samplingRate,
- List<
String> ? groups, - bool? spatialAudio,
createRoom
this can be used to create a new audio room .
Notice that, in general, all users can create rooms. If you want to limit this functionality, you can configure an admin adminKey in the plugin settings. When configured, only "create" requests that include the correct adminKey value in an "adminKey" property will succeed, and will be rejected otherwise. Notice that you can optionally extend this functionality to RTP forwarding as well, in order to only allow trusted clients to use that feature.
roomId
: unique numeric ID, optional, chosen by plugin if missing.
permanent
: true|false, whether the room should be saved in the config file, default=false.
description
: pretty name of the room, optional.
secret
: password required to edit/destroy the room, optional.
pin
: password required to join the room, optional.
isPrivate
: true|false, whether the room should appear in a list request.
allowed
: array of string tokens users can use to join this room, optional.
samplingRate
: sampling rate of the room, optional, 16000 by default.
spatialAudio
: true|false, whether the mix should spatially place users, default=false.
audioLevelExt
: true|false, whether the ssrc-audio-level RTP extension must be negotiated for new joins, default=true.
audioLevelEvent
: true|false (whether to emit event to other users or not).
audioActivePackets
: number of packets with audio level (default=100, 2 seconds).
audioLevelAverage
: average value of audio level (127=muted, 0='too loud', default=25).
defaultPreBuffering
: number of packets to buffer before decoding each participant (default=DEFAULT_PREBUFFERING).
defaultExpectedLoss
: percent of packets we expect participants may miss, to help with FEC (default=0, max=20; automatically used for forwarders too).
defaultBitRate
: bitrate in bps to use for the all participants (default=auto, libopus decides; automatically used for forwarders too).
record
: true|false, whether to record the room or not, default=false.
recordFile
: /path/to/the/recording.wav, optional>.
recordDir
: /path/to/, optional; makes recordFile a relative path, if provided.
allowRtpParticipants
: true|false, whether participants should be allowed to join via plain RTP as well, default=false.
groups
: non-hierarchical array of string group names to use to gat participants, for external forwarding purposes only, optional.
Implementation
Future<AudioRoomCreatedResponse> createRoom(dynamic roomId,
{bool permanent = true,
String? description,
String? secret,
String? pin,
int? defaultBitRate,
int? defaultExpectedLoss,
bool? isPrivate,
bool? audioLevelExt,
bool? audioLevelEvent,
int? audioActivePackets,
int? audioLevelAverage,
List<String>? allowed,
bool? record,
String? recordFile,
String? recordDir,
String? defaultPreBuffering,
String? allowRtpParticipants,
int? samplingRate,
List<String>? groups,
bool? spatialAudio}) async {
var payload = {
"request": "create",
"room": roomId,
"permanent": permanent,
"description": description,
"secret": secret,
"pin": pin,
"default_bitrate": defaultBitRate,
"default_expectedloss": defaultExpectedLoss,
"is_private": isPrivate,
"allowed": allowed,
"sampling_rate": samplingRate,
"spatial_audio": spatialAudio,
"audiolevel_ext": audioLevelExt,
"audiolevel_event": audioLevelEvent,
"audio_active_packets": audioActivePackets,
"audio_level_average": audioLevelAverage,
"default_prebuffering": defaultPreBuffering,
"record": record,
"record_file": recordFile,
"record_dir": recordDir,
"allow_rtp_participants": allowRtpParticipants,
"groups": groups
}..removeWhere((key, value) => value == null);
_handleRoomIdTypeDifference(payload);
JanusEvent response = JanusEvent.fromJson(await this.send(data: payload));
JanusError.throwErrorFromEvent(response);
return AudioRoomCreatedResponse.fromJson(response.plugindata?.data);
}