createDataChannel method

  1. @override
Future<RTCDataChannel> createDataChannel(
  1. String label,
  2. RTCDataChannelInit dataChannelDict
)
override

Implementation

@override
Future<RTCDataChannel> createDataChannel(
    String label, RTCDataChannelInit dataChannelDict) {
  final map = dataChannelDict.toMap();
  if (dataChannelDict.binaryType == 'binary') {
    map['binaryType'] = 'arraybuffer'; // Avoid Blob in data channel
  }

  final jsDc = _jsPc.createDataChannel(label, map);
  return Future.value(RTCDataChannelWeb(jsDc));
}