onCallStateChanged method

Future<void> onCallStateChanged(
  1. CallSession call,
  2. CallState state
)

Implementation

Future<void> onCallStateChanged(CallSession call, CallState state) async {
  final audioMuted = localUserMediaStream?.isAudioMuted() ?? true;
  if (call.localUserMediaStream != null &&
      call.isMicrophoneMuted != audioMuted) {
    await call.setMicrophoneMuted(audioMuted);
  }

  final videoMuted = localUserMediaStream?.isVideoMuted() ?? true;

  if (call.localUserMediaStream != null &&
      call.isLocalVideoMuted != videoMuted) {
    await call.setLocalVideoMuted(videoMuted);
  }
}