@stream-io/video-client 1.25.3 → 1.25.5

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
@@ -5811,7 +5811,7 @@ const aggregate = (stats) => {
5811
5811
  return report;
5812
5812
  };
5813
5813
 
5814
- const version = "1.25.3";
5814
+ const version = "1.25.5";
5815
5815
  const [major, minor, patch] = version.split('.');
5816
5816
  let sdkInfo = {
5817
5817
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7878,9 +7878,9 @@ class StreamSfuClient {
7878
7878
  return this.tracer?.take();
7879
7879
  };
7880
7880
  this.leaveAndClose = async (reason) => {
7881
- await this.joinTask;
7882
7881
  try {
7883
7882
  this.isLeaving = true;
7883
+ await this.joinTask;
7884
7884
  await this.notifyLeave(reason);
7885
7885
  }
7886
7886
  catch (err) {
@@ -12055,6 +12055,16 @@ class Call {
12055
12055
  const reconnectStartTime = Date.now();
12056
12056
  this.reconnectStrategy = strategy;
12057
12057
  this.reconnectReason = reason;
12058
+ const markAsReconnectingFailed = async () => {
12059
+ try {
12060
+ // attempt to fetch the call data from the server, as the call
12061
+ // state might have changed while we were reconnecting or were offline
12062
+ await this.get();
12063
+ }
12064
+ finally {
12065
+ this.state.setCallingState(CallingState.RECONNECTING_FAILED);
12066
+ }
12067
+ };
12058
12068
  let attempt = 0;
12059
12069
  do {
12060
12070
  const reconnectingTime = Date.now() - reconnectStartTime;
@@ -12062,7 +12072,7 @@ class Call {
12062
12072
  reconnectingTime / 1000 > this.disconnectionTimeoutSeconds;
12063
12073
  if (shouldGiveUpReconnecting) {
12064
12074
  this.logger('warn', '[Reconnect] Stopping reconnection attempts after reaching disconnection timeout');
12065
- this.state.setCallingState(CallingState.RECONNECTING_FAILED);
12075
+ await markAsReconnectingFailed();
12066
12076
  return;
12067
12077
  }
12068
12078
  // we don't increment reconnect attempts for the FAST strategy.
@@ -12103,7 +12113,7 @@ class Call {
12103
12113
  }
12104
12114
  if (error instanceof ErrorFromResponse && error.unrecoverable) {
12105
12115
  this.logger('warn', `[Reconnect] Can't reconnect due to coordinator unrecoverable error`, error);
12106
- this.state.setCallingState(CallingState.RECONNECTING_FAILED);
12116
+ await markAsReconnectingFailed();
12107
12117
  return;
12108
12118
  }
12109
12119
  await sleep(500);
@@ -12140,6 +12150,7 @@ class Call {
12140
12150
  this.reconnectStrategy = WebsocketReconnectStrategy.FAST;
12141
12151
  this.state.setCallingState(CallingState.RECONNECTING);
12142
12152
  await this.doJoin(this.joinCallData);
12153
+ await this.get(); // fetch the latest call state, as it might have changed
12143
12154
  this.sfuStatsReporter?.sendReconnectionTime(WebsocketReconnectStrategy.FAST, (Date.now() - reconnectStartTime) / 1000);
12144
12155
  };
12145
12156
  /**
@@ -14272,7 +14283,7 @@ class StreamClient {
14272
14283
  this.getUserAgent = () => {
14273
14284
  if (!this.cachedUserAgent) {
14274
14285
  const { clientAppIdentifier = {} } = this.options;
14275
- const { sdkName = 'js', sdkVersion = "1.25.3", ...extras } = clientAppIdentifier;
14286
+ const { sdkName = 'js', sdkVersion = "1.25.5", ...extras } = clientAppIdentifier;
14276
14287
  this.cachedUserAgent = [
14277
14288
  `stream-video-${sdkName}-v${sdkVersion}`,
14278
14289
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),