@stream-io/video-client 2.0.0-beta.0 → 2.0.0-beta.1
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 +18 -0
- package/dist/index.browser.es.js +1126 -791
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +1126 -791
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1126 -791
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +37 -11
- package/dist/src/StreamVideoClient.d.ts +15 -21
- package/dist/src/coordinator/connection/types.d.ts +16 -0
- package/dist/src/events/call.d.ts +0 -11
- package/dist/src/gen/coordinator/index.d.ts +73 -0
- package/dist/src/reporting/ClientEventReporter.d.ts +11 -1
- package/dist/src/ringing/RingStatePoller.d.ts +46 -0
- package/dist/src/ringing/RingTimeout.d.ts +27 -0
- package/dist/src/ringing/index.d.ts +4 -0
- package/dist/src/ringing/reconcileRingState.d.ts +18 -0
- package/dist/src/ringing/resolveOwnRingOutcome.d.ts +32 -0
- package/dist/src/rtc/Publisher.d.ts +18 -0
- package/dist/src/rtc/TransceiverCache.d.ts +10 -0
- package/dist/src/rtc/e2ee/E2EEManager.d.ts +10 -1
- package/dist/src/stats/utils.d.ts +6 -0
- package/dist/src/store/CallState.d.ts +118 -267
- package/dist/src/store/ClientState.d.ts +62 -0
- package/dist/src/store/index.d.ts +1 -1
- package/dist/src/store/subjects.d.ts +15 -0
- package/dist/src/store/types.d.ts +22 -0
- package/dist/src/types.d.ts +33 -4
- package/index.ts +1 -0
- package/package.json +2 -2
- package/src/Call.ts +285 -125
- package/src/StreamSfuClient.ts +6 -2
- package/src/StreamVideoClient.ts +40 -47
- package/src/__tests__/Call.autodrop.test.ts +118 -66
- package/src/__tests__/Call.getRingState.test.ts +87 -0
- package/src/__tests__/Call.lifecycle.test.ts +499 -6
- package/src/__tests__/Call.publishing.test.ts +2 -2
- package/src/__tests__/Call.ringSettled.test.ts +71 -0
- package/src/__tests__/Call.ringingLifecycle.test.ts +242 -0
- package/src/__tests__/StreamSfuClient.test.ts +48 -0
- package/src/__tests__/StreamVideoClient.disconnect.test.ts +62 -0
- package/src/coordinator/connection/types.ts +19 -0
- package/src/devices/__tests__/CameraManager.test.ts +2 -2
- package/src/devices/__tests__/DeviceManager.test.ts +2 -2
- package/src/devices/__tests__/DeviceManagerFilters.test.ts +2 -2
- package/src/devices/__tests__/MicrophoneManager.test.ts +2 -2
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +2 -2
- package/src/devices/__tests__/ScreenShareManager.test.ts +3 -3
- package/src/devices/__tests__/SpeakerManager.test.ts +4 -4
- package/src/events/__tests__/call.test.ts +5 -220
- package/src/events/call.ts +1 -73
- package/src/events/callEventHandlers.ts +12 -23
- package/src/gen/coordinator/index.ts +67 -0
- package/src/helpers/__tests__/AudioBindingsWatchdog.test.ts +2 -2
- package/src/helpers/__tests__/DynascaleManager.test.ts +2 -2
- package/src/helpers/__tests__/ViewportTracker.test.ts +2 -2
- package/src/reporting/ClientEventReporter.ts +30 -4
- package/src/reporting/__tests__/ClientEventReporter.test.ts +184 -7
- package/src/ringing/RingStatePoller.ts +177 -0
- package/src/ringing/RingTimeout.ts +90 -0
- package/src/ringing/__tests__/RingStatePoller.test.ts +462 -0
- package/src/ringing/__tests__/RingTimeout.test.ts +199 -0
- package/src/ringing/__tests__/reconcileRingState.test.ts +330 -0
- package/src/ringing/__tests__/resolveOwnRingOutcome.test.ts +103 -0
- package/src/ringing/index.ts +4 -0
- package/src/ringing/reconcileRingState.ts +108 -0
- package/src/ringing/resolveOwnRingOutcome.ts +58 -0
- package/src/rtc/Publisher.ts +66 -12
- package/src/rtc/TransceiverCache.ts +17 -0
- package/src/rtc/__tests__/Call.reconnect.test.ts +5 -5
- package/src/rtc/__tests__/Publisher.test.ts +209 -0
- package/src/rtc/__tests__/mocks/webrtc.mocks.ts +1 -0
- package/src/rtc/e2ee/E2EEManager.ts +10 -1
- package/src/rtc/e2ee/EncryptionManager.ts +1 -1
- package/src/rtc/e2ee/SPEC.md +1 -1
- package/src/stats/__tests__/utils.test.ts +33 -0
- package/src/stats/utils.ts +15 -0
- package/src/store/CallState.ts +305 -550
- package/src/store/ClientState.ts +101 -0
- package/src/store/__tests__/CallState.test.ts +60 -1
- package/src/store/__tests__/ClientState.test.ts +35 -0
- package/src/store/__tests__/rxUtils.test.ts +67 -1
- package/src/store/index.ts +1 -1
- package/src/store/rxUtils.ts +8 -4
- package/src/store/subjects.ts +30 -0
- package/src/store/types.ts +45 -0
- package/src/types.ts +40 -4
- package/dist/src/store/stateStore.d.ts +0 -84
- package/src/store/stateStore.ts +0 -156
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Patch } from './rxUtils';
|
|
1
|
+
import { type Patch } from './rxUtils';
|
|
3
2
|
import { CallingState } from './CallingState';
|
|
4
3
|
import { type ClosedCaptionsSettings, type StreamVideoParticipant, type StreamVideoParticipantPatch, type StreamVideoParticipantPatches, type SubscriptionChanges, VideoTrackType } from '../types';
|
|
5
4
|
import { CallStatsReport } from '../stats';
|
|
6
|
-
import { CallClosedCaption, CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, EgressResponse, MemberResponse, OwnCapability, ThumbnailResponse, UserResponse, VideoEvent } from '../gen/coordinator';
|
|
5
|
+
import { CallClosedCaption, CallIngressResponse, CallResponse, CallSessionResponse, CallSettingsResponse, GetCallRingStateResponse, EgressResponse, MemberResponse, OwnCapability, ThumbnailResponse, UserResponse, VideoEvent } from '../gen/coordinator';
|
|
7
6
|
import { ReconnectDetails } from '../gen/video/sfu/event/events';
|
|
8
7
|
import { CallGrants, CallState as SfuCallState, Pin, TrackType } from '../gen/video/sfu/models/models';
|
|
9
8
|
import { Comparator } from '../sorting';
|
|
@@ -19,6 +18,9 @@ type OrphanedTrack = {
|
|
|
19
18
|
* @react You don't have to use this class directly, as we are exposing the state through Hooks.
|
|
20
19
|
*/
|
|
21
20
|
export declare class CallState {
|
|
21
|
+
readonly logger: import("@stream-io/logger").Logger<string & {}>;
|
|
22
|
+
/** A list of comparators that are used to sort the participants. */
|
|
23
|
+
private sortParticipantsBy;
|
|
22
24
|
private backstageSubject;
|
|
23
25
|
private blockedUserIdsSubject;
|
|
24
26
|
private createdAtSubject;
|
|
@@ -48,59 +50,86 @@ export declare class CallState {
|
|
|
48
50
|
private participantsSubject;
|
|
49
51
|
private callStatsReportSubject;
|
|
50
52
|
private closedCaptionsSubject;
|
|
51
|
-
private orphanedTracks;
|
|
52
53
|
private callGrantsSubject;
|
|
54
|
+
/** The backstage state. */
|
|
55
|
+
backstage$: import("rxjs").Observable<boolean>;
|
|
56
|
+
/** Will provide the list of blocked user IDs. */
|
|
57
|
+
blockedUserIds$: import("rxjs").Observable<string[]>;
|
|
58
|
+
/** Will provide the time when this call has been created. */
|
|
59
|
+
createdAt$: import("rxjs").Observable<Date>;
|
|
60
|
+
/** Will provide the time when this call has been ended. */
|
|
61
|
+
endedAt$: import("rxjs").Observable<Date | undefined>;
|
|
62
|
+
/** Will provide the time when this call has been scheduled to start. */
|
|
63
|
+
startsAt$: import("rxjs").Observable<Date | undefined>;
|
|
64
|
+
/** Will provide the time when this call has been updated. */
|
|
65
|
+
updatedAt$: import("rxjs").Observable<Date>;
|
|
66
|
+
/** Will provide the user who created this call. */
|
|
67
|
+
createdBy$: import("rxjs").Observable<UserResponse | undefined>;
|
|
68
|
+
/** Will provide the custom data of this call. */
|
|
69
|
+
custom$: import("rxjs").Observable<Record<string, any>>;
|
|
70
|
+
/** Will provide the egress data of this call. */
|
|
71
|
+
egress$: import("rxjs").Observable<EgressResponse | undefined>;
|
|
72
|
+
/** Will provide the ingress data of this call. */
|
|
73
|
+
ingress$: import("rxjs").Observable<CallIngressResponse | undefined>;
|
|
74
|
+
/** Will provide the recording state of this call. */
|
|
75
|
+
recording$: import("rxjs").Observable<boolean>;
|
|
76
|
+
/** Will provide the recording state of this call. */
|
|
77
|
+
individualRecording$: import("rxjs").Observable<boolean>;
|
|
78
|
+
/** Will provide the recording state of this call. */
|
|
79
|
+
rawRecording$: import("rxjs").Observable<boolean>;
|
|
80
|
+
/** Will provide the session data of this call. */
|
|
81
|
+
session$: import("rxjs").Observable<CallSessionResponse | undefined>;
|
|
82
|
+
/** Will provide the settings of this call. */
|
|
83
|
+
settings$: import("rxjs").Observable<CallSettingsResponse | undefined>;
|
|
84
|
+
/** Will provide the transcribing state of this call. */
|
|
85
|
+
transcribing$: import("rxjs").Observable<boolean>;
|
|
86
|
+
/** Will provide the closed captioning state of this call. */
|
|
87
|
+
captioning$: import("rxjs").Observable<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Whether end-to-end encryption is active for this call, as reported by the
|
|
90
|
+
* SFU in the join response.
|
|
91
|
+
*/
|
|
92
|
+
e2eeEnabled$: import("rxjs").Observable<boolean>;
|
|
93
|
+
/** Will provide the user who ended this call. */
|
|
94
|
+
endedBy$: import("rxjs").Observable<UserResponse | undefined>;
|
|
95
|
+
/** Will provide the thumbnails of this call. */
|
|
96
|
+
thumbnails$: import("rxjs").Observable<ThumbnailResponse | undefined>;
|
|
97
|
+
/** The list of members in the current call. */
|
|
98
|
+
members$: import("rxjs").Observable<MemberResponse[]>;
|
|
99
|
+
/** The calling state. */
|
|
100
|
+
callingState$: import("rxjs").Observable<CallingState>;
|
|
53
101
|
/**
|
|
54
102
|
* The time the call session actually started.
|
|
55
103
|
* Useful for displaying the call duration.
|
|
56
104
|
*/
|
|
57
|
-
startedAt$: Observable<Date | undefined>;
|
|
105
|
+
startedAt$: import("rxjs").Observable<Date | undefined>;
|
|
58
106
|
/**
|
|
59
107
|
* The server-side counted number of participants connected to the current call.
|
|
60
108
|
* This number includes the anonymous participants as well.
|
|
61
109
|
*/
|
|
62
|
-
participantCount$: Observable<number>;
|
|
110
|
+
participantCount$: import("rxjs").Observable<number>;
|
|
63
111
|
/**
|
|
64
112
|
* The server-side counted number of anonymous participants connected to the current call.
|
|
65
113
|
* This number excludes the regular participants.
|
|
66
114
|
*/
|
|
67
|
-
anonymousParticipantCount$: Observable<number>;
|
|
115
|
+
anonymousParticipantCount$: import("rxjs").Observable<number>;
|
|
68
116
|
/**
|
|
69
117
|
* All participants of the current call (this includes the current user and other participants as well),
|
|
70
118
|
* unsorted. This observable only updates when participants join or leave the call.
|
|
71
119
|
*/
|
|
72
|
-
rawParticipants$: Observable<StreamVideoParticipant[]>;
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
participants
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
localParticipant$: Observable<StreamVideoParticipant | undefined>;
|
|
86
|
-
/**
|
|
87
|
-
* Pinned participants of the current call.
|
|
88
|
-
*/
|
|
89
|
-
pinnedParticipants$: Observable<StreamVideoParticipant[]>;
|
|
90
|
-
/**
|
|
91
|
-
* The currently elected dominant speaker in the current call.
|
|
92
|
-
*/
|
|
93
|
-
dominantSpeaker$: Observable<StreamVideoParticipant | undefined>;
|
|
94
|
-
/**
|
|
95
|
-
* Emits true whenever there is an active screen sharing session within
|
|
96
|
-
* the current call. Useful for displaying a "screen sharing" indicator and
|
|
97
|
-
* switching the layout to a screen sharing layout.
|
|
98
|
-
*
|
|
99
|
-
* The actual screen sharing track isn't exposed here, but can be retrieved
|
|
100
|
-
* from the list of call participants. We also don't want to be limiting
|
|
101
|
-
* to the number of share screen tracks are displayed in a call.
|
|
102
|
-
*/
|
|
103
|
-
hasOngoingScreenShare$: Observable<boolean>;
|
|
120
|
+
rawParticipants$: import("rxjs").Observable<StreamVideoParticipant[]>;
|
|
121
|
+
/** All participants of the current call sorted according to the current `sortByParticipantsBy` setting. */
|
|
122
|
+
participants$: import("rxjs").Observable<StreamVideoParticipant[]>;
|
|
123
|
+
/** The local participant of the current call. */
|
|
124
|
+
localParticipant$: import("rxjs").Observable<StreamVideoParticipant | undefined>;
|
|
125
|
+
/** Remote participants of the current call (all except the local participant). */
|
|
126
|
+
remoteParticipants$: import("rxjs").Observable<StreamVideoParticipant[]>;
|
|
127
|
+
/** Pinned participants of the current call. */
|
|
128
|
+
pinnedParticipants$: import("rxjs").Observable<StreamVideoParticipant[]>;
|
|
129
|
+
/** The currently elected dominant speaker in the current call. */
|
|
130
|
+
dominantSpeaker$: import("rxjs").Observable<StreamVideoParticipant | undefined>;
|
|
131
|
+
/** Emits true whenever there is an active screen sharing session within the current call. */
|
|
132
|
+
hasOngoingScreenShare$: import("rxjs").Observable<boolean>;
|
|
104
133
|
/**
|
|
105
134
|
* The latest stats report of the current call.
|
|
106
135
|
* When stats gathering is enabled, this observable will emit a new value
|
|
@@ -109,123 +138,19 @@ export declare class CallState {
|
|
|
109
138
|
* Consumers of this observable can implement their own batching logic
|
|
110
139
|
* in case they want to show historical stats data.
|
|
111
140
|
*/
|
|
112
|
-
callStatsReport$: Observable<CallStatsReport | undefined>;
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
ownCapabilities$: Observable<OwnCapability[]>;
|
|
121
|
-
/**
|
|
122
|
-
* The calling state.
|
|
123
|
-
*/
|
|
124
|
-
callingState$: Observable<CallingState>;
|
|
125
|
-
/**
|
|
126
|
-
* The backstage state.
|
|
127
|
-
*/
|
|
128
|
-
backstage$: Observable<boolean>;
|
|
129
|
-
/**
|
|
130
|
-
* Will provide the list of blocked user IDs.
|
|
131
|
-
*/
|
|
132
|
-
blockedUserIds$: Observable<string[]>;
|
|
133
|
-
/**
|
|
134
|
-
* Will provide the time when this call has been created.
|
|
135
|
-
*/
|
|
136
|
-
createdAt$: Observable<Date>;
|
|
137
|
-
/**
|
|
138
|
-
* Will provide the time when this call has been ended.
|
|
139
|
-
*/
|
|
140
|
-
endedAt$: Observable<Date | undefined>;
|
|
141
|
-
/**
|
|
142
|
-
* Will provide the time when this call has been scheduled to start.
|
|
143
|
-
*/
|
|
144
|
-
startsAt$: Observable<Date | undefined>;
|
|
145
|
-
/**
|
|
146
|
-
* Will provide the time when this call has been updated.
|
|
147
|
-
*/
|
|
148
|
-
updatedAt$: Observable<Date>;
|
|
149
|
-
/**
|
|
150
|
-
* Will provide the user who created this call.
|
|
151
|
-
*/
|
|
152
|
-
createdBy$: Observable<UserResponse | undefined>;
|
|
153
|
-
/**
|
|
154
|
-
* Will provide the custom data of this call.
|
|
155
|
-
*/
|
|
156
|
-
custom$: Observable<Record<string, any>>;
|
|
157
|
-
/**
|
|
158
|
-
* Will provide the egress data of this call.
|
|
159
|
-
*/
|
|
160
|
-
egress$: Observable<EgressResponse | undefined>;
|
|
161
|
-
/**
|
|
162
|
-
* Will provide the ingress data of this call.
|
|
163
|
-
*/
|
|
164
|
-
ingress$: Observable<CallIngressResponse | undefined>;
|
|
165
|
-
/**
|
|
166
|
-
* Will provide the recording state of this call.
|
|
167
|
-
*/
|
|
168
|
-
recording$: Observable<boolean>;
|
|
169
|
-
/**
|
|
170
|
-
* Will provide the recording state of this call.
|
|
171
|
-
*/
|
|
172
|
-
individualRecording$: Observable<boolean>;
|
|
173
|
-
/**
|
|
174
|
-
* Will provide the recording state of this call.
|
|
175
|
-
*/
|
|
176
|
-
rawRecording$: Observable<boolean>;
|
|
177
|
-
/**
|
|
178
|
-
* Will provide the session data of this call.
|
|
179
|
-
*/
|
|
180
|
-
session$: Observable<CallSessionResponse | undefined>;
|
|
181
|
-
/**
|
|
182
|
-
* Will provide the settings of this call.
|
|
183
|
-
*/
|
|
184
|
-
settings$: Observable<CallSettingsResponse | undefined>;
|
|
185
|
-
/**
|
|
186
|
-
* Will provide the transcribing state of this call.
|
|
187
|
-
*/
|
|
188
|
-
transcribing$: Observable<boolean>;
|
|
189
|
-
/**
|
|
190
|
-
* Will provide the closed captioning state of this call.
|
|
191
|
-
*/
|
|
192
|
-
captioning$: Observable<boolean>;
|
|
193
|
-
/**
|
|
194
|
-
* Whether end-to-end encryption is active for this call, as reported by the
|
|
195
|
-
* SFU in the join response.
|
|
196
|
-
*/
|
|
197
|
-
e2eeEnabled$: Observable<boolean>;
|
|
198
|
-
/**
|
|
199
|
-
* Will provide the user who ended this call.
|
|
200
|
-
*/
|
|
201
|
-
endedBy$: Observable<UserResponse | undefined>;
|
|
202
|
-
/**
|
|
203
|
-
* Will provide the thumbnails of this call.
|
|
204
|
-
*/
|
|
205
|
-
thumbnails$: Observable<ThumbnailResponse | undefined>;
|
|
206
|
-
/**
|
|
207
|
-
* The queue of closed captions.
|
|
208
|
-
*/
|
|
209
|
-
closedCaptions$: Observable<CallClosedCaption[]>;
|
|
210
|
-
readonly logger: import("@stream-io/logger").Logger<string & {}>;
|
|
211
|
-
/**
|
|
212
|
-
* A list of comparators that are used to sort the participants.
|
|
213
|
-
*/
|
|
214
|
-
private sortParticipantsBy;
|
|
215
|
-
/**
|
|
216
|
-
* The closed captions configuration.
|
|
217
|
-
*/
|
|
141
|
+
callStatsReport$: import("rxjs").Observable<CallStatsReport | undefined>;
|
|
142
|
+
/** The queue of closed captions. */
|
|
143
|
+
closedCaptions$: import("rxjs").Observable<CallClosedCaption[]>;
|
|
144
|
+
/** The list of capabilities of the current user. */
|
|
145
|
+
ownCapabilities$: import("rxjs").Observable<OwnCapability[]>;
|
|
146
|
+
private orphanedTracks;
|
|
147
|
+
/** The closed captions configuration. */
|
|
218
148
|
private closedCaptionsSettings;
|
|
219
149
|
private closedCaptionsTasks;
|
|
220
150
|
private readonly eventHandlers;
|
|
221
|
-
/**
|
|
222
|
-
* Creates a new instance of the CallState class.
|
|
223
|
-
*
|
|
224
|
-
*/
|
|
151
|
+
/** Creates a new instance of the CallState class. */
|
|
225
152
|
constructor();
|
|
226
|
-
/**
|
|
227
|
-
* Runs the cleanup tasks.
|
|
228
|
-
*/
|
|
153
|
+
/** Runs the cleanup tasks. */
|
|
229
154
|
dispose: () => void;
|
|
230
155
|
/**
|
|
231
156
|
* Sets the list of criteria that are used to sort the participants.
|
|
@@ -234,29 +159,8 @@ export declare class CallState {
|
|
|
234
159
|
* @param comparator the comparator to use to sort the participants.
|
|
235
160
|
*/
|
|
236
161
|
setSortParticipantsBy: (comparator: Comparator<StreamVideoParticipant>) => void;
|
|
237
|
-
/**
|
|
238
|
-
* Returns the comparator currently used to sort the participants.
|
|
239
|
-
*/
|
|
162
|
+
/** Returns the comparator currently used to sort the participants. */
|
|
240
163
|
getSortParticipantsBy: () => Comparator<StreamVideoParticipant>;
|
|
241
|
-
/**
|
|
242
|
-
* Gets the current value of an observable, or undefined if the observable has
|
|
243
|
-
* not emitted a value yet.
|
|
244
|
-
*
|
|
245
|
-
* @param observable$ the observable to get the value from.
|
|
246
|
-
*/
|
|
247
|
-
getCurrentValue: <T>(observable$: Observable<T>) => T;
|
|
248
|
-
/**
|
|
249
|
-
* Updates the value of the provided Subject.
|
|
250
|
-
* An `update` can either be a new value or a function which takes
|
|
251
|
-
* the current value and returns a new value.
|
|
252
|
-
*
|
|
253
|
-
* @internal
|
|
254
|
-
*
|
|
255
|
-
* @param subject the subject to update.
|
|
256
|
-
* @param update the update to apply to the subject.
|
|
257
|
-
* @return the updated value.
|
|
258
|
-
*/
|
|
259
|
-
setCurrentValue: <T>(subject: import("rxjs").Subject<T>, update: Patch<T>) => T;
|
|
260
164
|
/**
|
|
261
165
|
* The server-side counted number of participants connected to the current call.
|
|
262
166
|
* This number includes the anonymous participants as well.
|
|
@@ -281,9 +185,7 @@ export declare class CallState {
|
|
|
281
185
|
* @param startedAt the time the call session actually started.
|
|
282
186
|
*/
|
|
283
187
|
setStartedAt: (startedAt: Patch<Date | undefined>) => Date | undefined;
|
|
284
|
-
/**
|
|
285
|
-
* Returns whether closed captions are enabled in the current call.
|
|
286
|
-
*/
|
|
188
|
+
/** Returns whether closed captions are enabled in the current call. */
|
|
287
189
|
get captioning(): boolean;
|
|
288
190
|
/**
|
|
289
191
|
* Sets the closed captioning state of the current call.
|
|
@@ -308,13 +210,9 @@ export declare class CallState {
|
|
|
308
210
|
* @param count the number of anonymous participants.
|
|
309
211
|
*/
|
|
310
212
|
setAnonymousParticipantCount: (count: Patch<number>) => number;
|
|
311
|
-
/**
|
|
312
|
-
* The list of participants in the current call.
|
|
313
|
-
*/
|
|
213
|
+
/** The list of participants in the current call. */
|
|
314
214
|
get participants(): StreamVideoParticipant[];
|
|
315
|
-
/**
|
|
316
|
-
* The stable list of participants in the current call, unsorted.
|
|
317
|
-
*/
|
|
215
|
+
/** The stable list of participants in the current call, unsorted. */
|
|
318
216
|
get rawParticipants(): StreamVideoParticipant[];
|
|
319
217
|
/**
|
|
320
218
|
* Returns the current participants array directly from the BehaviorSubject.
|
|
@@ -333,29 +231,17 @@ export declare class CallState {
|
|
|
333
231
|
* @param participants the list of participants.
|
|
334
232
|
*/
|
|
335
233
|
setParticipants: (participants: Patch<StreamVideoParticipant[]>) => StreamVideoParticipant[];
|
|
336
|
-
/**
|
|
337
|
-
* The local participant in the current call.
|
|
338
|
-
*/
|
|
234
|
+
/** The local participant in the current call. */
|
|
339
235
|
get localParticipant(): StreamVideoParticipant | undefined;
|
|
340
|
-
/**
|
|
341
|
-
* The list of remote participants in the current call.
|
|
342
|
-
*/
|
|
236
|
+
/** The list of remote participants in the current call. */
|
|
343
237
|
get remoteParticipants(): StreamVideoParticipant[];
|
|
344
|
-
/**
|
|
345
|
-
* The dominant speaker in the current call.
|
|
346
|
-
*/
|
|
238
|
+
/** The dominant speaker in the current call. */
|
|
347
239
|
get dominantSpeaker(): StreamVideoParticipant | undefined;
|
|
348
|
-
/**
|
|
349
|
-
* The list of pinned participants in the current call.
|
|
350
|
-
*/
|
|
240
|
+
/** The list of pinned participants in the current call. */
|
|
351
241
|
get pinnedParticipants(): StreamVideoParticipant[];
|
|
352
|
-
/**
|
|
353
|
-
* Tell if there is an ongoing screen share in this call.
|
|
354
|
-
*/
|
|
242
|
+
/** Tell if there is an ongoing screen share in this call. */
|
|
355
243
|
get hasOngoingScreenShare(): boolean;
|
|
356
|
-
/**
|
|
357
|
-
* The calling state.
|
|
358
|
-
*/
|
|
244
|
+
/** The calling state. */
|
|
359
245
|
get callingState(): CallingState;
|
|
360
246
|
/**
|
|
361
247
|
* Sets the calling state.
|
|
@@ -364,9 +250,7 @@ export declare class CallState {
|
|
|
364
250
|
* @param state the new calling state.
|
|
365
251
|
*/
|
|
366
252
|
setCallingState: (state: Patch<CallingState>) => CallingState;
|
|
367
|
-
/**
|
|
368
|
-
* The call stats report.
|
|
369
|
-
*/
|
|
253
|
+
/** The call stats report. */
|
|
370
254
|
get callStatsReport(): CallStatsReport | undefined;
|
|
371
255
|
/**
|
|
372
256
|
* Returns whether the call stats report is being observed or not.
|
|
@@ -380,9 +264,7 @@ export declare class CallState {
|
|
|
380
264
|
* @param report the report to set.
|
|
381
265
|
*/
|
|
382
266
|
setCallStatsReport: (report: Patch<CallStatsReport | undefined>) => CallStatsReport | undefined;
|
|
383
|
-
/**
|
|
384
|
-
* The members of the current call.
|
|
385
|
-
*/
|
|
267
|
+
/** The members of the current call. */
|
|
386
268
|
get members(): MemberResponse[];
|
|
387
269
|
/**
|
|
388
270
|
* Sets the members of the current call.
|
|
@@ -391,9 +273,7 @@ export declare class CallState {
|
|
|
391
273
|
* @param members the members to set.
|
|
392
274
|
*/
|
|
393
275
|
setMembers: (members: Patch<MemberResponse[]>) => void;
|
|
394
|
-
/**
|
|
395
|
-
* The capabilities of the current user for the current call.
|
|
396
|
-
*/
|
|
276
|
+
/** The capabilities of the current user for the current call. */
|
|
397
277
|
get ownCapabilities(): OwnCapability[];
|
|
398
278
|
/**
|
|
399
279
|
* Sets the own capabilities.
|
|
@@ -409,95 +289,59 @@ export declare class CallState {
|
|
|
409
289
|
* @param grants the grants to set.
|
|
410
290
|
*/
|
|
411
291
|
setCallGrants: (grants: Patch<CallGrants>) => CallGrants;
|
|
412
|
-
/**
|
|
413
|
-
* The backstage state.
|
|
414
|
-
*/
|
|
292
|
+
/** The backstage state. */
|
|
415
293
|
get backstage(): boolean;
|
|
416
294
|
/**
|
|
417
295
|
* Sets the backstage state.
|
|
418
296
|
* @param backstage the backstage state.
|
|
419
297
|
*/
|
|
420
298
|
setBackstage: (backstage: Patch<boolean>) => boolean;
|
|
421
|
-
/**
|
|
422
|
-
* Will provide the list of blocked user IDs.
|
|
423
|
-
*/
|
|
299
|
+
/** Will provide the list of blocked user IDs. */
|
|
424
300
|
get blockedUserIds(): string[];
|
|
425
|
-
/**
|
|
426
|
-
* Will provide the time when this call has been created.
|
|
427
|
-
*/
|
|
301
|
+
/** Will provide the time when this call has been created. */
|
|
428
302
|
get createdAt(): Date;
|
|
429
|
-
/**
|
|
430
|
-
* Will provide the time when this call has been ended.
|
|
431
|
-
*/
|
|
303
|
+
/** Will provide the time when this call has been ended. */
|
|
432
304
|
get endedAt(): Date | undefined;
|
|
433
305
|
/**
|
|
434
306
|
* Sets the time when this call has been ended.
|
|
435
307
|
* @param endedAt the time when this call has been ended.
|
|
436
308
|
*/
|
|
437
309
|
setEndedAt: (endedAt: Patch<Date | undefined>) => Date | undefined;
|
|
438
|
-
/**
|
|
439
|
-
* Will provide the time when this call has been scheduled to start.
|
|
440
|
-
*/
|
|
310
|
+
/** Will provide the time when this call has been scheduled to start. */
|
|
441
311
|
get startsAt(): Date | undefined;
|
|
442
|
-
/**
|
|
443
|
-
* Will provide the time when this call has been updated.
|
|
444
|
-
*/
|
|
312
|
+
/** Will provide the time when this call has been updated. */
|
|
445
313
|
get updatedAt(): Date;
|
|
446
|
-
/**
|
|
447
|
-
* Will provide the user who created this call.
|
|
448
|
-
*/
|
|
314
|
+
/** Will provide the user who created this call. */
|
|
449
315
|
get createdBy(): UserResponse | undefined;
|
|
450
|
-
/**
|
|
451
|
-
* Will provide the custom data of this call.
|
|
452
|
-
*/
|
|
316
|
+
/** Will provide the custom data of this call. */
|
|
453
317
|
get custom(): Record<string, any>;
|
|
454
318
|
/**
|
|
455
319
|
* Will provide the egress data of this call.
|
|
456
320
|
*/
|
|
457
321
|
get egress(): EgressResponse | undefined;
|
|
458
|
-
/**
|
|
459
|
-
* Will provide the ingress data of this call.
|
|
460
|
-
*/
|
|
322
|
+
/** Will provide the ingress data of this call. */
|
|
461
323
|
get ingress(): CallIngressResponse | undefined;
|
|
462
|
-
/**
|
|
463
|
-
* Will provide the composite recording state of this call.
|
|
464
|
-
*/
|
|
324
|
+
/** Will provide the composite recording state of this call. */
|
|
465
325
|
get recording(): boolean;
|
|
466
|
-
/**
|
|
467
|
-
* Will provide the individual recording state of this call.
|
|
468
|
-
*/
|
|
326
|
+
/** Will provide the individual recording state of this call. */
|
|
469
327
|
get individualRecording(): boolean;
|
|
470
|
-
/**
|
|
471
|
-
* Will provide the raw recording state of this call.
|
|
472
|
-
*/
|
|
328
|
+
/** Will provide the raw recording state of this call. */
|
|
473
329
|
get rawRecording(): boolean;
|
|
474
|
-
/**
|
|
475
|
-
* Will provide the session data of this call.
|
|
476
|
-
*/
|
|
330
|
+
/** Will provide the session data of this call. */
|
|
477
331
|
get session(): CallSessionResponse | undefined;
|
|
478
|
-
/**
|
|
479
|
-
* Will provide the settings of this call.
|
|
480
|
-
*/
|
|
332
|
+
/** Will provide the settings of this call. */
|
|
481
333
|
get settings(): CallSettingsResponse | undefined;
|
|
482
|
-
/**
|
|
483
|
-
* Will provide the transcribing state of this call.
|
|
484
|
-
*/
|
|
334
|
+
/** Will provide the transcribing state of this call. */
|
|
485
335
|
get transcribing(): boolean;
|
|
486
|
-
/**
|
|
487
|
-
* Whether end-to-end encryption is active for this call.
|
|
488
|
-
*/
|
|
336
|
+
/** Whether end-to-end encryption is active for this call. */
|
|
489
337
|
get e2eeEnabled(): boolean;
|
|
490
|
-
/**
|
|
491
|
-
* Will provide the user who ended this call.
|
|
492
|
-
*/
|
|
338
|
+
/** Will provide the user who ended this call. */
|
|
493
339
|
get endedBy(): UserResponse | undefined;
|
|
494
340
|
/**
|
|
495
341
|
* Will provide the thumbnails of this call, if enabled in the call settings.
|
|
496
342
|
*/
|
|
497
343
|
get thumbnails(): ThumbnailResponse | undefined;
|
|
498
|
-
/**
|
|
499
|
-
* Returns the current queue of closed captions.
|
|
500
|
-
*/
|
|
344
|
+
/** Returns the current queue of closed captions. */
|
|
501
345
|
get closedCaptions(): CallClosedCaption[];
|
|
502
346
|
/**
|
|
503
347
|
* Will try to find the participant with the given sessionId in the current call.
|
|
@@ -506,9 +350,7 @@ export declare class CallState {
|
|
|
506
350
|
* @returns the participant with the given sessionId or undefined if not found.
|
|
507
351
|
*/
|
|
508
352
|
findParticipantBySessionId: (sessionId: string) => StreamVideoParticipant | undefined;
|
|
509
|
-
/**
|
|
510
|
-
* Returns a new lookup table of participants indexed by their session ID.
|
|
511
|
-
*/
|
|
353
|
+
/** Returns a new lookup table of participants indexed by their session ID. */
|
|
512
354
|
getParticipantLookupBySessionId: () => {
|
|
513
355
|
[sessionId: string]: StreamVideoParticipant | undefined;
|
|
514
356
|
};
|
|
@@ -615,6 +457,15 @@ export declare class CallState {
|
|
|
615
457
|
* @param call the call response from the server.
|
|
616
458
|
*/
|
|
617
459
|
updateFromCallResponse: (call: CallResponse) => void;
|
|
460
|
+
/**
|
|
461
|
+
* Merges a polled ring state into the current session. Only the ring fields
|
|
462
|
+
* are touched: the endpoint does not return the session roster.
|
|
463
|
+
*
|
|
464
|
+
* @internal
|
|
465
|
+
*
|
|
466
|
+
* @param ringState the ring state as returned by the coordinator.
|
|
467
|
+
*/
|
|
468
|
+
updateFromRingState: (ringState: GetCallRingStateResponse) => void;
|
|
618
469
|
/**
|
|
619
470
|
* Updates the call state with the data received from the SFU server.
|
|
620
471
|
*
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Patch } from './rxUtils';
|
|
2
|
+
import type { Call } from '../Call';
|
|
3
|
+
import type { OwnUserResponse } from '../gen/coordinator';
|
|
4
|
+
/**
|
|
5
|
+
* Holds the state of the client, and the calls it created or tracks.
|
|
6
|
+
* You can subscribe to the exposed observables to get notified about changes.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ClientState {
|
|
9
|
+
readonly logger: import("@stream-io/logger").Logger<string & {}>;
|
|
10
|
+
private connectedUserSubject;
|
|
11
|
+
private callsSubject;
|
|
12
|
+
/** Data describing a user successfully connected over WS to the coordinator. */
|
|
13
|
+
connectedUser$: import("rxjs").Observable<OwnUserResponse | undefined>;
|
|
14
|
+
/** A list of {@link Call} objects created/tracked by this client. */
|
|
15
|
+
calls$: import("rxjs").Observable<Call[]>;
|
|
16
|
+
/** The currently connected user. */
|
|
17
|
+
get connectedUser(): OwnUserResponse | undefined;
|
|
18
|
+
/** A list of {@link Call} objects created/tracked by this client. */
|
|
19
|
+
get calls(): Call[];
|
|
20
|
+
/**
|
|
21
|
+
* Sets the currently connected user.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
* @param user the user to set as connected.
|
|
25
|
+
*/
|
|
26
|
+
setConnectedUser: (user: Patch<OwnUserResponse | undefined>) => OwnUserResponse | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the list of {@link Call} objects created/tracked by this client.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
* @param calls the calls to set.
|
|
32
|
+
*/
|
|
33
|
+
setCalls: (calls: Patch<Call[]>) => Call[];
|
|
34
|
+
/**
|
|
35
|
+
* Adds a {@link Call} object to the list of calls tracked by this client.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
* @param call the call to add.
|
|
39
|
+
*/
|
|
40
|
+
registerCall: (call: Call) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Registers a {@link Call} object if it doesn't exist, otherwise updates it.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
* @param call the call to register or update.
|
|
46
|
+
*/
|
|
47
|
+
registerOrUpdateCall: (call: Call) => void | Call[];
|
|
48
|
+
/**
|
|
49
|
+
* Removes a {@link Call} object from the list of calls tracked by this client.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* @param call the call to remove.
|
|
53
|
+
*/
|
|
54
|
+
unregisterCall: (call: Call) => Call[];
|
|
55
|
+
/**
|
|
56
|
+
* Finds a {@link Call} object in the list of calls tracked by this client.
|
|
57
|
+
*
|
|
58
|
+
* @param type the type of call to find.
|
|
59
|
+
* @param id the id of the call to find.
|
|
60
|
+
*/
|
|
61
|
+
findCall: (type: string, id: string) => Call | undefined;
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
|
+
/** Creates a BehaviorSubject seeded with the given value. */
|
|
3
|
+
export declare function subject<T>(initialValue: T): BehaviorSubject<T>;
|
|
4
|
+
/** Creates a BehaviorSubject which starts out holding `undefined`. */
|
|
5
|
+
export declare function subject<T>(): BehaviorSubject<T | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* Creates an Observable from the given subject by piping it to the
|
|
8
|
+
* `distinctUntilChanged()` operator.
|
|
9
|
+
*/
|
|
10
|
+
export declare const duc: <T>(source: BehaviorSubject<T>, comparator?: (a: T, b: T) => boolean) => Observable<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Multicasts the given Observable, replaying the latest computed value to
|
|
13
|
+
* every new subscriber instead of re-running the pipeline for each of them.
|
|
14
|
+
*/
|
|
15
|
+
export declare const shared: <T>(source: Observable<T>) => Observable<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { VideoEvent } from '../gen/coordinator';
|
|
2
|
+
/** Handles a single video event of the given type. */
|
|
3
|
+
export type EventHandler<T extends VideoEvent['type']> = (event: Extract<VideoEvent, {
|
|
4
|
+
type: T;
|
|
5
|
+
}>) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Identity type constrained to real event names, so that a name which no
|
|
8
|
+
* longer exists in `VideoEvent` fails to compile instead of being ignored.
|
|
9
|
+
*/
|
|
10
|
+
type EventTypes<T extends VideoEvent['type']> = T;
|
|
11
|
+
/**
|
|
12
|
+
* Events that intentionally leave the call state untouched. Listing a name
|
|
13
|
+
* here excuses it from `CallStateEventHandlers`, which is what makes a newly
|
|
14
|
+
* introduced event fail to compile until it has been triaged.
|
|
15
|
+
*/
|
|
16
|
+
type UnhandledEventType = EventTypes<'call.frame_recording_ready' | 'call.kicked_user' | 'call.moderation_blur' | 'call.moderation_warning' | 'call.permission_request' | 'call.recording_ready' | 'call.rtmp_broadcast_failed' | 'call.rtmp_broadcast_started' | 'call.rtmp_broadcast_stopped' | 'call.stats_report_ready' | 'call.transcription_ready' | 'call.user_feedback_submitted' | 'call.user_muted' | 'connection.error' | 'connection.ok' | 'health.check' | 'user.updated' | 'custom'>;
|
|
17
|
+
export type AllEventHandlers = {
|
|
18
|
+
[T in VideoEvent['type']]: EventHandler<T>;
|
|
19
|
+
};
|
|
20
|
+
/** A handler for every event that does update the call state. */
|
|
21
|
+
export type CallStateEventHandlers = Omit<AllEventHandlers, UnhandledEventType>;
|
|
22
|
+
export {};
|