livekit-client 2.6.2 → 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.2";
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 {
@@ -13470,7 +13485,7 @@ class SignalClient {
13470
13485
  shouldProcessMessage = true;
13471
13486
  }
13472
13487
  } else if (this.isEstablishingConnection && resp.message.case === 'leave') {
13473
- 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));
13474
13489
  } else if (!opts.reconnect) {
13475
13490
  // non-reconnect case, should receive join response first
13476
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));
@@ -15201,7 +15216,8 @@ const publishDefaults = {
15201
15216
  const audioDefaults = {
15202
15217
  autoGainControl: true,
15203
15218
  echoCancellation: true,
15204
- noiseSuppression: true
15219
+ noiseSuppression: true,
15220
+ voiceIsolation: true
15205
15221
  };
15206
15222
  const videoDefaults = {
15207
15223
  resolution: VideoPresets.h720.resolution
@@ -21406,11 +21422,15 @@ class Room extends eventsExports.EventEmitter {
21406
21422
  this.recreateEngine();
21407
21423
  yield connectFn(resolve, reject, nextUrl);
21408
21424
  } else {
21409
- this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
21425
+ this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, getDisconnectReasonFromConnectionError(e));
21410
21426
  reject(e);
21411
21427
  }
21412
21428
  } else {
21413
- 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);
21414
21434
  reject(e);
21415
21435
  }
21416
21436
  }