@stream-io/video-client 1.37.1 → 1.37.2

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
@@ -4868,6 +4868,26 @@ const defaultEgress = {
4868
4868
  hls: { playlist_url: '', status: '' },
4869
4869
  rtmps: [],
4870
4870
  };
4871
+ /**
4872
+ * Creates a stable participant filter function, ready to be used in combination
4873
+ * with the `useSyncExternalStore` hook.
4874
+ *
4875
+ * @param predicate the predicate to use.
4876
+ */
4877
+ const createStableParticipantsFilter = (predicate) => {
4878
+ const empty = [];
4879
+ return (participants) => {
4880
+ // no need to filter if there are no participants
4881
+ if (!participants.length)
4882
+ return participants;
4883
+ // return a stable empty array if there are no remote participants
4884
+ // instead of creating an empty one
4885
+ const filteredParticipants = participants.filter(predicate);
4886
+ if (!filteredParticipants.length)
4887
+ return empty;
4888
+ return filteredParticipants;
4889
+ };
4890
+ };
4871
4891
  /**
4872
4892
  * Holds the state of the current call.
4873
4893
  * @react You don't have to use this class directly, as we are exposing the state through Hooks.
@@ -5547,8 +5567,8 @@ class CallState {
5547
5567
  // in the original subject
5548
5568
  map((ps) => ps.sort(this.sortParticipantsBy)), shareReplay({ bufferSize: 1, refCount: true }));
5549
5569
  this.localParticipant$ = this.participants$.pipe(map((participants) => participants.find((p) => p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
5550
- this.remoteParticipants$ = this.participants$.pipe(map((participants) => participants.filter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
5551
- this.pinnedParticipants$ = this.participants$.pipe(map((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
5570
+ this.remoteParticipants$ = this.participants$.pipe(map(createStableParticipantsFilter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
5571
+ this.pinnedParticipants$ = this.participants$.pipe(map(createStableParticipantsFilter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
5552
5572
  this.dominantSpeaker$ = this.participants$.pipe(map((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
5553
5573
  this.hasOngoingScreenShare$ = this.participants$.pipe(map((participants) => participants.some((p) => hasScreenShare(p))), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
5554
5574
  // dates
@@ -5981,7 +6001,7 @@ const getSdkVersion = (sdk) => {
5981
6001
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
5982
6002
  };
5983
6003
 
5984
- const version = "1.37.1";
6004
+ const version = "1.37.2";
5985
6005
  const [major, minor, patch] = version.split('.');
5986
6006
  let sdkInfo = {
5987
6007
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -14889,7 +14909,7 @@ class StreamClient {
14889
14909
  this.getUserAgent = () => {
14890
14910
  if (!this.cachedUserAgent) {
14891
14911
  const { clientAppIdentifier = {} } = this.options;
14892
- const { sdkName = 'js', sdkVersion = "1.37.1", ...extras } = clientAppIdentifier;
14912
+ const { sdkName = 'js', sdkVersion = "1.37.2", ...extras } = clientAppIdentifier;
14893
14913
  this.cachedUserAgent = [
14894
14914
  `stream-video-${sdkName}-v${sdkVersion}`,
14895
14915
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),