@stream-io/video-client 1.15.1 → 1.15.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
@@ -6060,6 +6060,7 @@ class Subscriber extends BasePeerConnection {
6060
6060
  const createWebSocketSignalChannel = (opts) => {
6061
6061
  const { endpoint, onMessage, logTag } = opts;
6062
6062
  const logger = getLogger(['SfuClientWS', logTag]);
6063
+ logger('debug', 'Creating signaling WS channel:', endpoint);
6063
6064
  const ws = new WebSocket(endpoint);
6064
6065
  ws.binaryType = 'arraybuffer'; // do we need this?
6065
6066
  ws.addEventListener('error', (e) => {
@@ -6339,14 +6340,20 @@ class StreamSfuClient {
6339
6340
  this.dispatcher.dispatch(message, this.logTag);
6340
6341
  },
6341
6342
  });
6342
- this.signalWs.addEventListener('close', this.handleWebSocketClose);
6343
6343
  this.signalReady = makeSafePromise(Promise.race([
6344
- new Promise((resolve) => {
6344
+ new Promise((resolve, reject) => {
6345
6345
  const onOpen = () => {
6346
6346
  this.signalWs.removeEventListener('open', onOpen);
6347
6347
  resolve(this.signalWs);
6348
6348
  };
6349
6349
  this.signalWs.addEventListener('open', onOpen);
6350
+ this.signalWs.addEventListener('close', () => {
6351
+ this.handleWebSocketClose();
6352
+ // Normally, this shouldn't have any effect, because WS should never emit 'close'
6353
+ // before emitting 'open'. However, strager things have happened, and we don't
6354
+ // want to leave signalReady in pending state.
6355
+ reject(new Error('SFU WS closed unexpectedly'));
6356
+ });
6350
6357
  }),
6351
6358
  new Promise((resolve, reject) => {
6352
6359
  setTimeout(() => reject(new Error('SFU WS connection timed out')), this.joinResponseTimeout);
@@ -7347,7 +7354,7 @@ const aggregate = (stats) => {
7347
7354
  return report;
7348
7355
  };
7349
7356
 
7350
- const version = "1.15.1";
7357
+ const version = "1.15.3";
7351
7358
  const [major, minor, patch] = version.split('.');
7352
7359
  let sdkInfo = {
7353
7360
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10448,19 +10455,26 @@ class Call {
10448
10455
  const preferredSubscribeOptions = !isReconnecting
10449
10456
  ? this.getPreferredSubscribeOptions()
10450
10457
  : [];
10451
- const { callState, fastReconnectDeadlineSeconds, publishOptions } = await sfuClient.join({
10452
- subscriberSdp,
10453
- publisherSdp,
10454
- clientDetails,
10455
- fastReconnect: performingFastReconnect,
10456
- reconnectDetails,
10457
- preferredPublishOptions,
10458
- preferredSubscribeOptions,
10459
- });
10460
- this.currentPublishOptions = publishOptions;
10461
- this.fastReconnectDeadlineSeconds = fastReconnectDeadlineSeconds;
10462
- if (callState) {
10463
- this.state.updateFromSfuCallState(callState, sfuClient.sessionId, reconnectDetails);
10458
+ try {
10459
+ const { callState, fastReconnectDeadlineSeconds, publishOptions } = await sfuClient.join({
10460
+ subscriberSdp,
10461
+ publisherSdp,
10462
+ clientDetails,
10463
+ fastReconnect: performingFastReconnect,
10464
+ reconnectDetails,
10465
+ preferredPublishOptions,
10466
+ preferredSubscribeOptions,
10467
+ });
10468
+ this.currentPublishOptions = publishOptions;
10469
+ this.fastReconnectDeadlineSeconds = fastReconnectDeadlineSeconds;
10470
+ if (callState) {
10471
+ this.state.updateFromSfuCallState(callState, sfuClient.sessionId, reconnectDetails);
10472
+ }
10473
+ }
10474
+ catch (error) {
10475
+ // restore the previous call state if the join-flow fails
10476
+ this.state.setCallingState(callingState);
10477
+ throw error;
10464
10478
  }
10465
10479
  }
10466
10480
  if (!performingMigration) {
@@ -12837,7 +12851,7 @@ class StreamClient {
12837
12851
  return await this.wsConnection.connect(this.defaultWSTimeout);
12838
12852
  };
12839
12853
  this.getUserAgent = () => {
12840
- const version = "1.15.1";
12854
+ const version = "1.15.3";
12841
12855
  return (this.userAgent ||
12842
12856
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12843
12857
  };