@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 +14 -0
- package/dist/index.browser.es.js +37 -19
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +32 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +37 -19
- package/dist/index.es.js.map +1 -1
- package/dist/src/sorting/__tests__/presets.test.d.ts +1 -0
- package/dist/src/sorting/comparator.d.ts +1 -1
- package/dist/src/sorting/presets.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/helpers/DynascaleManager.ts +2 -1
- package/src/helpers/__tests__/DynascaleManager.test.ts +4 -4
- package/src/sorting/__tests__/presets.test.ts +54 -0
- package/src/sorting/comparator.ts +1 -1
- package/src/sorting/presets.ts +28 -0
- package/src/store/CallState.ts +10 -3
- package/src/store/__tests__/CallState.test.ts +2 -1
- package/src/store/rxUtils.ts +3 -5
package/dist/index.cjs.js
CHANGED
|
@@ -7537,10 +7537,9 @@ const retryable = (rpc, logger) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
7537
7537
|
const getCurrentValue = (observable$) => {
|
|
7538
7538
|
let value;
|
|
7539
7539
|
let err = undefined;
|
|
7540
|
-
observable$
|
|
7541
|
-
.pipe(operators.take(1))
|
|
7540
|
+
rxjs.combineLatest([observable$])
|
|
7542
7541
|
.subscribe({
|
|
7543
|
-
next: (v) => {
|
|
7542
|
+
next: ([v]) => {
|
|
7544
7543
|
value = v;
|
|
7545
7544
|
},
|
|
7546
7545
|
error: (e) => {
|
|
@@ -7748,7 +7747,7 @@ const descending = (comparator) => {
|
|
|
7748
7747
|
* Creates a new comparator which conditionally applies the given comparator.
|
|
7749
7748
|
*
|
|
7750
7749
|
* @example
|
|
7751
|
-
* const shouldSortByValue = () =>
|
|
7750
|
+
* const shouldSortByValue = (a, b) => a % 2 === 0; // return false to turn it off
|
|
7752
7751
|
* const byValue = (a, b) => a < b ? - 1 : a > b ? 1 : 0;
|
|
7753
7752
|
* const comparator = conditional(shouldSortByValue)(byValue);
|
|
7754
7753
|
*
|
|
@@ -7913,6 +7912,18 @@ const ifInvisibleBy = conditional((a, b) => {
|
|
|
7913
7912
|
return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === exports.VisibilityState.INVISIBLE ||
|
|
7914
7913
|
((_b = b.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === exports.VisibilityState.INVISIBLE;
|
|
7915
7914
|
});
|
|
7915
|
+
/**
|
|
7916
|
+
* A comparator that applies the decorated comparator when a participant is
|
|
7917
|
+
* either invisible or its visibility state isn't known.
|
|
7918
|
+
* For visible participants, it ensures stable sorting.
|
|
7919
|
+
*/
|
|
7920
|
+
const ifInvisibleOrUnknownBy = conditional((a, b) => {
|
|
7921
|
+
var _a, _b, _c, _d;
|
|
7922
|
+
return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === exports.VisibilityState.INVISIBLE ||
|
|
7923
|
+
((_b = a.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === exports.VisibilityState.UNKNOWN ||
|
|
7924
|
+
((_c = b.viewportVisibilityState) === null || _c === void 0 ? void 0 : _c.videoTrack) === exports.VisibilityState.INVISIBLE ||
|
|
7925
|
+
((_d = b.viewportVisibilityState) === null || _d === void 0 ? void 0 : _d.videoTrack) === exports.VisibilityState.UNKNOWN;
|
|
7926
|
+
});
|
|
7916
7927
|
/**
|
|
7917
7928
|
* The default sorting preset.
|
|
7918
7929
|
*/
|
|
@@ -7921,6 +7932,11 @@ const defaultSortPreset = combineComparators(pinned, screenSharing, ifInvisibleB
|
|
|
7921
7932
|
* The sorting preset for speaker layout.
|
|
7922
7933
|
*/
|
|
7923
7934
|
const speakerLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleBy(speaking), ifInvisibleBy(reactionType('raised-hand')), ifInvisibleBy(publishingVideo), ifInvisibleBy(publishingAudio));
|
|
7935
|
+
/**
|
|
7936
|
+
* The sorting preset for layouts that don't render all participants but
|
|
7937
|
+
* instead, render them in pages.
|
|
7938
|
+
*/
|
|
7939
|
+
const paginatedLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleOrUnknownBy(speaking), ifInvisibleOrUnknownBy(reactionType('raised-hand')), ifInvisibleOrUnknownBy(publishingVideo), ifInvisibleOrUnknownBy(publishingAudio));
|
|
7924
7940
|
/**
|
|
7925
7941
|
* The sorting preset for livestreams and audio rooms.
|
|
7926
7942
|
*/
|
|
@@ -8338,12 +8354,14 @@ class CallState {
|
|
|
8338
8354
|
}
|
|
8339
8355
|
};
|
|
8340
8356
|
this.logger = getLogger(['CallState']);
|
|
8341
|
-
this.participants$ = this.participantsSubject.
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
this.
|
|
8345
|
-
this.
|
|
8346
|
-
this.
|
|
8357
|
+
this.participants$ = this.participantsSubject.asObservable().pipe(
|
|
8358
|
+
// TODO: replace with Array.toSorted once available
|
|
8359
|
+
operators.map((ps) => [...ps].sort(this.sortParticipantsBy)), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8360
|
+
this.localParticipant$ = this.participants$.pipe(operators.map((participants) => participants.find(isStreamVideoLocalParticipant)), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8361
|
+
this.remoteParticipants$ = this.participants$.pipe(operators.map((participants) => participants.filter((p) => !p.isLocalParticipant)), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8362
|
+
this.pinnedParticipants$ = this.participants$.pipe(operators.map((participants) => participants.filter((p) => !!p.pin)), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8363
|
+
this.dominantSpeaker$ = this.participants$.pipe(operators.map((participants) => participants.find((p) => p.isDominantSpeaker)), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8364
|
+
this.hasOngoingScreenShare$ = this.participants$.pipe(operators.map((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), operators.distinctUntilChanged(), operators.shareReplay({ bufferSize: 1, refCount: true }));
|
|
8347
8365
|
this.startedAt$ = this.startedAtSubject.asObservable();
|
|
8348
8366
|
this.participantCount$ = this.participantCountSubject.asObservable();
|
|
8349
8367
|
this.anonymousParticipantCount$ =
|
|
@@ -9521,7 +9539,7 @@ class DynascaleManager {
|
|
|
9521
9539
|
}
|
|
9522
9540
|
this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
|
|
9523
9541
|
};
|
|
9524
|
-
const participant$ = this.call.state.participants$.pipe(rxjs.map((participants) => participants.find((participant) => participant.sessionId === sessionId)), rxjs.takeWhile((participant) => !!participant), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
|
|
9542
|
+
const participant$ = this.call.state.participants$.pipe(rxjs.map((participants) => participants.find((participant) => participant.sessionId === sessionId)), rxjs.takeWhile((participant) => !!participant), rxjs.distinctUntilChanged(), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
|
|
9525
9543
|
/**
|
|
9526
9544
|
* Since the video elements are now being removed from the DOM (React SDK) upon
|
|
9527
9545
|
* visibility change, this subscription is not in use an stays here only for the
|
|
@@ -9640,7 +9658,7 @@ class DynascaleManager {
|
|
|
9640
9658
|
const participant = this.call.state.findParticipantBySessionId(sessionId);
|
|
9641
9659
|
if (!participant || participant.isLocalParticipant)
|
|
9642
9660
|
return;
|
|
9643
|
-
const participant$ = this.call.state.participants$.pipe(rxjs.map((participants) => participants.find((p) => p.sessionId === sessionId)), rxjs.takeWhile((p) => !!p), rxjs.distinctUntilChanged());
|
|
9661
|
+
const participant$ = this.call.state.participants$.pipe(rxjs.map((participants) => participants.find((p) => p.sessionId === sessionId)), rxjs.takeWhile((p) => !!p), rxjs.distinctUntilChanged(), rxjs.shareReplay({ bufferSize: 1, refCount: true }));
|
|
9644
9662
|
const updateMediaStreamSubscription = participant$
|
|
9645
9663
|
.pipe(rxjs.distinctUntilKeyChanged('audioStream'))
|
|
9646
9664
|
.subscribe((p) => {
|
|
@@ -13186,7 +13204,7 @@ class WSConnectionFallback {
|
|
|
13186
13204
|
}
|
|
13187
13205
|
}
|
|
13188
13206
|
|
|
13189
|
-
const version = '0.3.
|
|
13207
|
+
const version = '0.3.25';
|
|
13190
13208
|
|
|
13191
13209
|
const logger = getLogger(['location']);
|
|
13192
13210
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -14231,6 +14249,7 @@ exports.logLevels = logLevels;
|
|
|
14231
14249
|
exports.logToConsole = logToConsole;
|
|
14232
14250
|
exports.name = name;
|
|
14233
14251
|
exports.noopComparator = noopComparator;
|
|
14252
|
+
exports.paginatedLayoutSortPreset = paginatedLayoutSortPreset;
|
|
14234
14253
|
exports.pinned = pinned;
|
|
14235
14254
|
exports.publishingAudio = publishingAudio;
|
|
14236
14255
|
exports.publishingVideo = publishingVideo;
|