initialize static method
Initialize the WebRTC plugin. If this is not manually called, will be initialized with default settings.
This method can be called multiple times to reinitialize the WebRTC plugin with new parameters. When called after initial setup, it will automatically dispose all existing peer connections, tracks, and streams, then recreate the audio device module and peer connection factory with the new parameters.
Params:
"networkIgnoreMask": a list of AdapterType objects converted to string with .value
Android specific params:
"forceSWCodec": a boolean that forces software codecs to be used for video.
"forceSWCodecList": a list of strings of software codecs that should use software.
"androidAudioConfiguration": an AndroidAudioConfiguration object mapped with toMap()
"bypassVoiceProcessing": a boolean that bypasses the audio processing for the audio device.
"audioSampleRate": (Android only) Sets both input and output sample rate in Hz (e.g., 48000). If not specified, uses the native device's default sample rate.
"audioOutputSampleRate": (Android only) Sets only output sample rate in Hz (e.g., 48000). Takes precedence over audioSampleRate for output. If not specified, uses audioSampleRate or native default.
Implementation
static Future<void> initialize({Map<String, dynamic>? options}) async {
final reinitialize = (options?.containsKey('reinitialize') ?? false)
? options!['reinitialize']
: false;
if (!initialized || reinitialize) {
await _channel.invokeMethod<void>('initialize', <String, dynamic>{
'options': options ?? {},
});
initialized = true;
}
}