handleSubscriberRenegotiation method
Future<void>
handleSubscriberRenegotiation(
{ - required String targetId,
- required String sdp,
})
override
Implementation
@override
Future<void> handleSubscriberRenegotiation({
required String targetId,
required String sdp,
}) async {
if (_subscribers[targetId]?.peerConnection == null) return;
final RTCPeerConnection pc = _subscribers[targetId]!.peerConnection;
final RTCSessionDescription remoteDescription = RTCSessionDescription(
sdp,
DescriptionType.offer.type,
);
await pc.setRemoteDescription(remoteDescription);
try {
final String ansSdp = await _createAnswer(pc);
final RTCSessionDescription localDescription = RTCSessionDescription(
ansSdp,
DescriptionType.answer.type,
);
await pc.setLocalDescription(localDescription);
_socketEmiter.answerEstablishSubscriber(targetId: targetId, sdp: ansSdp);
} catch (_) {}
}