@stream-io/video-client 0.3.23 → 0.3.25

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,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.3.25](https://github.com/GetStream/stream-video-js/compare/client0.3.24...client0.3.25) (2023-09-27)
6
+
7
+
8
+ ### Features
9
+
10
+ * **react-sdk:** LivestreamLayout ([#1103](https://github.com/GetStream/stream-video-js/issues/1103)) ([6636699](https://github.com/GetStream/stream-video-js/commit/6636699701dfd5eb5886c50781dd5f16a8470da5))
11
+
12
+ ### [0.3.24](https://github.com/GetStream/stream-video-js/compare/client0.3.23...client0.3.24) (2023-09-26)
13
+
14
+
15
+ ### Features
16
+
17
+ * **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))
18
+
5
19
  ### [0.3.23](https://github.com/GetStream/stream-video-js/compare/client0.3.22...client0.3.23) (2023-09-26)
6
20
 
7
21
 
@@ -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
  *
@@ -7890,6 +7889,18 @@ const ifInvisibleBy = conditional((a, b) => {
7890
7889
  return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
7891
7890
  ((_b = b.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.INVISIBLE;
7892
7891
  });
7892
+ /**
7893
+ * A comparator that applies the decorated comparator when a participant is
7894
+ * either invisible or its visibility state isn't known.
7895
+ * For visible participants, it ensures stable sorting.
7896
+ */
7897
+ const ifInvisibleOrUnknownBy = conditional((a, b) => {
7898
+ var _a, _b, _c, _d;
7899
+ return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
7900
+ ((_b = a.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.UNKNOWN ||
7901
+ ((_c = b.viewportVisibilityState) === null || _c === void 0 ? void 0 : _c.videoTrack) === VisibilityState.INVISIBLE ||
7902
+ ((_d = b.viewportVisibilityState) === null || _d === void 0 ? void 0 : _d.videoTrack) === VisibilityState.UNKNOWN;
7903
+ });
7893
7904
  /**
7894
7905
  * The default sorting preset.
7895
7906
  */
@@ -7898,6 +7909,11 @@ const defaultSortPreset = combineComparators(pinned, screenSharing, ifInvisibleB
7898
7909
  * The sorting preset for speaker layout.
7899
7910
  */
7900
7911
  const speakerLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleBy(speaking), ifInvisibleBy(reactionType('raised-hand')), ifInvisibleBy(publishingVideo), ifInvisibleBy(publishingAudio));
7912
+ /**
7913
+ * The sorting preset for layouts that don't render all participants but
7914
+ * instead, render them in pages.
7915
+ */
7916
+ const paginatedLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleOrUnknownBy(speaking), ifInvisibleOrUnknownBy(reactionType('raised-hand')), ifInvisibleOrUnknownBy(publishingVideo), ifInvisibleOrUnknownBy(publishingAudio));
7901
7917
  /**
7902
7918
  * The sorting preset for livestreams and audio rooms.
7903
7919
  */
@@ -8315,12 +8331,14 @@ class CallState {
8315
8331
  }
8316
8332
  };
8317
8333
  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());
8334
+ this.participants$ = this.participantsSubject.asObservable().pipe(
8335
+ // TODO: replace with Array.toSorted once available
8336
+ map$1((ps) => [...ps].sort(this.sortParticipantsBy)), shareReplay({ bufferSize: 1, refCount: true }));
8337
+ this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find(isStreamVideoLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8338
+ this.remoteParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
8339
+ this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
8340
+ this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
8341
+ this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
8324
8342
  this.startedAt$ = this.startedAtSubject.asObservable();
8325
8343
  this.participantCount$ = this.participantCountSubject.asObservable();
8326
8344
  this.anonymousParticipantCount$ =
@@ -9498,7 +9516,7 @@ class DynascaleManager {
9498
9516
  }
9499
9517
  this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
9500
9518
  };
9501
- const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay(1));
9519
+ 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
9520
  /**
9503
9521
  * Since the video elements are now being removed from the DOM (React SDK) upon
9504
9522
  * visibility change, this subscription is not in use an stays here only for the
@@ -9617,7 +9635,7 @@ class DynascaleManager {
9617
9635
  const participant = this.call.state.findParticipantBySessionId(sessionId);
9618
9636
  if (!participant || participant.isLocalParticipant)
9619
9637
  return;
9620
- const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((p) => p.sessionId === sessionId)), takeWhile((p) => !!p), distinctUntilChanged$1());
9638
+ 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
9639
  const updateMediaStreamSubscription = participant$
9622
9640
  .pipe(distinctUntilKeyChanged('audioStream'))
9623
9641
  .subscribe((p) => {
@@ -9858,9 +9876,9 @@ const deviceChange$ = new Observable((subscriber) => {
9858
9876
  var _a, _b;
9859
9877
  return (_b = (_a = navigator.mediaDevices).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, 'devicechange', deviceChangeHandler);
9860
9878
  };
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));
9879
+ }).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay$1(1));
9880
+ const audioDevices$ = merge(getDevices(audioDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
9881
+ const videoDevices$ = merge(getDevices(videoDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
9864
9882
  /**
9865
9883
  * 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
9884
  *
@@ -13162,7 +13180,7 @@ class WSConnectionFallback {
13162
13180
  }
13163
13181
  }
13164
13182
 
13165
- const version = '0.3.23';
13183
+ const version = '0.3.25';
13166
13184
 
13167
13185
  const logger = getLogger(['location']);
13168
13186
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -14142,5 +14160,5 @@ class StreamVideoServerClient extends StreamVideoClient {
14142
14160
  }
14143
14161
  }
14144
14162
 
14145
- export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14163
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
14146
14164
  //# sourceMappingURL=index.browser.es.js.map