OngoingCall constructor

OngoingCall(
  1. ChatId chatId,
  2. UserId me, {
  3. ChatCall? call,
  4. bool withAudio = true,
  5. bool withVideo = true,
  6. bool withScreen = false,
  7. MediaSettings? mediaSettings,
  8. OngoingCallState state = OngoingCallState.pending,
  9. ChatCallCredentials? creds,
  10. ChatCallDeviceId? deviceId,
})

Implementation

OngoingCall(
  ChatId chatId,
  UserId me, {
  ChatCall? call,
  bool withAudio = true,
  bool withVideo = true,
  bool withScreen = false,
  MediaSettings? mediaSettings,
  OngoingCallState state = OngoingCallState.pending,
  this.creds,
  this.deviceId,
}) : chatId = Rx(chatId),
     _me = CallMemberId(me, null),
     _preferredAudioDevice = mediaSettings?.audioDevice,
     _preferredOutputDevice = mediaSettings?.outputDevice,
     _preferredVideoDevice = mediaSettings?.videoDevice,
     _preferredScreenDevice = mediaSettings?.screenDevice,
     _noiseSuppression = RxnBool(mediaSettings?.noiseSuppression),
     _noiseSuppressionLevel = Rx(mediaSettings?.noiseSuppressionLevel),
     _echoCancellation = RxnBool(mediaSettings?.echoCancellation),
     _autoGainControl = RxnBool(mediaSettings?.autoGainControl),
     _highPassFilter = RxnBool(mediaSettings?.highPassFilter) {
  Log.debug(
    'OngoingCall($chatId) -> _me($_me), _preferredAudioDevice($_preferredAudioDevice), _preferredOutputDevice($_preferredOutputDevice), _preferredVideoDevice($_preferredVideoDevice), _preferredScreenDevice($_preferredScreenDevice), _noiseSuppression($_noiseSuppression), _noiseSuppressionLevel($_noiseSuppressionLevel), _echoCancellation($_echoCancellation), _autoGainControl($_autoGainControl), _highPassFilter($_highPassFilter)',
    '$runtimeType',
  );

  this.state = Rx<OngoingCallState>(state);
  this.call = Rx(call);

  members[_me] = CallMember.me(_me, isConnected: true);

  if (withAudio) {
    audioState = Rx(LocalTrackState.enabling);
  } else {
    audioState = Rx(LocalTrackState.disabled);
  }

  if (withVideo) {
    videoState = Rx(LocalTrackState.enabling);
  } else {
    videoState = Rx(LocalTrackState.disabled);
  }

  if (withScreen) {
    screenShareState = Rx(LocalTrackState.enabling);
  } else {
    screenShareState = Rx(LocalTrackState.disabled);
  }

  _stateWorker = ever(this.state, (state) {
    _participated = _participated || isActive;
  });
}