acceptCall method

  1. @override
Future<void> acceptCall([
  1. Map<String, String>? userInfo
])
override

Implementation

@override
Future<void> acceptCall([Map<String, String>? userInfo]) async {
  setState(RTCSessionState.RTC_SESSION_CONNECTING);
  cubeSdp.userInfo = userInfo;

  channels.forEach((opponentId, peerConnection) {
    CubeUser? currentUser = CubeChatConnection.instance.currentUser;

    if (opponentId == callerId) {
      peerConnection.startAnswer();
    } else if (opponentId < currentUser!.id!) {
      peerConnection.startOffer();
    } else if (peerConnection.hasRemoteSdp()) {
      peerConnection.startAnswer();
    }
  });
}