createOffer method

  1. @override
Future<RTCSessionDescription> createOffer([
  1. Map<String, dynamic>? constraints
])
override

Implementation

@override
Future<RTCSessionDescription> createOffer(
    [Map<String, dynamic>? constraints]) async {
  try {
    final response =
        await WebRTC.invokeMethod('createOffer', <String, dynamic>{
      'peerConnectionId': _peerConnectionId,
      'constraints': constraints ?? defaultSdpConstraints
    });

    String sdp = response['sdp'];
    String type = response['type'];
    return RTCSessionDescription(sdp, type);
  } on PlatformException catch (e) {
    throw 'Unable to RTCPeerConnection::createOffer: ${e.message}';
  }
}