@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.es.js CHANGED
@@ -4006,6 +4006,8 @@ const retryable = async (rpc, signal, maxRetries = Number.POSITIVE_INFINITY) =>
4006
4006
  do {
4007
4007
  if (attempt > 0)
4008
4008
  await sleep(retryInterval(attempt));
4009
+ if (signal?.aborted)
4010
+ throw new Error(signal.reason);
4009
4011
  try {
4010
4012
  result = await rpc({ attempt });
4011
4013
  }
@@ -6282,7 +6284,7 @@ const getSdkVersion = (sdk) => {
6282
6284
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6283
6285
  };
6284
6286
 
6285
- const version = "1.44.1";
6287
+ const version = "1.44.3";
6286
6288
  const [major, minor, patch] = version.split('.');
6287
6289
  let sdkInfo = {
6288
6290
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -8583,6 +8585,7 @@ class StreamSfuClient {
8583
8585
  this.isClosingClean = false;
8584
8586
  this.pingIntervalInMs = 5 * 1000;
8585
8587
  this.unhealthyTimeoutInMs = 15 * 1000;
8588
+ this.subscriptionsConcurrencyTag = Symbol('subscriptionsConcurrencyTag');
8586
8589
  /**
8587
8590
  * Promise that resolves when the JoinResponse is received.
8588
8591
  * Rejects after a certain threshold if the response is not received.
@@ -8690,8 +8693,10 @@ class StreamSfuClient {
8690
8693
  this.close(StreamSfuClient.NORMAL_CLOSURE, reason.substring(0, 115));
8691
8694
  };
8692
8695
  this.updateSubscriptions = async (tracks) => {
8693
- await this.joinTask;
8694
- return retryable((invocationMeta) => this.rpc.updateSubscriptions({ sessionId: this.sessionId, tracks }, { invocationMeta }), this.abortController.signal);
8696
+ return withoutConcurrency(this.subscriptionsConcurrencyTag, async () => {
8697
+ await this.joinTask;
8698
+ return retryable((invocationMeta) => this.rpc.updateSubscriptions({ sessionId: this.sessionId, tracks }, { invocationMeta }), this.abortController.signal);
8699
+ });
8695
8700
  };
8696
8701
  this.setPublisher = async (data) => {
8697
8702
  await this.joinTask;
@@ -12998,7 +13003,8 @@ class Call {
12998
13003
  // const calls = useCalls().filter((c) => c.ringing);
12999
13004
  const calls = this.clientStore.calls.filter((c) => c.cid !== this.cid);
13000
13005
  this.clientStore.setCalls([this, ...calls]);
13001
- await this.applyDeviceConfig(settings, false);
13006
+ const skipSpeakerApply = isReactNative();
13007
+ await this.applyDeviceConfig(settings, false, skipSpeakerApply);
13002
13008
  };
13003
13009
  /**
13004
13010
  * Loads the information about the call.
@@ -13021,7 +13027,13 @@ class Call {
13021
13027
  this.watching = true;
13022
13028
  this.clientStore.registerOrUpdateCall(this);
13023
13029
  }
13024
- await this.applyDeviceConfig(response.call.settings, false);
13030
+ // Skip speaker setup on RN if ringing was requested or the call is already ringing
13031
+ const skipSpeakerApply = isReactNative()
13032
+ ? params?.ring === true
13033
+ ? true
13034
+ : this.ringing
13035
+ : false;
13036
+ await this.applyDeviceConfig(response.call.settings, false, skipSpeakerApply);
13025
13037
  return response;
13026
13038
  };
13027
13039
  /**
@@ -13042,7 +13054,13 @@ class Call {
13042
13054
  this.watching = true;
13043
13055
  this.clientStore.registerOrUpdateCall(this);
13044
13056
  }
13045
- await this.applyDeviceConfig(response.call.settings, false);
13057
+ // Skip speaker setup on RN if ringing was requested or the call is already ringing
13058
+ const skipSpeakerApply = isReactNative()
13059
+ ? data?.ring === true
13060
+ ? true
13061
+ : this.ringing
13062
+ : false;
13063
+ await this.applyDeviceConfig(response.call.settings, false, skipSpeakerApply);
13046
13064
  return response;
13047
13065
  };
13048
13066
  /**
@@ -13297,7 +13315,7 @@ class Call {
13297
13315
  // device settings should be applied only once, we don't have to
13298
13316
  // re-apply them on later reconnections or server-side data fetches
13299
13317
  if (!this.deviceSettingsAppliedOnce && this.state.settings) {
13300
- await this.applyDeviceConfig(this.state.settings, true);
13318
+ await this.applyDeviceConfig(this.state.settings, true, false);
13301
13319
  globalThis.streamRNVideoSDK?.callManager.start();
13302
13320
  this.deviceSettingsAppliedOnce = true;
13303
13321
  }
@@ -14555,8 +14573,10 @@ class Call {
14555
14573
  *
14556
14574
  * @internal
14557
14575
  */
14558
- this.applyDeviceConfig = async (settings, publish) => {
14559
- this.speaker.apply(settings);
14576
+ this.applyDeviceConfig = async (settings, publish, skipSpeakerApply) => {
14577
+ if (!skipSpeakerApply) {
14578
+ this.speaker.apply(settings);
14579
+ }
14560
14580
  await this.camera.apply(settings.video, publish).catch((err) => {
14561
14581
  this.logger.warn('Camera init failed', err);
14562
14582
  });
@@ -15869,7 +15889,7 @@ class StreamClient {
15869
15889
  this.getUserAgent = () => {
15870
15890
  if (!this.cachedUserAgent) {
15871
15891
  const { clientAppIdentifier = {} } = this.options;
15872
- const { sdkName = 'js', sdkVersion = "1.44.1", ...extras } = clientAppIdentifier;
15892
+ const { sdkName = 'js', sdkVersion = "1.44.3", ...extras } = clientAppIdentifier;
15873
15893
  this.cachedUserAgent = [
15874
15894
  `stream-video-${sdkName}-v${sdkVersion}`,
15875
15895
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -16304,7 +16324,7 @@ class StreamVideoClient {
16304
16324
  clientStore: this.writeableStateStore,
16305
16325
  });
16306
16326
  call.state.updateFromCallResponse(c.call);
16307
- await call.applyDeviceConfig(c.call.settings, false);
16327
+ await call.applyDeviceConfig(c.call.settings, false, isReactNative());
16308
16328
  if (data.watch) {
16309
16329
  await call.setup();
16310
16330
  this.writeableStateStore.registerCall(call);