@dtelecom/livekit-client 1.12.19 → 1.12.20

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.
@@ -14198,7 +14198,7 @@ function getMatch(exp, ua) {
14198
14198
  return match && match.length >= id && match[id] || '';
14199
14199
  }
14200
14200
 
14201
- var version$1 = "1.12.19";
14201
+ var version$1 = "1.12.20";
14202
14202
 
14203
14203
  const version = version$1;
14204
14204
  const protocolVersion = 9;
@@ -19516,16 +19516,19 @@ class RTCEngine extends EventEmitter {
19516
19516
  }
19517
19517
  this.setupSignalClientCallbacks();
19518
19518
  this.clientConfiguration = joinResponse.clientConfiguration;
19519
+ this.joinAttempts = 0;
19519
19520
  return joinResponse;
19520
19521
  } catch (e) {
19521
- if (e instanceof ConnectionError) {
19522
+ if (e instanceof ConnectionError && navigator.onLine === true) {
19522
19523
  if (e.reason === 1 /* ConnectionErrorReason.ServerUnreachable */) {
19523
- livekitLogger.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts, " of ").concat(this.maxJoinAttempts));
19524
- if (this.joinAttempts < this.maxJoinAttempts) {
19524
+ if (this.joinAttempts <= this.maxJoinAttempts) {
19525
+ yield sleep(220 * this.joinAttempts);
19526
+ livekitLogger.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts, " of ").concat(this.maxJoinAttempts));
19525
19527
  return this.join(url, token, opts, abortSignal);
19526
19528
  }
19527
19529
  }
19528
19530
  }
19531
+ this.joinAttempts = 0;
19529
19532
  throw e;
19530
19533
  }
19531
19534
  });
@@ -20015,7 +20018,7 @@ class RTCEngine extends EventEmitter {
20015
20018
  return null;
20016
20019
  }
20017
20020
  restartConnection(regionUrl) {
20018
- var _a, _b, _c, _d, _e;
20021
+ var _a, _b, _c, _d, _e, _f, _g;
20019
20022
  return __awaiter(this, void 0, void 0, function* () {
20020
20023
  try {
20021
20024
  if (!this.url || !this.token) {
@@ -20055,7 +20058,13 @@ class RTCEngine extends EventEmitter {
20055
20058
  // reconnect success
20056
20059
  this.emit(EngineEvent.Restarted);
20057
20060
  } catch (error) {
20058
- let nextRegionUrl = yield (_c = this.regionUrlProvider) === null || _c === void 0 ? void 0 : _c.getNextBestRegionUrl();
20061
+ // Check if browser is offline first - no point cycling regions if offline
20062
+ if (navigator.onLine === false) {
20063
+ (_c = this.regionUrlProvider) === null || _c === void 0 ? void 0 : _c.resetAttempts();
20064
+ (_d = this.fallbackUrlProvider) === null || _d === void 0 ? void 0 : _d.resetAttempts();
20065
+ throw error;
20066
+ }
20067
+ let nextRegionUrl = yield (_e = this.regionUrlProvider) === null || _e === void 0 ? void 0 : _e.getNextBestRegionUrl();
20059
20068
  if (this.fallbackUrlProvider && !nextRegionUrl) {
20060
20069
  nextRegionUrl = this.fallbackUrlProvider.getNextUrl();
20061
20070
  }
@@ -20064,8 +20073,8 @@ class RTCEngine extends EventEmitter {
20064
20073
  return;
20065
20074
  } else {
20066
20075
  // no more regions to try (or we're not on cloud)
20067
- (_d = this.regionUrlProvider) === null || _d === void 0 ? void 0 : _d.resetAttempts();
20068
- (_e = this.fallbackUrlProvider) === null || _e === void 0 ? void 0 : _e.resetAttempts();
20076
+ (_f = this.regionUrlProvider) === null || _f === void 0 ? void 0 : _f.resetAttempts();
20077
+ (_g = this.fallbackUrlProvider) === null || _g === void 0 ? void 0 : _g.resetAttempts();
20069
20078
  throw error;
20070
20079
  }
20071
20080
  }