Explorar o código

add handler for 'closed' event of RTCPeerConnection.iceConnectionState

afrokick %!s(int64=6) %!d(string=hai) anos
pai
achega
ed4012447e
Modificáronse 1 ficheiros con 12 adicións e 1 borrados
  1. 12 1
      lib/negotiator.ts

+ 12 - 1
lib/negotiator.ts

@@ -147,7 +147,18 @@ class Negotiator {
       switch (peerConnection.iceConnectionState) {
         case "failed":
           util.log(
-            "iceConnectionState is disconnected, closing connections to " +
+            "iceConnectionState is failed, closing connections to " +
+            peerId
+          );
+          connection.emit(
+            ConnectionEventType.Error,
+            new Error("Negotiation of connection to " + peerId + " failed.")
+          );
+          connection.close();
+          break;
+        case "closed":
+          util.log(
+            "iceConnectionState is closed, closing connections to " +
             peerId
           );
           connection.emit(