@stream-io/video-client 1.44.1 → 1.44.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
@@ -4025,6 +4025,8 @@ const retryable = async (rpc, signal, maxRetries = Number.POSITIVE_INFINITY) =>
4025
4025
  do {
4026
4026
  if (attempt > 0)
4027
4027
  await sleep(retryInterval(attempt));
4028
+ if (signal?.aborted)
4029
+ throw new Error(signal.reason);
4028
4030
  try {
4029
4031
  result = await rpc({ attempt });
4030
4032
  }
@@ -6301,7 +6303,7 @@ const getSdkVersion = (sdk) => {
6301
6303
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6302
6304
  };
6303
6305
 
6304
- const version = "1.44.1";
6306
+ const version = "1.44.3";
6305
6307
  const [major, minor, patch] = version.split('.');
6306
6308
  let sdkInfo = {
6307
6309
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8602,6 +8604,7 @@ class StreamSfuClient {
8602
8604
  this.isClosingClean = false;
8603
8605
  this.pingIntervalInMs = 5 * 1000;
8604
8606
  this.unhealthyTimeoutInMs = 15 * 1000;
8607
+ this.subscriptionsConcurrencyTag = Symbol('subscriptionsConcurrencyTag');
8605
8608
  /**
8606
8609
  * Promise that resolves when the JoinResponse is received.
8607
8610
  * Rejects after a certain threshold if the response is not received.
@@ -8709,8 +8712,10 @@ class StreamSfuClient {
8709
8712
  this.close(StreamSfuClient.NORMAL_CLOSURE, reason.substring(0, 115));
8710
8713
  };
8711
8714
  this.updateSubscriptions = async (tracks) => {
8712
- await this.joinTask;
8713
- return retryable((invocationMeta) => this.rpc.updateSubscriptions({ sessionId: this.sessionId, tracks }, { invocationMeta }), this.abortController.signal);
8715
+ return withoutConcurrency(this.subscriptionsConcurrencyTag, async () => {
8716
+ await this.joinTask;
8717
+ return retryable((invocationMeta) => this.rpc.updateSubscriptions({ sessionId: this.sessionId, tracks }, { invocationMeta }), this.abortController.signal);
8718
+ });
8714
8719
  };
8715
8720
  this.setPublisher = async (data) => {
8716
8721
  await this.joinTask;
@@ -13017,7 +13022,8 @@ class Call {
13017
13022
  // const calls = useCalls().filter((c) => c.ringing);
13018
13023
  const calls = this.clientStore.calls.filter((c) => c.cid !== this.cid);
13019
13024
  this.clientStore.setCalls([this, ...calls]);
13020
- await this.applyDeviceConfig(settings, false);
13025
+ const skipSpeakerApply = isReactNative();
13026
+ await this.applyDeviceConfig(settings, false, skipSpeakerApply);
13021
13027
  };
13022
13028
  /**
13023
13029
  * Loads the information about the call.
@@ -13040,7 +13046,13 @@ class Call {
13040
13046
  this.watching = true;
13041
13047
  this.clientStore.registerOrUpdateCall(this);
13042
13048
  }
13043
- await this.applyDeviceConfig(response.call.settings, false);
13049
+ // Skip speaker setup on RN if ringing was requested or the call is already ringing
13050
+ const skipSpeakerApply = isReactNative()
13051
+ ? params?.ring === true
13052
+ ? true
13053
+ : this.ringing
13054
+ : false;
13055
+ await this.applyDeviceConfig(response.call.settings, false, skipSpeakerApply);
13044
13056
  return response;
13045
13057
  };
13046
13058
  /**
@@ -13061,7 +13073,13 @@ class Call {
13061
13073
  this.watching = true;
13062
13074
  this.clientStore.registerOrUpdateCall(this);
13063
13075
  }
13064
- await this.applyDeviceConfig(response.call.settings, false);
13076
+ // Skip speaker setup on RN if ringing was requested or the call is already ringing
13077
+ const skipSpeakerApply = isReactNative()
13078
+ ? data?.ring === true
13079
+ ? true
13080
+ : this.ringing
13081
+ : false;
13082
+ await this.applyDeviceConfig(response.call.settings, false, skipSpeakerApply);
13065
13083
  return response;
13066
13084
  };
13067
13085
  /**
@@ -13316,7 +13334,7 @@ class Call {
13316
13334
  // device settings should be applied only once, we don't have to
13317
13335
  // re-apply them on later reconnections or server-side data fetches
13318
13336
  if (!this.deviceSettingsAppliedOnce && this.state.settings) {
13319
- await this.applyDeviceConfig(this.state.settings, true);
13337
+ await this.applyDeviceConfig(this.state.settings, true, false);
13320
13338
  globalThis.streamRNVideoSDK?.callManager.start();
13321
13339
  this.deviceSettingsAppliedOnce = true;
13322
13340
  }
@@ -14574,8 +14592,10 @@ class Call {
14574
14592
  *
14575
14593
  * @internal
14576
14594
  */
14577
- this.applyDeviceConfig = async (settings, publish) => {
14578
- this.speaker.apply(settings);
14595
+ this.applyDeviceConfig = async (settings, publish, skipSpeakerApply) => {
14596
+ if (!skipSpeakerApply) {
14597
+ this.speaker.apply(settings);
14598
+ }
14579
14599
  await this.camera.apply(settings.video, publish).catch((err) => {
14580
14600
  this.logger.warn('Camera init failed', err);
14581
14601
  });
@@ -15888,7 +15908,7 @@ class StreamClient {
15888
15908
  this.getUserAgent = () => {
15889
15909
  if (!this.cachedUserAgent) {
15890
15910
  const { clientAppIdentifier = {} } = this.options;
15891
- const { sdkName = 'js', sdkVersion = "1.44.1", ...extras } = clientAppIdentifier;
15911
+ const { sdkName = 'js', sdkVersion = "1.44.3", ...extras } = clientAppIdentifier;
15892
15912
  this.cachedUserAgent = [
15893
15913
  `stream-video-${sdkName}-v${sdkVersion}`,
15894
15914
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -16323,7 +16343,7 @@ class StreamVideoClient {
16323
16343
  clientStore: this.writeableStateStore,
16324
16344
  });
16325
16345
  call.state.updateFromCallResponse(c.call);
16326
- await call.applyDeviceConfig(c.call.settings, false);
16346
+ await call.applyDeviceConfig(c.call.settings, false, isReactNative());
16327
16347
  if (data.watch) {
16328
16348
  await call.setup();
16329
16349
  this.writeableStateStore.registerCall(call);