@stream-io/video-client 0.3.23 → 0.3.24

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.3.24](https://github.com/GetStream/stream-video-js/compare/client0.3.23...client0.3.24) (2023-09-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * **client:** share replay of computed observables ([#1095](https://github.com/GetStream/stream-video-js/issues/1095)) ([759d9a2](https://github.com/GetStream/stream-video-js/commit/759d9a2c403aa11a64e5470aa53622022918e24e))
11
+
5
12
  ### [0.3.23](https://github.com/GetStream/stream-video-js/compare/client0.3.22...client0.3.23) (2023-09-26)
6
13
 
7
14
 
@@ -4,11 +4,11 @@ import { ServiceType, stackIntercept } from '@protobuf-ts/runtime-rpc';
4
4
  import axios, { AxiosHeaders } from 'axios';
5
5
  export { AxiosError } from 'axios';
6
6
  import { TwirpFetchTransport } from '@protobuf-ts/twirp-transport';
7
- import { ReplaySubject, BehaviorSubject, map as map$2, takeWhile, distinctUntilChanged as distinctUntilChanged$1, shareReplay, distinctUntilKeyChanged, combineLatest, Observable, debounceTime, concatMap, from, merge, filter, pairwise, tap, debounce, timer } from 'rxjs';
7
+ import { ReplaySubject, combineLatest, BehaviorSubject, map as map$2, takeWhile, distinctUntilChanged as distinctUntilChanged$1, shareReplay as shareReplay$1, distinctUntilKeyChanged, Observable, debounceTime, concatMap, from, merge, filter, pairwise, tap, debounce, timer } from 'rxjs';
8
8
  import * as SDP from 'sdp-transform';
9
9
  import { UAParser } from 'ua-parser-js';
10
10
  import WebSocket from 'isomorphic-ws';
11
- import { take, map as map$1, distinctUntilChanged } from 'rxjs/operators';
11
+ import { map as map$1, shareReplay, distinctUntilChanged } from 'rxjs/operators';
12
12
  import { fromByteArray } from 'base64-js';
13
13
 
14
14
  /**
@@ -7514,10 +7514,9 @@ const retryable = (rpc, logger) => __awaiter(void 0, void 0, void 0, function* (
7514
7514
  const getCurrentValue = (observable$) => {
7515
7515
  let value;
7516
7516
  let err = undefined;
7517
- observable$
7518
- .pipe(take(1))
7517
+ combineLatest([observable$])
7519
7518
  .subscribe({
7520
- next: (v) => {
7519
+ next: ([v]) => {
7521
7520
  value = v;
7522
7521
  },
7523
7522
  error: (e) => {
@@ -7725,7 +7724,7 @@ const descending = (comparator) => {
7725
7724
  * Creates a new comparator which conditionally applies the given comparator.
7726
7725
  *
7727
7726
  * @example
7728
- * const shouldSortByValue = () => return false; // to turn it off
7727
+ * const shouldSortByValue = (a, b) => a % 2 === 0; // return false to turn it off
7729
7728
  * const byValue = (a, b) => a < b ? - 1 : a > b ? 1 : 0;
7730
7729
  * const comparator = conditional(shouldSortByValue)(byValue);
7731
7730
  *
@@ -8315,12 +8314,14 @@ class CallState {
8315
8314
  }
8316
8315
  };
8317
8316
  this.logger = getLogger(['CallState']);
8318
- this.participants$ = this.participantsSubject.pipe(map$1((ps) => ps.sort(this.sortParticipantsBy)));
8319
- this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find(isStreamVideoLocalParticipant)));
8320
- this.remoteParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !p.isLocalParticipant)));
8321
- this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)));
8322
- this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)));
8323
- this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), distinctUntilChanged());
8317
+ this.participants$ = this.participantsSubject.asObservable().pipe(
8318
+ // TODO: replace with Array.toSorted once available
8319
+ map$1((ps) => [...ps].sort(this.sortParticipantsBy)), shareReplay({ bufferSize: 1, refCount: true }));
8320
+ this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find(isStreamVideoLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8321
+ this.remoteParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8322
+ this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
8323
+ this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
8324
+ this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
8324
8325
  this.startedAt$ = this.startedAtSubject.asObservable();
8325
8326
  this.participantCount$ = this.participantCountSubject.asObservable();
8326
8327
  this.anonymousParticipantCount$ =
@@ -9498,7 +9499,7 @@ class DynascaleManager {
9498
9499
  }
9499
9500
  this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
9500
9501
  };
9501
- const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay(1));
9502
+ const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay$1({ bufferSize: 1, refCount: true }));
9502
9503
  /**
9503
9504
  * Since the video elements are now being removed from the DOM (React SDK) upon
9504
9505
  * visibility change, this subscription is not in use an stays here only for the
@@ -9617,7 +9618,7 @@ class DynascaleManager {
9617
9618
  const participant = this.call.state.findParticipantBySessionId(sessionId);
9618
9619
  if (!participant || participant.isLocalParticipant)
9619
9620
  return;
9620
- const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((p) => p.sessionId === sessionId)), takeWhile((p) => !!p), distinctUntilChanged$1());
9621
+ const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((p) => p.sessionId === sessionId)), takeWhile((p) => !!p), distinctUntilChanged$1(), shareReplay$1({ bufferSize: 1, refCount: true }));
9621
9622
  const updateMediaStreamSubscription = participant$
9622
9623
  .pipe(distinctUntilKeyChanged('audioStream'))
9623
9624
  .subscribe((p) => {
@@ -9858,9 +9859,9 @@ const deviceChange$ = new Observable((subscriber) => {
9858
9859
  var _a, _b;
9859
9860
  return (_b = (_a = navigator.mediaDevices).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, 'devicechange', deviceChangeHandler);
9860
9861
  };
9861
- }).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay(1));
9862
- const audioDevices$ = merge(getDevices(audioDeviceConstraints), deviceChange$).pipe(shareReplay(1));
9863
- const videoDevices$ = merge(getDevices(videoDeviceConstraints), deviceChange$).pipe(shareReplay(1));
9862
+ }).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay$1(1));
9863
+ const audioDevices$ = merge(getDevices(audioDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
9864
+ const videoDevices$ = merge(getDevices(videoDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
9864
9865
  /**
9865
9866
  * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
9866
9867
  *
@@ -13162,7 +13163,7 @@ class WSConnectionFallback {
13162
13163
  }
13163
13164
  }
13164
13165
 
13165
- const version = '0.3.23';
13166
+ const version = '0.3.24';
13166
13167
 
13167
13168
  const logger = getLogger(['location']);
13168
13169
  const HINT_URL = `https://hint.stream-io-video.com/`;