瀏覽代碼

Add logging for ICE failed

RobinLinus 6 年之前
父節點
當前提交
b65dab968e
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      client/scripts/network.js

+ 5 - 1
client/scripts/network.js

@@ -244,7 +244,7 @@ class RTCPeer extends Peer {
         this._conn = new RTCPeerConnection(RTCPeer.config);
         this._conn.onicecandidate = e => this._onIceCandidate(e);
         this._conn.onconnectionstatechange = e => this._onConnectionStateChange(e);
-        this._conn.oniceconnectionstatechange = e => console.log(e);
+        this._conn.oniceconnectionstatechange = e => this._onIceConnectionStateChange(e);
     }
 
     _openChannel() {
@@ -306,6 +306,10 @@ class RTCPeer extends Peer {
         }
     }
 
+    _onIceConnectionStateChange(){
+        console.log('IceConnectionStateChange',this._conn.iceConnectionState);
+    }
+
     _onError(error) {
         console.error(error);
     }