@stream-io/video-client 1.19.1 → 1.19.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
@@ -5644,7 +5644,7 @@ const aggregate = (stats) => {
5644
5644
  return report;
5645
5645
  };
5646
5646
 
5647
- const version = "1.19.1";
5647
+ const version = "1.19.3";
5648
5648
  const [major, minor, patch] = version.split('.');
5649
5649
  let sdkInfo = {
5650
5650
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -6042,7 +6042,7 @@ class BasePeerConnection {
6042
6042
  /**
6043
6043
  * Constructs a new `BasePeerConnection` instance.
6044
6044
  */
6045
- constructor(peerType, { sfuClient, connectionConfig, state, dispatcher, onUnrecoverableError, logTag, enableTracing, }) {
6045
+ constructor(peerType, { sfuClient, connectionConfig, state, dispatcher, onUnrecoverableError, logTag, clientDetails, enableTracing, }) {
6046
6046
  this.isIceRestarting = false;
6047
6047
  this.isDisposed = false;
6048
6048
  this.subscriptions = [];
@@ -6186,7 +6186,9 @@ class BasePeerConnection {
6186
6186
  ]);
6187
6187
  this.pc = new RTCPeerConnection(connectionConfig);
6188
6188
  if (enableTracing) {
6189
- this.tracer = new Tracer(logTag);
6189
+ const tag = `${logTag}-${peerType === PeerType.SUBSCRIBER ? 'sub' : 'pub'}`;
6190
+ this.tracer = new Tracer(tag);
6191
+ this.tracer.trace('clientDetails', clientDetails);
6190
6192
  this.tracer.trace('create', connectionConfig);
6191
6193
  traceRTCPeerConnection(this.pc, this.tracer.trace);
6192
6194
  }
@@ -7265,6 +7267,10 @@ class StreamSfuClient {
7265
7267
  * This is set to `true` when the user initiates the leave process.
7266
7268
  */
7267
7269
  this.isLeaving = false;
7270
+ /**
7271
+ * Flag to indicate if the client is in the process of closing the connection.
7272
+ */
7273
+ this.isClosing = false;
7268
7274
  this.pingIntervalInMs = 10 * 1000;
7269
7275
  this.unhealthyTimeoutInMs = this.pingIntervalInMs + 5 * 1000;
7270
7276
  /**
@@ -7316,6 +7322,7 @@ class StreamSfuClient {
7316
7322
  this.onSignalClose?.(`${e.code} ${e.reason}`);
7317
7323
  };
7318
7324
  this.close = (code = StreamSfuClient.NORMAL_CLOSURE, reason) => {
7325
+ this.isClosing = true;
7319
7326
  if (this.signalWs.readyState === WebSocket.OPEN) {
7320
7327
  this.logger('debug', `Closing SFU WS connection: ${code} - ${reason}`);
7321
7328
  this.signalWs.close(code, `js-client: ${reason}`);
@@ -8392,6 +8399,7 @@ class DynascaleManager {
8392
8399
  const { selectedDevice } = this.speaker.state;
8393
8400
  if (selectedDevice && 'setSinkId' in audioElement) {
8394
8401
  audioElement.setSinkId(selectedDevice);
8402
+ tracer.trace('navigator.mediaDevices.setSinkId', selectedDevice);
8395
8403
  }
8396
8404
  }
8397
8405
  });
@@ -8401,6 +8409,7 @@ class DynascaleManager {
8401
8409
  : this.speaker.state.selectedDevice$.subscribe((deviceId) => {
8402
8410
  if (deviceId) {
8403
8411
  audioElement.setSinkId(deviceId);
8412
+ tracer.trace('navigator.mediaDevices.setSinkId', deviceId);
8404
8413
  }
8405
8414
  });
8406
8415
  const volumeSubscription = combineLatest([
@@ -10504,6 +10513,11 @@ class Call {
10504
10513
  */
10505
10514
  this.leaveCallHooks = new Set();
10506
10515
  this.streamClientEventHandlers = new Map();
10516
+ /**
10517
+ * Sets up the call instance.
10518
+ *
10519
+ * @internal an internal method and should not be used outside the SDK.
10520
+ */
10507
10521
  this.setup = async () => {
10508
10522
  await withoutConcurrency(this.joinLeaveConcurrencyTag, async () => {
10509
10523
  if (this.initialized)
@@ -11170,6 +11184,7 @@ class Call {
11170
11184
  state: this.state,
11171
11185
  connectionConfig,
11172
11186
  logTag: String(this.sfuClientTag),
11187
+ clientDetails,
11173
11188
  enableTracing,
11174
11189
  onUnrecoverableError: (reason) => {
11175
11190
  this.reconnect(WebsocketReconnectStrategy.REJOIN, reason).catch((err) => {
@@ -11191,6 +11206,7 @@ class Call {
11191
11206
  connectionConfig,
11192
11207
  publishOptions,
11193
11208
  logTag: String(this.sfuClientTag),
11209
+ clientDetails,
11194
11210
  enableTracing,
11195
11211
  onUnrecoverableError: (reason) => {
11196
11212
  this.reconnect(WebsocketReconnectStrategy.REJOIN, reason).catch((err) => {
@@ -11272,7 +11288,7 @@ class Call {
11272
11288
  callingState === CallingState.LEFT)
11273
11289
  return;
11274
11290
  // normal close, no need to reconnect
11275
- if (sfuClient.isLeaving)
11291
+ if (sfuClient.isLeaving || sfuClient.isClosing)
11276
11292
  return;
11277
11293
  this.reconnect(WebsocketReconnectStrategy.REJOIN, reason).catch((err) => {
11278
11294
  this.logger('warn', '[Reconnect] Error reconnecting', err);
@@ -11483,9 +11499,10 @@ class Call {
11483
11499
  this.sfuStatsReporter?.start();
11484
11500
  }
11485
11501
  });
11486
- this.leaveCallHooks.add(unregisterGoAway);
11487
- this.leaveCallHooks.add(unregisterOnError);
11488
- this.leaveCallHooks.add(unregisterNetworkChanged);
11502
+ this.leaveCallHooks
11503
+ .add(unregisterGoAway)
11504
+ .add(unregisterOnError)
11505
+ .add(unregisterNetworkChanged);
11489
11506
  };
11490
11507
  /**
11491
11508
  * Restores the published tracks after a reconnection.
@@ -13425,7 +13442,7 @@ class StreamClient {
13425
13442
  this.getUserAgent = () => {
13426
13443
  if (!this.cachedUserAgent) {
13427
13444
  const { clientAppIdentifier = {} } = this.options;
13428
- const { sdkName = 'js', sdkVersion = "1.19.1", ...extras } = clientAppIdentifier;
13445
+ const { sdkName = 'js', sdkVersion = "1.19.3", ...extras } = clientAppIdentifier;
13429
13446
  this.cachedUserAgent = [
13430
13447
  `stream-video-${sdkName}-v${sdkVersion}`,
13431
13448
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -13812,6 +13829,7 @@ class StreamVideoClient {
13812
13829
  call.state.updateFromCallResponse(c.call);
13813
13830
  await call.applyDeviceConfig(c.call.settings, false);
13814
13831
  if (data.watch) {
13832
+ await call.setup();
13815
13833
  this.writeableStateStore.registerCall(call);
13816
13834
  }
13817
13835
  calls.push(call);