@stream-io/video-client 1.18.0 → 1.18.2

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
@@ -5711,7 +5711,9 @@ class Publisher extends BasePeerConnection {
5711
5711
  else {
5712
5712
  const previousTrack = transceiver.sender.track;
5713
5713
  await transceiver.sender.replaceTrack(trackToPublish);
5714
- this.stopTrack(previousTrack);
5714
+ if (!isReactNative()) {
5715
+ this.stopTrack(previousTrack);
5716
+ }
5715
5717
  }
5716
5718
  }
5717
5719
  };
@@ -5812,6 +5814,11 @@ class Publisher extends BasePeerConnection {
5812
5814
  }
5813
5815
  for (const track of this.clonedTracks) {
5814
5816
  this.stopTrack(track);
5817
+ // @ts-expect-error release() is present in react-native-webrtc
5818
+ if (track && typeof track.release === 'function') {
5819
+ // @ts-expect-error
5820
+ track.release();
5821
+ }
5815
5822
  }
5816
5823
  };
5817
5824
  this.changePublishQuality = async (videoSender) => {
@@ -7464,7 +7471,7 @@ const aggregate = (stats) => {
7464
7471
  return report;
7465
7472
  };
7466
7473
 
7467
- const version = "1.18.0";
7474
+ const version = "1.18.2";
7468
7475
  const [major, minor, patch] = version.split('.');
7469
7476
  let sdkInfo = {
7470
7477
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10625,8 +10632,12 @@ class Call {
10625
10632
  statsOptions = joinResponse.stats_options;
10626
10633
  }
10627
10634
  catch (error) {
10628
- // restore the previous call state if the join-flow fails
10629
- this.state.setCallingState(callingState);
10635
+ // prevent triggering reconnect flow if the state is OFFLINE
10636
+ const avoidRestoreState = this.state.callingState === CallingState.OFFLINE;
10637
+ if (!avoidRestoreState) {
10638
+ // restore the previous call state if the join-flow fails
10639
+ this.state.setCallingState(callingState);
10640
+ }
10630
10641
  throw error;
10631
10642
  }
10632
10643
  }
@@ -10909,7 +10920,8 @@ class Call {
10909
10920
  if (data?.ring) {
10910
10921
  this.ringingSubject.next(true);
10911
10922
  }
10912
- if (this.ringing && !this.isCreatedByMe) {
10923
+ const isReconnecting = this.reconnectStrategy !== WebsocketReconnectStrategy.UNSPECIFIED;
10924
+ if (!isReconnecting && this.ringing && !this.isCreatedByMe) {
10913
10925
  // signals other users that I have accepted the incoming call.
10914
10926
  await this.accept();
10915
10927
  }
@@ -10990,6 +11002,12 @@ class Call {
10990
11002
  break; // do-while loop, reconnection worked, exit the loop
10991
11003
  }
10992
11004
  catch (error) {
11005
+ if (this.state.callingState === CallingState.OFFLINE) {
11006
+ this.logger('trace', `[Reconnect] Can't reconnect while offline, stopping reconnection attempts`);
11007
+ break;
11008
+ // we don't need to handle the error if the call is offline
11009
+ // network change event will trigger the reconnection
11010
+ }
10993
11011
  if (error instanceof ErrorFromResponse && error.unrecoverable) {
10994
11012
  this.logger('warn', `[Reconnect] Can't reconnect due to coordinator unrecoverable error`, error);
10995
11013
  this.state.setCallingState(CallingState.RECONNECTING_FAILED);
@@ -13087,7 +13105,7 @@ class StreamClient {
13087
13105
  this.getUserAgent = () => {
13088
13106
  if (!this.cachedUserAgent) {
13089
13107
  const { clientAppIdentifier = {} } = this.options;
13090
- const { sdkName = 'js', sdkVersion = "1.18.0", ...extras } = clientAppIdentifier;
13108
+ const { sdkName = 'js', sdkVersion = "1.18.2", ...extras } = clientAppIdentifier;
13091
13109
  this.cachedUserAgent = [
13092
13110
  `stream-video-${sdkName}-v${sdkVersion}`,
13093
13111
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),