@stream-io/video-client 1.18.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
package/src/Call.ts CHANGED
@@ -844,8 +844,7 @@ export class Call {
844
844
  } catch (error) {
845
845
  // prevent triggering reconnect flow if the state is OFFLINE
846
846
  const avoidRestoreState =
847
- this.state.callingState === CallingState.OFFLINE &&
848
- callingState === CallingState.RECONNECTING;
847
+ this.state.callingState === CallingState.OFFLINE;
849
848
 
850
849
  if (!avoidRestoreState) {
851
850
  // restore the previous call state if the join-flow fails
@@ -1204,7 +1203,10 @@ export class Call {
1204
1203
  this.ringingSubject.next(true);
1205
1204
  }
1206
1205
 
1207
- if (this.ringing && !this.isCreatedByMe) {
1206
+ const isReconnecting =
1207
+ this.reconnectStrategy !== WebsocketReconnectStrategy.UNSPECIFIED;
1208
+
1209
+ if (!isReconnecting && this.ringing && !this.isCreatedByMe) {
1208
1210
  // signals other users that I have accepted the incoming call.
1209
1211
  await this.accept();
1210
1212
  }
@@ -1305,6 +1307,15 @@ export class Call {
1305
1307
  }
1306
1308
  break; // do-while loop, reconnection worked, exit the loop
1307
1309
  } catch (error) {
1310
+ if (this.state.callingState === CallingState.OFFLINE) {
1311
+ this.logger(
1312
+ 'trace',
1313
+ `[Reconnect] Can't reconnect while offline, stopping reconnection attempts`,
1314
+ );
1315
+ break;
1316
+ // we don't need to handle the error if the call is offline
1317
+ // network change event will trigger the reconnection
1318
+ }
1308
1319
  if (error instanceof ErrorFromResponse && error.unrecoverable) {
1309
1320
  this.logger(
1310
1321
  'warn',
@@ -19,6 +19,7 @@ import { isSvcCodec } from './codecs';
19
19
  import { isAudioTrackType } from './helpers/tracks';
20
20
  import { extractMid } from './helpers/sdp';
21
21
  import { withCancellation } from '../helpers/concurrency';
22
+ import { isReactNative } from '../helpers/platforms';
22
23
 
23
24
  export type PublisherConstructorOpts = BasePeerConnectionOpts & {
24
25
  publishOptions: PublishOption[];
@@ -110,7 +111,9 @@ export class Publisher extends BasePeerConnection {
110
111
  } else {
111
112
  const previousTrack = transceiver.sender.track;
112
113
  await transceiver.sender.replaceTrack(trackToPublish);
113
- this.stopTrack(previousTrack);
114
+ if (!isReactNative()) {
115
+ this.stopTrack(previousTrack);
116
+ }
114
117
  }
115
118
  }
116
119
  };
@@ -224,6 +227,11 @@ export class Publisher extends BasePeerConnection {
224
227
  }
225
228
  for (const track of this.clonedTracks) {
226
229
  this.stopTrack(track);
230
+ // @ts-expect-error release() is present in react-native-webrtc
231
+ if (track && typeof track.release === 'function') {
232
+ // @ts-expect-error
233
+ track.release();
234
+ }
227
235
  }
228
236
  };
229
237