createNullableAnswer method

Future<RTCSessionDescription?> createNullableAnswer({
  1. bool audioRecv = true,
  2. bool videoRecv = true,
  3. bool audioSend = true,
  4. bool videoSend = true,
})

Implementation

Future<RTCSessionDescription?> createNullableAnswer(
    {bool audioRecv: true,
    bool videoRecv: true,
    bool audioSend: true,
    bool videoSend: true}) async {
  dynamic offerOptions;
  if (_context._isUnifiedPlan && !_context._usePlanB) {
    await _prepareTranscievers(
        audioRecv: audioRecv,
        audioSend: audioSend,
        videoRecv: videoRecv,
        videoSend: videoSend);
  } else {
    offerOptions = {
      "offerToReceiveAudio": audioRecv,
      "offerToReceiveVideo": videoRecv
    };
  }
  try {
    RTCSessionDescription offer =
        await webRTCHandle!.peerConnection!.createAnswer(offerOptions ?? {});
    await webRTCHandle!.peerConnection!.setLocalDescription(offer);
    return offer;
  } catch (e) {
    return null;
  }
}