teleportxr 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,10 +4,9 @@ const EventEmitter = require('events');
|
|
|
4
4
|
const wrtc =require('@roamhq/wrtc');
|
|
5
5
|
const DefaultRTCPeerConnection = require('@roamhq/wrtc').RTCPeerConnection;
|
|
6
6
|
|
|
7
|
-
const TIME_TO_CONNECTED =
|
|
7
|
+
const TIME_TO_CONNECTED = 30000;
|
|
8
8
|
const TIME_TO_HOST_CANDIDATES = 3000; // NOTE: Too long.
|
|
9
9
|
const TIME_TO_RECONNECTED = 1000;
|
|
10
|
-
|
|
11
10
|
function EVEN_ID(id) {
|
|
12
11
|
return (id-(id%2))
|
|
13
12
|
}
|
|
@@ -19,6 +18,15 @@ class WebRtcConnection extends EventEmitter
|
|
|
19
18
|
constructor(id, options = {})
|
|
20
19
|
{
|
|
21
20
|
super();
|
|
21
|
+
const iceServers=[
|
|
22
|
+
"stun:stun.l.google.com:19302"
|
|
23
|
+
];
|
|
24
|
+
this.iceServers = [] ;
|
|
25
|
+
for(const s in iceServers)
|
|
26
|
+
{
|
|
27
|
+
this.iceServers.push({ 'urls': iceServers[s] });
|
|
28
|
+
}
|
|
29
|
+
//this.iceServers=[{'urls': 'stun:stun.l.google.com:19302'}];
|
|
22
30
|
this.id = id;
|
|
23
31
|
this.state = 'open';
|
|
24
32
|
|
|
@@ -76,13 +84,14 @@ class WebRtcConnection extends EventEmitter
|
|
|
76
84
|
|
|
77
85
|
reconnect()
|
|
78
86
|
{
|
|
79
|
-
this.peerConnection =new DefaultRTCPeerConnection({ sdpSemantics: 'unified-plan'});
|
|
87
|
+
this.peerConnection =new DefaultRTCPeerConnection({ sdpSemantics: 'unified-plan', 'iceServers': this.iceServers});
|
|
80
88
|
this.beforeOffer();
|
|
81
89
|
let connectionTimer = this.options.setTimeout(() =>
|
|
82
90
|
{
|
|
83
91
|
if (this.peerConnection.iceConnectionState !== 'connected'
|
|
84
92
|
&& this.peerConnection.iceConnectionState !== 'completed')
|
|
85
93
|
{
|
|
94
|
+
console.log("WebRtcConnection timeout, this.peerConnection.iceConnectionState = "+this.peerConnection.iceConnectionState);
|
|
86
95
|
this.close();
|
|
87
96
|
}
|
|
88
97
|
}, this.options.timeToConnected);
|
|
@@ -127,7 +136,7 @@ class WebRtcConnection extends EventEmitter
|
|
|
127
136
|
this.peerConnection.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
|
|
128
137
|
this.peerConnection.addEventListener("icecandidateerror", (event) => {
|
|
129
138
|
|
|
130
|
-
console.log("ICE candidate error: "+
|
|
139
|
+
console.log("ICE candidate error: "+event.errorCode+" "+event.errorText+" "+event.port+" "+event.url);
|
|
131
140
|
});
|
|
132
141
|
|
|
133
142
|
const onConnectionStateChange = () =>
|
package/package.json
CHANGED