livekit-client 2.6.1 → 2.6.3

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.
@@ -10401,10 +10401,11 @@ var ConnectionErrorReason;
10401
10401
  ConnectionErrorReason[ConnectionErrorReason["LeaveRequest"] = 4] = "LeaveRequest";
10402
10402
  })(ConnectionErrorReason || (ConnectionErrorReason = {}));
10403
10403
  class ConnectionError extends LivekitError {
10404
- constructor(message, reason, status) {
10404
+ constructor(message, reason, status, context) {
10405
10405
  super(1, message);
10406
10406
  this.status = status;
10407
10407
  this.reason = reason;
10408
+ this.context = context;
10408
10409
  }
10409
10410
  }
10410
10411
  class DeviceUnsupportedError extends LivekitError {
@@ -11176,7 +11177,7 @@ function getOSVersion(ua) {
11176
11177
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
11177
11178
  }
11178
11179
 
11179
- var version$1 = "2.6.1";
11180
+ var version$1 = "2.6.3";
11180
11181
 
11181
11182
  const version = version$1;
11182
11183
  const protocolVersion = 15;
@@ -12321,6 +12322,20 @@ function extractChatMessage(msg) {
12321
12322
  message
12322
12323
  };
12323
12324
  }
12325
+ function getDisconnectReasonFromConnectionError(e) {
12326
+ switch (e.reason) {
12327
+ case ConnectionErrorReason.LeaveRequest:
12328
+ return e.context;
12329
+ case ConnectionErrorReason.Cancelled:
12330
+ return DisconnectReason.CLIENT_INITIATED;
12331
+ case ConnectionErrorReason.NotAllowed:
12332
+ return DisconnectReason.USER_REJECTED;
12333
+ case ConnectionErrorReason.ServerUnreachable:
12334
+ return DisconnectReason.JOIN_FAILURE;
12335
+ default:
12336
+ return DisconnectReason.UNKNOWN_REASON;
12337
+ }
12338
+ }
12324
12339
 
12325
12340
  const defaultId = 'default';
12326
12341
  class DeviceManager {
@@ -12488,6 +12503,13 @@ class LocalTrack extends Track {
12488
12503
  var _a, _b;
12489
12504
  return (_b = (_a = this.processor) === null || _a === void 0 ? void 0 : _a.processedTrack) !== null && _b !== void 0 ? _b : this._mediaStreamTrack;
12490
12505
  }
12506
+ /**
12507
+ * @internal
12508
+ * returns mediaStreamTrack settings of the capturing mediastreamtrack source - ignoring processors
12509
+ */
12510
+ getSourceTrackSettings() {
12511
+ return this._mediaStreamTrack.getSettings();
12512
+ }
12491
12513
  setMediaStreamTrack(newTrack, force) {
12492
12514
  return __awaiter(this, void 0, void 0, function* () {
12493
12515
  if (newTrack === this._mediaStreamTrack && !force) {
@@ -13463,7 +13485,7 @@ class SignalClient {
13463
13485
  shouldProcessMessage = true;
13464
13486
  }
13465
13487
  } else if (this.isEstablishingConnection && resp.message.case === 'leave') {
13466
- reject(new ConnectionError('Received leave request while trying to (re)connect', ConnectionErrorReason.LeaveRequest));
13488
+ reject(new ConnectionError('Received leave request while trying to (re)connect', ConnectionErrorReason.LeaveRequest, undefined, resp.message.value.reason));
13467
13489
  } else if (!opts.reconnect) {
13468
13490
  // non-reconnect case, should receive join response first
13469
13491
  reject(new ConnectionError("did not receive join response, got ".concat((_c = resp.message) === null || _c === void 0 ? void 0 : _c.case, " instead"), ConnectionErrorReason.InternalError));
@@ -15194,7 +15216,8 @@ const publishDefaults = {
15194
15216
  const audioDefaults = {
15195
15217
  autoGainControl: true,
15196
15218
  echoCancellation: true,
15197
- noiseSuppression: true
15219
+ noiseSuppression: true,
15220
+ voiceIsolation: true
15198
15221
  };
15199
15222
  const videoDefaults = {
15200
15223
  resolution: VideoPresets.h720.resolution
@@ -18798,7 +18821,7 @@ class LocalTrackPublication extends TrackPublication {
18798
18821
  getTrackFeatures() {
18799
18822
  var _a;
18800
18823
  if (this.track instanceof LocalAudioTrack) {
18801
- const settings = this.track.mediaStreamTrack.getSettings();
18824
+ const settings = this.track.getSourceTrackSettings();
18802
18825
  const features = new Set();
18803
18826
  if (settings.autoGainControl) {
18804
18827
  features.add(AudioTrackFeature.TF_AUTO_GAIN_CONTROL);
@@ -21399,11 +21422,15 @@ class Room extends eventsExports.EventEmitter {
21399
21422
  this.recreateEngine();
21400
21423
  yield connectFn(resolve, reject, nextUrl);
21401
21424
  } else {
21402
- this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
21425
+ this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, getDisconnectReasonFromConnectionError(e));
21403
21426
  reject(e);
21404
21427
  }
21405
21428
  } else {
21406
- this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
21429
+ let disconnectReason = DisconnectReason.UNKNOWN_REASON;
21430
+ if (e instanceof ConnectionError) {
21431
+ disconnectReason = getDisconnectReasonFromConnectionError(e);
21432
+ }
21433
+ this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, disconnectReason);
21407
21434
  reject(e);
21408
21435
  }
21409
21436
  }