livekit-client 2.6.0 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  2. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  3. package/dist/livekit-client.esm.mjs +22 -15
  4. package/dist/livekit-client.esm.mjs.map +1 -1
  5. package/dist/livekit-client.umd.js +1 -1
  6. package/dist/livekit-client.umd.js.map +1 -1
  7. package/dist/src/api/SignalClient.d.ts.map +1 -1
  8. package/dist/src/room/PCTransportManager.d.ts.map +1 -1
  9. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  10. package/dist/src/room/RegionUrlProvider.d.ts.map +1 -1
  11. package/dist/src/room/Room.d.ts.map +1 -1
  12. package/dist/src/room/errors.d.ts +2 -2
  13. package/dist/src/room/errors.d.ts.map +1 -1
  14. package/dist/src/room/track/LocalTrack.d.ts +5 -0
  15. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  16. package/dist/src/room/track/RemoteAudioTrack.d.ts +1 -1
  17. package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
  18. package/dist/src/room/track/RemoteVideoTrack.d.ts +2 -1
  19. package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
  20. package/dist/ts4.2/src/room/errors.d.ts +2 -2
  21. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +5 -0
  22. package/dist/ts4.2/src/room/track/RemoteAudioTrack.d.ts +1 -1
  23. package/dist/ts4.2/src/room/track/RemoteVideoTrack.d.ts +2 -1
  24. package/package.json +1 -1
  25. package/src/api/SignalClient.ts +19 -3
  26. package/src/room/PCTransportManager.ts +6 -1
  27. package/src/room/RTCEngine.ts +13 -3
  28. package/src/room/RegionUrlProvider.ts +3 -1
  29. package/src/room/Room.ts +8 -3
  30. package/src/room/errors.ts +2 -2
  31. package/src/room/track/LocalTrack.ts +8 -0
  32. package/src/room/track/LocalTrackPublication.ts +1 -1
  33. package/src/room/track/RemoteAudioTrack.ts +1 -1
  34. package/src/room/track/RemoteVideoTrack.ts +1 -1
@@ -11176,7 +11176,7 @@ function getOSVersion(ua) {
11176
11176
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11177
11177
  }
11178
11178
 
11179
- var version$1 = "2.6.0";
11179
+ var version$1 = "2.6.2";
11180
11180
 
11181
11181
  const version = version$1;
11182
11182
  const protocolVersion = 15;
@@ -12488,6 +12488,13 @@ class LocalTrack extends Track {
12488
12488
  var _a, _b;
12489
12489
  return (_b = (_a = this.processor) === null || _a === void 0 ? void 0 : _a.processedTrack) !== null && _b !== void 0 ? _b : this._mediaStreamTrack;
12490
12490
  }
