createOffer method

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

This method is used to create webrtc offer, sets local description on internal PeerConnection object It supports both style of offer creation that is plan-b and unified.

Implementation

Future<RTCSessionDescription> createOffer(
    {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);
    offerOptions = {
      "offerToReceiveAudio": audioRecv,
      "offerToReceiveVideo": videoRecv
    };
  }
  RTCSessionDescription offer =
      await webRTCHandle!.peerConnection!.createOffer(offerOptions ?? {});
  await webRTCHandle!.peerConnection!.setLocalDescription(offer);
  return offer;
}