teleportxr 1.0.57 → 1.0.58

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.
@@ -134,11 +134,6 @@ class WebRtcConnection extends EventEmitter
134
134
 
135
135
  this.reconnectionTimer = null;
136
136
 
137
- this.peerConnection.addEventListener('iceconnectionstatechange', this._onIceConnectionStateChange);
138
- this.peerConnection.addEventListener('icegatheringstatechange', this._onIceGatheringStateChange);
139
- this.peerConnection.addEventListener("icecandidateerror", this._onIceCandidateError);
140
- this.peerConnection.addEventListener("connectionstatechange", this._onConnectionStateChange);
141
-
142
137
  this.onIceCandidate= ({ candidate })=>
143
138
  {
144
139
  if (!candidate)
@@ -153,6 +148,17 @@ class WebRtcConnection extends EventEmitter
153
148
  var message = '{"teleport-signal-type":"candidate","candidate":"'+candidate.candidate+'","mid":"'+mid.toString()+'","mlineindex":'+mlineindex.toString()+'}';
154
149
  this.sendConfigMessage(this.id,message);
155
150
  }
151
+
152
+ this.peerConnection.addEventListener('iceconnectionstatechange', this._onIceConnectionStateChange);
153
+ this.peerConnection.addEventListener('icegatheringstatechange', this._onIceGatheringStateChange);
154
+ this.peerConnection.addEventListener("icecandidateerror", this._onIceCandidateError);
155
+ this.peerConnection.addEventListener("connectionstatechange", this._onConnectionStateChange);
156
+ // Attach the icecandidate listener here, before doOffer can call
157
+ // setLocalDescription(). libwebrtc starts the ICE agent inside
158
+ // setLocalDescription() and emits host candidates synchronously on
159
+ // resolution; attaching this listener later (e.g. inside
160
+ // waitUntilIceGatheringStateComplete) silently loses those candidates.
161
+ this.peerConnection.addEventListener('icecandidate', this.onIceCandidate);
156
162
  this.waitUntilIceGatheringStateComplete= async (peerConnection, options) =>
157
163
  {
158
164
  if (peerConnection.iceGatheringState === 'complete')
@@ -193,7 +199,6 @@ class WebRtcConnection extends EventEmitter
193
199
  this.timeout = options.setTimeout(() => this.iceGatheringSettle(), timeToHostCandidates);
194
200
 
195
201
  peerConnection.addEventListener('icegatheringstatechange', onGatheringStateChange);
196
- peerConnection.addEventListener('icecandidate', this.onIceCandidate);
197
202
 
198
203
  await this.deferred.promise;
199
204
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "name": "teleportxr",
18
18
  "description": "Teleport Spatial Server on node.js",
19
- "version": "1.0.57",
19
+ "version": "1.0.58",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/simul/teleport-nodejs.git"