Эх сурвалжийг харах

add handler for 'closed' event of RTCPeerConnection.iceConnectionState

afrokick 6 жил өмнө
parent
commit
ed4012447e
1 өөрчлөгдсөн 12 нэмэгдсэн , 1 устгасан
  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(