@stream-io/video-client 0.0.47 → 0.0.48

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
@@ -6321,10 +6321,10 @@ class Publisher {
6321
6321
  /**
6322
6322
  * Restarts the ICE connection and renegotiates with the SFU.
6323
6323
  */
6324
- this.restartIce = () => {
6324
+ this.restartIce = () => __awaiter(this, void 0, void 0, function* () {
6325
6325
  this.logger('debug', 'Restarting ICE connection');
6326
- this.pc.restartIce();
6327
- };
6326
+ yield this.negotiate({ iceRestart: true });
6327
+ });
6328
6328
  this.onNegotiationNeeded = () => __awaiter(this, void 0, void 0, function* () {
6329
6329
  yield this.negotiate();
6330
6330
  });
@@ -6466,10 +6466,27 @@ class Publisher {
6466
6466
  };
6467
6467
  this.onIceConnectionStateChange = () => {
6468
6468
  const state = this.pc.iceConnectionState;
6469
- this.logger('debug', `ICE Connection state changed`, state);
6470
- if (state === 'failed' || state === 'disconnected') {
6471
- this.logger('warn', `ICE Connection state changed to ${state}. Attempting to restart ICE`);
6472
- this.restartIce();
6469
+ this.logger('debug', `ICE Connection state changed to`, state);
6470
+ if (state === 'failed') {
6471
+ this.logger('warn', `Attempting to restart ICE`);
6472
+ this.restartIce().catch((e) => {
6473
+ this.logger('error', `ICE restart error`, e);
6474
+ });
6475
+ }
6476
+ else if (state === 'disconnected') {
6477
+ // when in `disconnected` state, the browser may recover automatically,
6478
+ // hence, we delay the ICE restart
6479
+ this.logger('warn', `Scheduling ICE restart in 5 seconds`);
6480
+ setTimeout(() => {
6481
+ // check if the state is still `disconnected` or `failed`
6482
+ // as the connection may have recovered (or failed) in the meantime
6483
+ if (this.pc.iceConnectionState === 'disconnected' ||
6484
+ this.pc.iceConnectionState === 'failed') {
6485
+ this.restartIce().catch((e) => {
6486
+ this.logger('error', `ICE restart error`, e);
6487
+ });
6488
+ }
6489
+ }, 5000);
6473
6490
  }
6474
6491
  };
6475
6492
  this.onIceGatheringStateChange = () => {
@@ -11312,7 +11329,7 @@ class WSConnectionFallback {
11312
11329
  }
11313
11330
  }
11314
11331
 
11315
- const version = '0.0.47';
11332
+ const version = '0.0.48';
11316
11333
 
11317
11334
  const logger = getLogger(['location']);
11318
11335
  const HINT_URL = `https://hint.stream-io-video.com/`;