applyCallSettings method

  1. @override
Future<void> applyCallSettings(
  1. CallSetting setting
)
override

Implementation

@override
Future<void> applyCallSettings(CallSetting setting) async {
  if (_callSetting.videoQuality == setting.videoQuality) {
    if (_callSetting.e2eeEnabled != setting.e2eeEnabled) {
      await _enableEncryption(setting.e2eeEnabled);
    }

    _callSetting = setting;

    return;
  }

  _callSetting = setting;

  if (_localStream == null || _mParticipant == null) return;

  final MediaStream? newStream = await _getUserMedia(onlyStream: true);

  await _replaceMediaStream(newStream);

  if (!(_mParticipant?.isVideoEnabled ?? true)) {
    await toggleVideo(forceValue: _mParticipant?.isVideoEnabled);
  }

  if (!(_mParticipant?.isAudioEnabled ?? true)) {
    await toggleAudio(forceValue: _mParticipant?.isAudioEnabled);
  }
}