livekit-client 2.15.11 → 2.15.13

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.
@@ -12601,7 +12601,7 @@ function getOSVersion(ua) {
12601
12601
  return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
12602
12602
  }
12603
12603
 
12604
- var version$1 = "2.15.11";
12604
+ var version$1 = "2.15.13";
12605
12605
 
12606
12606
  const version = version$1;
12607
12607
  const protocolVersion = 16;
@@ -13231,6 +13231,10 @@ function isFireFox() {
13231
13231
  var _a;
13232
13232
  return ((_a = getBrowser()) === null || _a === void 0 ? void 0 : _a.name) === 'Firefox';
13233
13233
  }
13234
+ function isChromiumBased() {
13235
+ const browser = getBrowser();
13236
+ return !!browser && browser.name === 'Chrome' && browser.os !== 'iOS';
13237
+ }
13234
13238
  function isSafari() {
13235
13239
  var _a;
13236
13240
  return ((_a = getBrowser()) === null || _a === void 0 ? void 0 : _a.name) === 'Safari';
@@ -14314,7 +14318,10 @@ class E2EEManager extends eventsExports.EventEmitter {
14314
14318
  if (!this.worker) {
14315
14319
  return;
14316
14320
  }
14317
- if (isScriptTransformSupported()) {
14321
+ if (isScriptTransformSupported() &&
14322
+ // Chrome occasionally throws an `InvalidState` error when using script transforms directly after introducing this API in 141.
14323
+ // Disabling it for Chrome based browsers until the API has stabilized
14324
+ !isChromiumBased()) {
14318
14325
  const options = {
14319
14326
  kind: 'decode',
14320
14327
  participantIdentity,
@@ -14381,7 +14388,10 @@ class E2EEManager extends eventsExports.EventEmitter {
14381
14388
  if (!((_a = this.room) === null || _a === void 0 ? void 0 : _a.localParticipant.identity) || this.room.localParticipant.identity === '') {
14382
14389
  throw TypeError('local identity needs to be known in order to set up encrypted sender');
14383
14390
  }
14384
- if (isScriptTransformSupported()) {
14391
+ if (isScriptTransformSupported() &&
14392
+ // Chrome occasionally throws an `InvalidState` error when using script transforms directly after introducing this API in 141.
14393
+ // Disabling it for Chrome based browsers until the API has stabilized
14394
+ !isChromiumBased()) {
14385
14395
  livekitLogger.info('initialize script transform');
14386
14396
  const options = {
14387
14397
  kind: 'encode',
@@ -14797,11 +14807,13 @@ class SignalClient {
14797
14807
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
14798
14808
  var _a, _b;
14799
14809
  try {
14800
- const timeoutAbortController = new AbortController();
14801
- const signals = abortSignal ? [timeoutAbortController.signal, abortSignal] : [timeoutAbortController.signal];
14802
- const combinedAbort = AbortSignal.any(signals);
14803
- const abortHandler = event => __awaiter(this, void 0, void 0, function* () {
14804
- const target = event.currentTarget;
14810
+ let alreadyAborted = false;
14811
+ const abortHandler = eventOrError => __awaiter(this, void 0, void 0, function* () {
14812
+ if (alreadyAborted) {
14813
+ return;
14814
+ }
14815
+ alreadyAborted = true;
14816
+ const target = eventOrError instanceof Event ? eventOrError.currentTarget : eventOrError;
14805
14817
  const reason = getAbortReasonAsString(target, 'Abort handler called');
14806
14818
  // send leave if we have an active stream writer (connection is open)
14807
14819
  if (this.streamWriter && !this.isDisconnected) {
@@ -14812,12 +14824,16 @@ class SignalClient {
14812
14824
  } else {
14813
14825
  this.close();
14814
14826
  }
14815
- clearTimeout(wsTimeout);
14827
+ cleanupAbortHandlers();
14816
14828
  reject(target instanceof AbortSignal ? target.reason : target);
14817
14829
  });
14818
- combinedAbort.addEventListener('abort', abortHandler);
14830
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener('abort', abortHandler);
14831
+ const cleanupAbortHandlers = () => {
14832
+ clearTimeout(wsTimeout);
14833
+ abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', abortHandler);
14834
+ };
14819
14835
  const wsTimeout = setTimeout(() => {
14820
- timeoutAbortController.abort(new ConnectionError('room connection has timed out (signal)', ConnectionErrorReason.ServerUnreachable));
14836
+ abortHandler(new ConnectionError('room connection has timed out (signal)', ConnectionErrorReason.ServerUnreachable));
14821
14837
  }, opts.websocketTimeout);
14822
14838
  const handleSignalConnected = (connection, firstMessage) => {
14823
14839
  this.handleSignalConnected(connection, wsTimeout, firstMessage);
@@ -14900,8 +14916,9 @@ class SignalClient {
14900
14916
  handleSignalConnected(connection, firstMessageToProcess);
14901
14917
  resolve(validation.response);
14902
14918
  } catch (e) {
14903
- clearTimeout(wsTimeout);
14904
14919
  reject(e);
14920
+ } finally {
14921
+ cleanupAbortHandlers();
14905
14922
  }
14906
14923
  } finally {
14907
14924
  unlock();