12491
+ /**
12492
+ * @internal
12493
+ * returns mediaStreamTrack settings of the capturing mediastreamtrack source - ignoring processors
12494
+ */
12495
+ getSourceTrackSettings() {
12496
+ return this._mediaStreamTrack.getSettings();
12497
+ }
12491
12498
  setMediaStreamTrack(newTrack, force) {
12492
12499
  return __awaiter(this, void 0, void 0, function* () {
12493
12500
  if (newTrack === this._mediaStreamTrack && !force) {
@@ -13380,11 +13387,11 @@ class SignalClient {
13380
13387
  const abortHandler = () => __awaiter(this, void 0, void 0, function* () {
13381
13388
  this.close();
13382
13389
  clearTimeout(wsTimeout);
13383
- reject(new ConnectionError('room connection has been cancelled (signal)'));
13390
+ reject(new ConnectionError('room connection has been cancelled (signal)', ConnectionErrorReason.Cancelled));
13384
13391
  });
13385
13392
  const wsTimeout = setTimeout(() => {
13386
13393
  this.close();
13387
- reject(new ConnectionError('room connection has timed out (signal)'));
13394
+ reject(new ConnectionError('room connection has timed out (signal)', ConnectionErrorReason.ServerUnreachable));
13388
13395
  }, opts.websocketTimeout);
13389
13396
  if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
13390
13397
  abortHandler();
@@ -13466,7 +13473,7 @@ class SignalClient {
13466
13473
  reject(new ConnectionError('Received leave request while trying to (re)connect', ConnectionErrorReason.LeaveRequest));
13467
13474
  } else if (!opts.reconnect) {
13468
13475
  // non-reconnect case, should receive join response first
13469
- reject(new ConnectionError("did not receive join response, got ".concat((_c = resp.message) === null || _c === void 0 ? void 0 : _c.case, " instead")));
13476
+ reject(new ConnectionError("did not receive join response, got ".concat((_c = resp.message) === null || _c === void 0 ? void 0 : _c.case, " instead"), ConnectionErrorReason.InternalError));
13470
13477
  }
13471
13478
  if (!shouldProcessMessage) {
13472
13479
  return;
@@ -13479,7 +13486,7 @@ class SignalClient {
13479
13486
  });
13480
13487
  this.ws.onclose = ev => {
13481
13488
  if (this.isEstablishingConnection) {
13482
- reject(new ConnectionError('Websocket got closed during a (re)connection attempt'));
13489
+ reject(new ConnectionError('Websocket got closed during a (re)connection attempt', ConnectionErrorReason.InternalError));
13483
13490
  }
13484
13491
  this.log.warn("websocket closed", Object.assign(Object.assign({}, this.logContext), {
13485
13492
  reason: ev.reason,
@@ -15478,7 +15485,7 @@ class PCTransportManager {
15478
15485
  abortController === null || abortController === void 0 ? void 0 : abortController.signal.addEventListener('abort', abortHandler);
15479
15486
  const connectTimeout = CriticalTimers.setTimeout(() => {
15480
15487
  abortController === null || abortController === void 0 ? void 0 : abortController.signal.removeEventListener('abort', abortHandler);
15481
- reject(new ConnectionError('could not establish pc connection'));
15488
+ reject(new ConnectionError('could not establish pc connection', ConnectionErrorReason.InternalError));
15482
15489
  }, timeout);
15483
15490
  while (this.state !== PCTransportState.CONNECTED) {
15484
15491
  yield sleep(50); // FIXME we shouldn't rely on `sleep` in the connection paths, as it invokes `setTimeout` which can be drastically throttled by browser implementations
@@ -17009,7 +17016,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17009
17016
  return new Promise((resolve, reject) => {
17010
17017
  const publicationTimeout = setTimeout(() => {
17011
17018
  delete this.pendingTrackResolvers[req.cid];
17012
- reject(new ConnectionError('publication of local track timed out, no response from server'));
17019
+ reject(new ConnectionError('publication of local track timed out, no response from server', ConnectionErrorReason.InternalError));
17013
17020
  }, 10000);
17014
17021
  this.pendingTrackResolvers[req.cid] = {
17015
17022
  resolve: info => {
@@ -17556,7 +17563,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17556
17563
  } catch (e) {
17557
17564
  // TODO do we need a `failed` state here for the PC?
17558
17565
  this.pcState = PCState.Disconnected;
17559
- throw new ConnectionError("could not establish PC connection, ".concat(e.message));
17566
+ throw new ConnectionError("could not establish PC connection, ".concat(e.message), ConnectionErrorReason.InternalError);
17560
17567
  }
17561
17568
  });
17562
17569
  }
@@ -17588,7 +17595,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17588
17595
  const transport = subscriber ? _this2.pcManager.subscriber : _this2.pcManager.publisher;
17589
17596
  const transportName = subscriber ? 'Subscriber' : 'Publisher';
17590
17597
  if (!transport) {
17591
- throw new ConnectionError("".concat(transportName, " connection not set"));
17598
+ throw new ConnectionError("".concat(transportName, " connection not set"), ConnectionErrorReason.InternalError);
17592
17599
  }
17593
17600
  let needNegotiation = false;
17594
17601
  if (!subscriber && !_this2.dataChannelForKind(kind, subscriber)) {
@@ -17614,7 +17621,7 @@ class RTCEngine extends eventsExports.EventEmitter {
17614
17621
  }
17615
17622
  yield sleep(50);
17616
17623
  }
17617
- throw new ConnectionError("could not establish ".concat(transportName, " connection, state: ").concat(transport.getICEConnectionState()));
17624
+ throw new ConnectionError("could not establish ".concat(transportName, " connection, state: ").concat(transport.getICEConnectionState()), ConnectionErrorReason.InternalError);
17618
17625
  }();
17619
17626
  });
17620
17627
  }
@@ -17860,7 +17867,7 @@ class RegionUrlProvider {
17860
17867
  this.lastUpdateAt = Date.now();
17861
17868
  return regionSettings;
17862
17869
  } else {
17863
- throw new ConnectionError("Could not fetch region settings: ".concat(regionSettingsResponse.statusText), regionSettingsResponse.status === 401 ? ConnectionErrorReason.NotAllowed : undefined, regionSettingsResponse.status);
17870
+ throw new ConnectionError("Could not fetch region settings: ".concat(regionSettingsResponse.statusText), regionSettingsResponse.status === 401 ? ConnectionErrorReason.NotAllowed : ConnectionErrorReason.InternalError, regionSettingsResponse.status);
17864
17871
  }
17865
17872
  });
17866
17873
  }
@@ -18798,7 +18805,7 @@ class LocalTrackPublication extends TrackPublication {
18798
18805
  getTrackFeatures() {
18799
18806
  var _a;
18800
18807
  if (this.track instanceof LocalAudioTrack) {
18801
- const settings = this.track.mediaStreamTrack.getSettings();
18808
+ const settings = this.track.getSourceTrackSettings();
18802
18809
  const features = new Set();
18803
18810
  if (settings.autoGainControl) {
18804
18811
  features.add(AudioTrackFeature.TF_AUTO_GAIN_CONTROL);
@@ -21502,7 +21509,7 @@ class Room extends eventsExports.EventEmitter {
21502
21509
  } catch (err) {
21503
21510
  yield this.engine.close();
21504
21511
  this.recreateEngine();
21505
- const resultingError = new ConnectionError("could not establish signal connection");
21512
+ const resultingError = new ConnectionError("could not establish signal connection", ConnectionErrorReason.ServerUnreachable);
21506
21513
  if (err instanceof Error) {
21507
21514
  resultingError.message = "".concat(resultingError.message, ": ").concat(err.message);
21508
21515
  }
@@ -21518,7 +21525,7 @@ class Room extends eventsExports.EventEmitter {
21518
21525
  if (abortController.signal.aborted) {
21519
21526
  yield this.engine.close();
21520
21527
  this.recreateEngine();
21521
- throw new ConnectionError("Connection attempt aborted");
21528
+ throw new ConnectionError("Connection attempt aborted", ConnectionErrorReason.Cancelled);
21522
21529
  }
21523
21530
  try {
21524
21531
  yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout, abortController);
@@ -21565,7 +21572,7 @@ class Room extends eventsExports.EventEmitter {
21565
21572
  _this2.log.warn('abort connection attempt', _this2.logContext);
21566
21573
  (_a = _this2.abortController) === null || _a === void 0 ? void 0 : _a.abort();
21567
21574
  // in case the abort controller didn't manage to cancel the connection attempt, reject the connect promise explicitly
21568
- (_c = (_b = _this2.connectFuture) === null || _b === void 0 ? void 0 : _b.reject) === null || _c === void 0 ? void 0 : _c.call(_b, new ConnectionError('Client initiated disconnect'));
21575
+ (_c = (_b = _this2.connectFuture) === null || _b === void 0 ? void 0 : _b.reject) === null || _c === void 0 ? void 0 : _c.call(_b, new ConnectionError('Client initiated disconnect', ConnectionErrorReason.Cancelled));
21569
21576
  _this2.connectFuture = undefined;
21570
21577
  }
21571
21578
  // send leave