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