connectivity handling, audio publishing

This commit is contained in:
David Zhao
2021-08-04 10:59:41 -07:00
parent aec2003140
commit 593890331e
14 changed files with 208 additions and 33 deletions
+12 -2
View File
@@ -11,16 +11,26 @@ class PCTransport {
Future<void> setRemoteDescription(RTCSessionDescription sd) async {
await pc.setRemoteDescription(sd);
Future.forEach<RTCIceCandidate>(pendingCandidates, (candidate) async {
await Future.forEach<RTCIceCandidate>(pendingCandidates, (candidate) async {
await pc.addCandidate(candidate);
});
pendingCandidates.clear();
restartingIce = false;
}
Future<void> addIceCandidate(RTCIceCandidate candidate) async {
var desc = await pc.getRemoteDescription();
var desc = await getRemoteDescription();
if (desc != null && !restartingIce) {
return pc.addCandidate(candidate);
}
pendingCandidates.add(candidate);
}
Future<RTCSessionDescription?> getRemoteDescription() async {
if (pc.iceConnectionState == null) {
return null;
}
return pc.getRemoteDescription();
}
}