addTransceiver method
Future<RTCRtpTransceiver>
addTransceiver({
- MediaStreamTrack? track,
- RTCRtpMediaType? kind,
- RTCRtpTransceiverInit? init,
override
'audio|video', { 'direction': 'recvonly|sendonly|sendrecv' }
Implementation
@override
Future<RTCRtpTransceiver> addTransceiver({
MediaStreamTrack? track,
RTCRtpMediaType? kind,
RTCRtpTransceiverInit? init,
}) async {
final jsTrack = track is MediaStreamTrackWeb ? track.jsTrack : null;
final kindString = kind != null ? typeRTCRtpMediaTypetoString[kind] : null;
final trackOrKind = jsTrack ?? kindString;
assert(trackOrKind != null, 'track or kind must not be null');
final transceiver = jsutil.callMethod(
_jsPc,
'addTransceiver',
[
trackOrKind,
if (init != null) init.toJsObject(),
],
);
return RTCRtpTransceiverWeb.fromJsObject(
transceiver,
peerConnectionId: _peerConnectionId,
);
}