createOffer method
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;
}