onicecandidate method
void
onicecandidate(
- RTCIceCandidate? candidate
Implementation
void onicecandidate(RTCIceCandidate? candidate) async {
if (candidate == null || resourceURL == null) {
return;
}
log.debug('Sending candidate: ${candidate.toMap().toString()}');
try {
var respose = await httpPatch(Uri.parse(resourceURL!),
headers: {
'Content-Type': 'application/trickle-ice-sdpfrag',
if (headers != null) ...headers!
},
body: candidate.candidate);
log.debug('Received Patch response: ${respose.body}');
// TODO(cloudwebrtc): Add remote candidate to local pc.
} catch (e) {
log.error('connect error: $e');
setState(WhipState.kFailure);
lastError = e;
}
}