@stream-io/video-client 0.3.24 → 0.3.26
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 +82 -27
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +84 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +82 -27
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +12 -3
- package/dist/src/gen/coordinator/index.d.ts +289 -142
- package/dist/src/sorting/__tests__/presets.test.d.ts +1 -0
- package/dist/src/sorting/presets.d.ts +5 -0
- package/dist/src/store/CallState.d.ts +12 -3
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/Call.ts +42 -4
- package/src/__tests__/server-side/call-types.test.ts +3 -7
- package/src/gen/coordinator/index.ts +295 -147
- package/src/sorting/__tests__/presets.test.ts +54 -0
- package/src/sorting/presets.ts +28 -0
- package/src/store/CallState.ts +28 -7
- package/src/store/__tests__/CallState.test.ts +6 -4
package/dist/index.es.js
CHANGED
|
@@ -37,6 +37,26 @@ const CreateDeviceRequestPushProviderEnum = {
|
|
|
37
37
|
HUAWEI: 'huawei',
|
|
38
38
|
XIAOMI: 'xiaomi',
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* @export
|
|
42
|
+
*/
|
|
43
|
+
const LayoutSettingsNameEnum = {
|
|
44
|
+
SPOTLIGHT: 'spotlight',
|
|
45
|
+
GRID: 'grid',
|
|
46
|
+
SINGLE_PARTICIPANT: 'single-participant',
|
|
47
|
+
MOBILE: 'mobile',
|
|
48
|
+
CUSTOM: 'custom',
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @export
|
|
52
|
+
*/
|
|
53
|
+
const LayoutSettingsRequestNameEnum = {
|
|
54
|
+
SPOTLIGHT: 'spotlight',
|
|
55
|
+
GRID: 'grid',
|
|
56
|
+
SINGLE_PARTICIPANT: 'single-participant',
|
|
57
|
+
MOBILE: 'mobile',
|
|
58
|
+
CUSTOM: 'custom',
|
|
59
|
+
};
|
|
40
60
|
/**
|
|
41
61
|
* All possibility of string to use
|
|
42
62
|
* @export
|
|
@@ -67,25 +87,6 @@ const OwnCapability = {
|
|
|
67
87
|
UPDATE_CALL_PERMISSIONS: 'update-call-permissions',
|
|
68
88
|
UPDATE_CALL_SETTINGS: 'update-call-settings',
|
|
69
89
|
};
|
|
70
|
-
/**
|
|
71
|
-
* @export
|
|
72
|
-
*/
|
|
73
|
-
const RecordSettingsModeEnum = {
|
|
74
|
-
AVAILABLE: 'available',
|
|
75
|
-
DISABLED: 'disabled',
|
|
76
|
-
AUTO_ON: 'auto-on',
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* @export
|
|
80
|
-
*/
|
|
81
|
-
const RecordSettingsQualityEnum = {
|
|
82
|
-
AUDIO_ONLY: 'audio-only',
|
|
83
|
-
_360P: '360p',
|
|
84
|
-
_480P: '480p',
|
|
85
|
-
_720P: '720p',
|
|
86
|
-
_1080P: '1080p',
|
|
87
|
-
_1440P: '1440p',
|
|
88
|
-
};
|
|
89
90
|
/**
|
|
90
91
|
* @export
|
|
91
92
|
*/
|
|
@@ -98,7 +99,6 @@ const RecordSettingsRequestModeEnum = {
|
|
|
98
99
|
* @export
|
|
99
100
|
*/
|
|
100
101
|
const RecordSettingsRequestQualityEnum = {
|
|
101
|
-
AUDIO_ONLY: 'audio-only',
|
|
102
102
|
_360P: '360p',
|
|
103
103
|
_480P: '480p',
|
|
104
104
|
_720P: '720p',
|
|
@@ -7892,6 +7892,18 @@ const ifInvisibleBy = conditional((a, b) => {
|
|
|
7892
7892
|
return ((_a = a.viewportVisibilityState) === null || _a === void 0 ? void 0 : _a.videoTrack) === VisibilityState.INVISIBLE ||
|
|
7893
7893
|
((_b = b.viewportVisibilityState) === null || _b === void 0 ? void 0 : _b.videoTrack) === VisibilityState.INVISIBLE;
|
|
7894
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
|
+
});
|
|
7895
7907
|
/**
|
|
7896
7908
|
* The default sorting preset.
|
|
7897
7909
|
*/
|
|
@@ -7900,6 +7912,11 @@ const defaultSortPreset = combineComparators(pinned, screenSharing, ifInvisibleB
|
|
|
7900
7912
|
* The sorting preset for speaker layout.
|
|
7901
7913
|
*/
|
|
7902
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));
|
|
7903
7920
|
/**
|
|
7904
7921
|
* The sorting preset for livestreams and audio rooms.
|
|
7905
7922
|
*/
|
|
@@ -7977,6 +7994,7 @@ class CallState {
|
|
|
7977
7994
|
this.settingsSubject = new BehaviorSubject(undefined);
|
|
7978
7995
|
this.transcribingSubject = new BehaviorSubject(false);
|
|
7979
7996
|
this.endedBySubject = new BehaviorSubject(undefined);
|
|
7997
|
+
this.thumbnailsSubject = new BehaviorSubject(undefined);
|
|
7980
7998
|
this.membersSubject = new BehaviorSubject([]);
|
|
7981
7999
|
this.ownCapabilitiesSubject = new BehaviorSubject([]);
|
|
7982
8000
|
this.callingStateSubject = new BehaviorSubject(CallingState.UNKNOWN);
|
|
@@ -8237,6 +8255,7 @@ class CallState {
|
|
|
8237
8255
|
this.setCurrentValue(this.sessionSubject, call.session);
|
|
8238
8256
|
this.setCurrentValue(this.settingsSubject, call.settings);
|
|
8239
8257
|
this.setCurrentValue(this.transcribingSubject, call.transcribing);
|
|
8258
|
+
this.setCurrentValue(this.thumbnailsSubject, call.thumbnails);
|
|
8240
8259
|
};
|
|
8241
8260
|
this.updateFromMemberRemoved = (event) => {
|
|
8242
8261
|
this.setCurrentValue(this.membersSubject, (members) => members.filter((m) => event.members.indexOf(m.user_id) === -1));
|
|
@@ -8247,10 +8266,10 @@ class CallState {
|
|
|
8247
8266
|
...event.members,
|
|
8248
8267
|
]);
|
|
8249
8268
|
};
|
|
8250
|
-
this.
|
|
8269
|
+
this.updateFromHLSBroadcastStopped = () => {
|
|
8251
8270
|
this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: false })));
|
|
8252
8271
|
};
|
|
8253
|
-
this.
|
|
8272
|
+
this.updateFromHLSBroadcastStarted = (event) => {
|
|
8254
8273
|
this.setCurrentValue(this.egressSubject, (egress) => (Object.assign(Object.assign({}, egress), { broadcasting: true, hls: Object.assign(Object.assign({}, egress.hls), { playlist_url: event.hls_playlist_url }) })));
|
|
8255
8274
|
};
|
|
8256
8275
|
this.updateFromSessionParticipantLeft = (event) => {
|
|
@@ -8348,6 +8367,7 @@ class CallState {
|
|
|
8348
8367
|
this.settings$ = this.settingsSubject.asObservable();
|
|
8349
8368
|
this.transcribing$ = this.transcribingSubject.asObservable();
|
|
8350
8369
|
this.endedBy$ = this.endedBySubject.asObservable();
|
|
8370
|
+
this.thumbnails$ = this.thumbnailsSubject.asObservable();
|
|
8351
8371
|
this.eventHandlers = {
|
|
8352
8372
|
// these events are not updating the call state:
|
|
8353
8373
|
'call.permission_request': undefined,
|
|
@@ -8361,7 +8381,10 @@ class CallState {
|
|
|
8361
8381
|
// events that update call state:
|
|
8362
8382
|
'call.accepted': (e) => this.updateFromCallResponse(e.call),
|
|
8363
8383
|
'call.created': (e) => this.updateFromCallResponse(e.call),
|
|
8364
|
-
'call.notification': (e) =>
|
|
8384
|
+
'call.notification': (e) => {
|
|
8385
|
+
this.updateFromCallResponse(e.call);
|
|
8386
|
+
this.setMembers(e.members);
|
|
8387
|
+
},
|
|
8365
8388
|
'call.rejected': (e) => this.updateFromCallResponse(e.call),
|
|
8366
8389
|
'call.ring': (e) => this.updateFromCallResponse(e.call),
|
|
8367
8390
|
'call.live_started': (e) => this.updateFromCallResponse(e.call),
|
|
@@ -8374,8 +8397,8 @@ class CallState {
|
|
|
8374
8397
|
},
|
|
8375
8398
|
'call.recording_started': () => this.setCurrentValue(this.recordingSubject, true),
|
|
8376
8399
|
'call.recording_stopped': () => this.setCurrentValue(this.recordingSubject, false),
|
|
8377
|
-
'call.
|
|
8378
|
-
'call.
|
|
8400
|
+
'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
|
|
8401
|
+
'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
|
|
8379
8402
|
'call.session_participant_joined': this.updateFromSessionParticipantJoined,
|
|
8380
8403
|
'call.session_participant_left': this.updateFromSessionParticipantLeft,
|
|
8381
8404
|
'call.blocked_user': this.blockUser,
|
|
@@ -8559,6 +8582,12 @@ class CallState {
|
|
|
8559
8582
|
get endedBy() {
|
|
8560
8583
|
return this.getCurrentValue(this.endedBy$);
|
|
8561
8584
|
}
|
|
8585
|
+
/**
|
|
8586
|
+
* Will provide the thumbnails of this call, if enabled in the call settings.
|
|
8587
|
+
*/
|
|
8588
|
+
get thumbnails() {
|
|
8589
|
+
return this.getCurrentValue(this.thumbnails$);
|
|
8590
|
+
}
|
|
8562
8591
|
}
|
|
8563
8592
|
|
|
8564
8593
|
/**
|
|
@@ -11832,6 +11861,32 @@ class Call {
|
|
|
11832
11861
|
unbind();
|
|
11833
11862
|
};
|
|
11834
11863
|
};
|
|
11864
|
+
/**
|
|
11865
|
+
* Binds a DOM <img> element to this call's thumbnail (if enabled in settings).
|
|
11866
|
+
*
|
|
11867
|
+
* @param imageElement the image element to bind to.
|
|
11868
|
+
* @param opts options for the binding.
|
|
11869
|
+
*/
|
|
11870
|
+
this.bindCallThumbnailElement = (imageElement, opts = {}) => {
|
|
11871
|
+
const handleError = () => {
|
|
11872
|
+
imageElement.src =
|
|
11873
|
+
opts.fallbackImageSource ||
|
|
11874
|
+
'https://getstream.io/random_svg/?name=x&id=x';
|
|
11875
|
+
};
|
|
11876
|
+
const unsubscribe = createSubscription(this.state.thumbnails$, (thumbnails) => {
|
|
11877
|
+
if (!thumbnails)
|
|
11878
|
+
return;
|
|
11879
|
+
imageElement.addEventListener('error', handleError);
|
|
11880
|
+
const thumbnailUrl = new URL(thumbnails.image_url);
|
|
11881
|
+
thumbnailUrl.searchParams.set('w', String(imageElement.clientWidth));
|
|
11882
|
+
thumbnailUrl.searchParams.set('h', String(imageElement.clientHeight));
|
|
11883
|
+
imageElement.src = thumbnailUrl.toString();
|
|
11884
|
+
});
|
|
11885
|
+
return () => {
|
|
11886
|
+
unsubscribe();
|
|
11887
|
+
imageElement.removeEventListener('error', handleError);
|
|
11888
|
+
};
|
|
11889
|
+
};
|
|
11835
11890
|
this.type = type;
|
|
11836
11891
|
this.id = id;
|
|
11837
11892
|
this.cid = `${type}:${id}`;
|
|
@@ -13167,7 +13222,7 @@ class WSConnectionFallback {
|
|
|
13167
13222
|
}
|
|
13168
13223
|
}
|
|
13169
13224
|
|
|
13170
|
-
const version = '0.3.
|
|
13225
|
+
const version = '0.3.26';
|
|
13171
13226
|
|
|
13172
13227
|
const logger = getLogger(['location']);
|
|
13173
13228
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|
|
@@ -14147,5 +14202,5 @@ class StreamVideoServerClient extends StreamVideoClient {
|
|
|
14147
14202
|
}
|
|
14148
14203
|
}
|
|
14149
14204
|
|
|
14150
|
-
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState,
|
|
14205
|
+
export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, 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 };
|
|
14151
14206
|
//# sourceMappingURL=index.es.js.map
|