@stream-io/video-client 1.19.2 → 1.19.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.
package/dist/index.es.js CHANGED
@@ -5644,7 +5644,7 @@ const aggregate = (stats) => {
5644
5644
  return report;
5645
5645
  };
5646
5646
 
5647
- const version = "1.19.2";
5647
+ const version = "1.19.3";
5648
5648
  const [major, minor, patch] = version.split('.');
5649
5649
  let sdkInfo = {
5650
5650
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7267,6 +7267,10 @@ class StreamSfuClient {
7267
7267
  * This is set to `true` when the user initiates the leave process.
7268
7268
  */
7269
7269
  this.isLeaving = false;
7270
+ /**
7271
+ * Flag to indicate if the client is in the process of closing the connection.
7272
+ */
7273
+ this.isClosing = false;
7270
7274
  this.pingIntervalInMs = 10 * 1000;
7271
7275
  this.unhealthyTimeoutInMs = this.pingIntervalInMs + 5 * 1000;
7272
7276
  /**
@@ -7318,6 +7322,7 @@ class StreamSfuClient {
7318
7322
  this.onSignalClose?.(`${e.code} ${e.reason}`);
7319
7323
  };
7320
7324
  this.close = (code = StreamSfuClient.NORMAL_CLOSURE, reason) => {
7325
+ this.isClosing = true;
7321
7326
  if (this.signalWs.readyState === WebSocket.OPEN) {
7322
7327
  this.logger('debug', `Closing SFU WS connection: ${code} - ${reason}`);
7323
7328
  this.signalWs.close(code, `js-client: ${reason}`);
@@ -10508,6 +10513,11 @@ class Call {
10508
10513
  */
10509
10514
  this.leaveCallHooks = new Set();
10510
10515
  this.streamClientEventHandlers = new Map();
10516
+ /**
10517
+ * Sets up the call instance.
10518
+ *
10519
+ * @internal an internal method and should not be used outside the SDK.
10520
+ */
10511
10521
  this.setup = async () => {
10512
10522
  await withoutConcurrency(this.joinLeaveConcurrencyTag, async () => {
10513
10523
  if (this.initialized)
@@ -11278,7 +11288,7 @@ class Call {
11278
11288
  callingState === CallingState.LEFT)
11279
11289
  return;
11280
11290
  // normal close, no need to reconnect
11281
- if (sfuClient.isLeaving)
11291
+ if (sfuClient.isLeaving || sfuClient.isClosing)
11282
11292
  return;
11283
11293
  this.reconnect(WebsocketReconnectStrategy.REJOIN, reason).catch((err) => {
11284
11294
  this.logger('warn', '[Reconnect] Error reconnecting', err);
@@ -11489,9 +11499,10 @@ class Call {
11489
11499
  this.sfuStatsReporter?.start();
11490
11500
  }
11491
11501
  });
11492
- this.leaveCallHooks.add(unregisterGoAway);
11493
- this.leaveCallHooks.add(unregisterOnError);
11494
- this.leaveCallHooks.add(unregisterNetworkChanged);
11502
+ this.leaveCallHooks
11503
+ .add(unregisterGoAway)
11504
+ .add(unregisterOnError)
11505
+ .add(unregisterNetworkChanged);
11495
11506
  };
11496
11507
  /**
11497
11508
  * Restores the published tracks after a reconnection.
@@ -13431,7 +13442,7 @@ class StreamClient {
13431
13442
  this.getUserAgent = () => {
13432
13443
  if (!this.cachedUserAgent) {
13433
13444
  const { clientAppIdentifier = {} } = this.options;
13434
- const { sdkName = 'js', sdkVersion = "1.19.2", ...extras } = clientAppIdentifier;
13445
+ const { sdkName = 'js', sdkVersion = "1.19.3", ...extras } = clientAppIdentifier;
13435
13446
  this.cachedUserAgent = [
13436
13447
  `stream-video-${sdkName}-v${sdkVersion}`,
13437
13448
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -13818,6 +13829,7 @@ class StreamVideoClient {
13818
13829
  call.state.updateFromCallResponse(c.call);
13819
13830
  await call.applyDeviceConfig(c.call.settings, false);
13820
13831
  if (data.watch) {
13832
+ await call.setup();
13821
13833
  this.writeableStateStore.registerCall(call);
13822
13834
  }
13823
13835
  calls.push(call);