@stream-io/video-client 1.37.1 → 1.37.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
@@ -4887,6 +4887,26 @@ const defaultEgress = {
4887
4887
  hls: { playlist_url: '', status: '' },
4888
4888
  rtmps: [],
4889
4889
  };
4890
+ /**
4891
+ * Creates a stable participant filter function, ready to be used in combination
4892
+ * with the `useSyncExternalStore` hook.
4893
+ *
4894
+ * @param predicate the predicate to use.
4895
+ */
4896
+ const createStableParticipantsFilter = (predicate) => {
4897
+ const empty = [];
4898
+ return (participants) => {
4899
+ // no need to filter if there are no participants
4900
+ if (!participants.length)
4901
+ return participants;
4902
+ // return a stable empty array if there are no remote participants
4903
+ // instead of creating an empty one
4904
+ const filteredParticipants = participants.filter(predicate);
4905
+ if (!filteredParticipants.length)
4906
+ return empty;
4907
+ return filteredParticipants;
4908
+ };
4909
+ };
4890
4910
  /**
4891
4911
  * Holds the state of the current call.
4892
4912
  * @react You don't have to use this class directly, as we are exposing the state through Hooks.
@@ -5566,8 +5586,8 @@ class CallState {
5566
5586
  // in the original subject
5567
5587
  rxjs.map((ps) => ps.sort(this.sortParticipantsBy)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5568
5588
  this.localParticipant$ = this.participants$.pipe(rxjs.map((participants) => participants.find((p) => p.isLocalParticipant)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5569
- this.remoteParticipants$ = this.participants$.pipe(rxjs.map((participants) => participants.filter((p) => !p.isLocalParticipant)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5570
- this.pinnedParticipants$ = this.participants$.pipe(rxjs.map((participants) => participants.filter((p) => !!p.pin)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5589
+ this.remoteParticipants$ = this.participants$.pipe(rxjs.map(createStableParticipantsFilter((p) => !p.isLocalParticipant)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5590
+ this.pinnedParticipants$ = this.participants$.pipe(rxjs.map(createStableParticipantsFilter((p) => !!p.pin)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5571
5591
  this.dominantSpeaker$ = this.participants$.pipe(rxjs.map((participants) => participants.find((p) => p.isDominantSpeaker)), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5572
5592
  this.hasOngoingScreenShare$ = this.participants$.pipe(rxjs.map((participants) => participants.some((p) => hasScreenShare(p))), rxjs.distinctUntilChanged(), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
5573
5593
  // dates
@@ -6000,7 +6020,7 @@ const getSdkVersion = (sdk) => {
6000
6020
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6001
6021
  };
6002
6022
 
6003
- const version = "1.37.1";
6023
+ const version = "1.37.3";
6004
6024
  const [major, minor, patch] = version.split('.');
6005
6025
  let sdkInfo = {
6006
6026
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -11265,7 +11285,9 @@ class MicrophoneManager extends AudioDeviceManager {
11265
11285
  })
11266
11286
  .then((canAutoEnable) => {
11267
11287
  if (canAutoEnable) {
11268
- this.noiseCancellation?.enable();
11288
+ this.noiseCancellation?.enable().catch((err) => {
11289
+ this.logger.warn('Failed to enable noise cancellation', err);
11290
+ });
11269
11291
  }
11270
11292
  })
11271
11293
  .catch((err) => {
@@ -11335,7 +11357,9 @@ class MicrophoneManager extends AudioDeviceManager {
11335
11357
  canAutoEnable = await noiseCancellation.canAutoEnable();
11336
11358
  }
11337
11359
  if (canAutoEnable) {
11338
- noiseCancellation.enable();
11360
+ noiseCancellation.enable().catch((err) => {
11361
+ this.logger.warn('Failed to enable noise cancellation', err);
11362
+ });
11339
11363
  }
11340
11364
  }
11341
11365
  }
@@ -11415,10 +11439,14 @@ class MicrophoneManager extends AudioDeviceManager {
11415
11439
  if (this.noiseCancellation) {
11416
11440
  const disableAudioProcessing = profile === AudioBitrateProfile.MUSIC_HIGH_QUALITY;
11417
11441
  if (disableAudioProcessing) {
11418
- this.noiseCancellation.disable(); // disable for high quality music mode
11442
+ this.noiseCancellation.disable().catch((err) => {
11443
+ this.logger.warn('Failed to disable noise cancellation for music mode', err);
11444
+ }); // disable for high quality music mode
11419
11445
  }
11420
11446
  else {
11421
- this.noiseCancellation.enable(); // restore it for other modes if available
11447
+ this.noiseCancellation.enable().catch((err) => {
11448
+ this.logger.warn('Failed to enable noise cancellation', err);
11449
+ }); // restore it for other modes if available
11422
11450
  }
11423
11451
  }
11424
11452
  }
@@ -14908,7 +14936,7 @@ class StreamClient {
14908
14936
  this.getUserAgent = () => {
14909
14937
  if (!this.cachedUserAgent) {
14910
14938
  const { clientAppIdentifier = {} } = this.options;
14911
- const { sdkName = 'js', sdkVersion = "1.37.1", ...extras } = clientAppIdentifier;
14939
+ const { sdkName = 'js', sdkVersion = "1.37.3", ...extras } = clientAppIdentifier;
14912
14940
  this.cachedUserAgent = [
14913
14941
  `stream-video-${sdkName}-v${sdkVersion}`,
14914
14942
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),