@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.es.js
CHANGED
|
@@ -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,
|
|
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 {
|
|
11
|
+
import { map as map$1, shareReplay, distinctUntilChanged } from 'rxjs/operators';
|
|
12
12
|
import https from 'https';
|
|
13
13
|
import jwt from 'jsonwebtoken';
|
|
14
14
|
import 'crypto';
|
|
@@ -7517,10 +7517,9 @@ const retryable = (rpc, logger) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
7517
7517
|
const getCurrentValue = (observable$) => {
|
|
7518
7518
|
let value;
|
|
7519
7519
|
let err = undefined;
|
|
7520
|
-
observable$
|
|
7521
|
-
.pipe(take(1))
|
|
7520
|
+
combineLatest([observable$])
|
|
7522
7521
|
.subscribe({
|
|
7523
|
-
next: (v) => {
|
|
7522
|
+
next: ([v]) => {
|
|
7524
7523
|
value = v;
|
|
7525
7524
|
},
|
|
7526
7525
|
error: (e) => {
|
|
@@ -7728,7 +7727,7 @@ const descending = (comparator) => {
|
|
|
7728
7727
|
* Creates a new comparator which conditionally applies the given comparator.
|
|
7729
7728
|
*
|
|
7730
7729
|
* @example
|
|
7731
|
-
* const shouldSortByValue = () =>
|
|
7730
|
+
* const shouldSortByValue = (a, b) => a % 2 === 0; // return false to turn it off
|
|
7732
7731
|
* const byValue = (a, b) => a < b ? - 1 : a > b ? 1 : 0;
|
|
7733
7732
|
* const comparator = conditional(shouldSortByValue)(byValue);
|
|
7734
7733
|
*
|
|
@@ -7893,6 +7892,18 @@ const ifInvisibleBy = conditional((a, b) => {
|
|
|
7893
7892
|
return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
|
|
7894
7893
|
((_b = b.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.INVISIBLE;
|
|
7895
7894
|
});
|
|
7895
|
+
/**
|
|
7896
|
+
* A comparator that applies the decorated comparator when a participant is
|
|
7897
|
+
* either invisible or its visibility state isn't known.
|
|
7898
|
+
* For visible participants, it ensures stable sorting.
|
|
7899
|
+
*/
|
|
7900
|
+
const ifInvisibleOrUnknownBy = conditional((a, b) => {
|
|
7901
|
+
var _a, _b, _c, _d;
|
|
7902
|
+
return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
|
|
7903
|
+
((_b = a.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.UNKNOWN ||
|
|
7904
|
+
((_c = b.viewportVisibilityState) === null || _c === void 0 ? void 0 : _c.videoTrack) === VisibilityState.INVISIBLE ||
|
|
7905
|
+
((_d = b.viewportVisibilityState) === null || _d === void 0 ? void 0 : _d.videoTrack) === VisibilityState.UNKNOWN;
|
|
7906
|
+
});
|
|
7896
7907
|
/**
|
|
7897
7908
|
* The default sorting preset.
|
|
7898
7909
|
*/
|
|
@@ -7901,6 +7912,11 @@ const defaultSortPreset = combineComparators(pinned, screenSharing, ifInvisibleB
|
|
|
7901
7912
|
* The sorting preset for speaker layout.
|
|
7902
7913
|
*/
|
|
7903
7914
|
const speakerLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleBy(speaking), ifInvisibleBy(reactionType('raised-hand')), ifInvisibleBy(publishingVideo), ifInvisibleBy(publishingAudio));
|
|
7915
|
+
/**
|
|
7916
|
+
* The sorting preset for layouts that don't render all participants but
|
|
7917
|
+
* instead, render them in pages.
|
|
7918
|
+
*/
|
|
7919
|
+
const paginatedLayoutSortPreset = combineComparators(pinned, screenSharing, dominantSpeaker, ifInvisibleOrUnknownBy(speaking), ifInvisibleOrUnknownBy(reactionType('raised-hand')), ifInvisibleOrUnknownBy(publishingVideo), ifInvisibleOrUnknownBy(publishingAudio));
|
|
7904
7920
|
/**
|
|
7905
7921
|
* The sorting preset for livestreams and audio rooms.
|
|
7906
7922
|
*/
|
|
@@ -8318,12 +8334,14 @@ class CallState {
|
|
|
8318
8334
|
}
|
|
8319
8335
|
};
|
|
8320
8336
|
this.logger = getLogger(['CallState']);
|
|
8321
|
-
this.participants$ = this.participantsSubject.
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
this.
|
|
8325
|
-
this.
|
|
8326
|
-
this.
|
|
8337
|
+
this.participants$ = this.participantsSubject.asObservable().pipe(
|
|
8338
|
+
// TODO: replace with Array.toSorted once available
|
|
8339
|
+
map$1((ps) => [...ps].sort(this.sortParticipantsBy)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8340
|
+
this.localParticipant$ = this.participants$.pipe(map$1((participants) => participants.find(isStreamVideoLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8341
|
+
this.remoteParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !p.isLocalParticipant)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8342
|
+
this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8343
|
+
this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8344
|
+
this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
8327
8345
|
this.startedAt$ = this.startedAtSubject.asObservable();
|
|
8328
8346
|
this.participantCount$ = this.participantCountSubject.asObservable();
|
|
8329
8347
|
this.anonymousParticipantCount$ =
|
|
@@ -9501,7 +9519,7 @@ class DynascaleManager {
|
|
|
9501
9519
|
}
|
|
9502
9520
|
this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
|
|
9503
9521
|
};
|
|
9504
|
-
const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay(1));
|
|
9522
|
+
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 }));
|
|
9505
9523
|
/**
|
|
9506
9524
|
* Since the video elements are now being removed from the DOM (React SDK) upon
|
|
9507
9525
|
* visibility change, this subscription is not in use an stays here only for the
|
|
@@ -9620,7 +9638,7 @@ class DynascaleManager {
|
|
|
9620
9638
|
const participant = this.call.state.findParticipantBySessionId(sessionId);
|
|
9621
9639
|
if (!participant || participant.isLocalParticipant)
|
|
9622
9640
|
return;
|
|
9623
|
-
const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((p) => p.sessionId === sessionId)), takeWhile((p) => !!p), distinctUntilChanged$1());
|
|
9641
|
+
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 }));
|
|
9624
9642
|
const updateMediaStreamSubscription = participant$
|
|
9625
9643
|
.pipe(distinctUntilKeyChanged('audioStream'))
|
|
9626
9644
|
.subscribe((p) => {
|
|
@@ -9861,9 +9879,9 @@ const deviceChange$ = new Observable((subscriber) => {
|
|
|
9861
9879
|
var _a, _b;
|
|
9862
9880
|
return (_b = (_a = navigator.mediaDevices).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, 'devicechange', deviceChangeHandler);
|
|
9863
9881
|
};
|
|
9864
|
-
}).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay(1));
|
|
9865
|
-
const audioDevices$ = merge(getDevices(audioDeviceConstraints), deviceChange$).pipe(shareReplay(1));
|
|
9866
|
-
const videoDevices$ = merge(getDevices(videoDeviceConstraints), deviceChange$).pipe(shareReplay(1));
|
|
9882
|
+
}).pipe(debounceTime(500), concatMap(() => from(navigator.mediaDevices.enumerateDevices())), shareReplay$1(1));
|
|
9883
|
+
const audioDevices$ = merge(getDevices(audioDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
|
|
9884
|
+
const videoDevices$ = merge(getDevices(videoDeviceConstraints), deviceChange$).pipe(shareReplay$1(1));
|
|
9867
9885
|
/**
|
|
9868
9886
|
* 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.
|
|
9869
9887
|
*
|
|
@@ -13166,7 +13184,7 @@ class WSConnectionFallback {
|
|
|
13166
13184
|
}
|
|
13167
13185
|
}
|
|
13168
13186
|
|
|
13169
|
-
const version = '0.3.
|
|
13187
|
+
const version = '0.3.25';
|
|
13170
13188
|
|
|
13171
13189
|
const logger = getLogger(['location']);
|
|
13172
13190
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -14146,5 +14164,5 @@ class StreamVideoServerClient extends StreamVideoClient {
|
|
|
14146
14164
|
}
|
|
14147
14165
|
}
|
|
14148
14166
|
|
|
14149
|
-
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 };
|
|
14167
|
+
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 };
|
|
14150
14168
|
//# sourceMappingURL=index.es.js.map
|