@stream-io/video-client 0.0.2-alpha.2 → 0.0.2-alpha.20
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 +97 -0
- package/dist/index.browser.es.js +226 -88
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +226 -88
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +226 -88
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +47 -23
- package/dist/src/StreamVideoClient.d.ts +1 -0
- package/dist/src/events/callEventHandlers.d.ts +12 -0
- package/dist/src/gen/coordinator/index.d.ts +60 -76
- package/dist/src/helpers/sound-detector.d.ts +10 -1
- package/dist/src/rtc/flows/join.d.ts +1 -0
- package/dist/src/store/CallState.d.ts +22 -1
- package/dist/src/store/stateStore.d.ts +7 -0
- package/dist/src/types.d.ts +7 -1
- package/package.json +1 -1
- package/src/Call.ts +147 -80
- package/src/StreamVideoClient.ts +76 -41
- package/src/events/__tests__/call-permissions.test.ts +4 -8
- package/src/events/__tests__/call.test.ts +127 -15
- package/src/events/__tests__/sessions.test.ts +0 -2
- package/src/events/call-permissions.ts +3 -11
- package/src/events/call.ts +31 -8
- package/src/events/callEventHandlers.ts +17 -7
- package/src/events/sessions.ts +2 -12
- package/src/gen/coordinator/index.ts +60 -74
- package/src/helpers/sound-detector.ts +13 -9
- package/src/rtc/flows/join.ts +7 -1
- package/src/rtc/publisher.ts +7 -6
- package/src/store/CallState.ts +31 -0
- package/src/store/stateStore.ts +10 -0
- package/src/types.ts +8 -0
package/src/store/CallState.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CallRecording,
|
|
15
15
|
CallResponse,
|
|
16
16
|
MemberResponse,
|
|
17
|
+
OwnCapability,
|
|
17
18
|
PermissionRequestEvent,
|
|
18
19
|
} from '../gen/coordinator';
|
|
19
20
|
import { TrackType } from '../gen/video/sfu/models/models';
|
|
@@ -91,6 +92,13 @@ export class CallState {
|
|
|
91
92
|
*/
|
|
92
93
|
private membersSubject = new BehaviorSubject<MemberResponse[]>([]);
|
|
93
94
|
|
|
95
|
+
/**
|
|
96
|
+
* The list of capabilities of the current user.
|
|
97
|
+
*
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private ownCapabilitiesSubject = new BehaviorSubject<OwnCapability[]>([]);
|
|
101
|
+
|
|
94
102
|
/**
|
|
95
103
|
* The calling state.
|
|
96
104
|
*
|
|
@@ -249,6 +257,11 @@ export class CallState {
|
|
|
249
257
|
*/
|
|
250
258
|
members$: Observable<MemberResponse[]>;
|
|
251
259
|
|
|
260
|
+
/**
|
|
261
|
+
* The list of capabilities of the current user.
|
|
262
|
+
*/
|
|
263
|
+
ownCapabilities$: Observable<OwnCapability[]>;
|
|
264
|
+
|
|
252
265
|
/**
|
|
253
266
|
* The calling state.
|
|
254
267
|
*/
|
|
@@ -307,6 +320,7 @@ export class CallState {
|
|
|
307
320
|
this.callRecordingList$ = this.callRecordingListSubject.asObservable();
|
|
308
321
|
this.metadata$ = this.metadataSubject.asObservable();
|
|
309
322
|
this.members$ = this.membersSubject.asObservable();
|
|
323
|
+
this.ownCapabilities$ = this.ownCapabilitiesSubject.asObservable();
|
|
310
324
|
this.callingState$ = this.callingStateSubject.asObservable();
|
|
311
325
|
}
|
|
312
326
|
|
|
@@ -555,6 +569,23 @@ export class CallState {
|
|
|
555
569
|
this.setCurrentValue(this.membersSubject, members);
|
|
556
570
|
};
|
|
557
571
|
|
|
572
|
+
/**
|
|
573
|
+
* The capabilities of the current user for the current call.
|
|
574
|
+
*/
|
|
575
|
+
get ownCapabilities() {
|
|
576
|
+
return this.getCurrentValue(this.ownCapabilities$);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Sets the own capabilities.
|
|
581
|
+
*
|
|
582
|
+
* @internal
|
|
583
|
+
* @param capabilities the capabilities to set.
|
|
584
|
+
*/
|
|
585
|
+
setOwnCapabilities = (capabilities: Patch<OwnCapability[]>) => {
|
|
586
|
+
return this.setCurrentValue(this.ownCapabilitiesSubject, capabilities);
|
|
587
|
+
};
|
|
588
|
+
|
|
558
589
|
/**
|
|
559
590
|
* Will try to find the participant with the given sessionId in the current call.
|
|
560
591
|
*
|
package/src/store/stateStore.ts
CHANGED
|
@@ -137,6 +137,16 @@ export class StreamVideoWriteableStateStore {
|
|
|
137
137
|
return this.setCalls((calls) => calls.filter((c) => c !== call));
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Finds a {@link Call} object in the list of {@link Call} objects created/tracked by this client.
|
|
142
|
+
*
|
|
143
|
+
* @param type the type of call to find.
|
|
144
|
+
* @param id the id of the call to find.
|
|
145
|
+
*/
|
|
146
|
+
findCall = (type: string, id: string) => {
|
|
147
|
+
return this.calls.find((c) => c.type === type && c.id === id);
|
|
148
|
+
};
|
|
149
|
+
|
|
140
150
|
/**
|
|
141
151
|
* A list of objects describing incoming calls.
|
|
142
152
|
* @deprecated derive from calls$ instead.
|
package/src/types.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
CallResponse,
|
|
7
7
|
JoinCallRequest,
|
|
8
8
|
MemberResponse,
|
|
9
|
+
OwnCapability,
|
|
9
10
|
ReactionResponse,
|
|
10
11
|
} from './gen/coordinator';
|
|
11
12
|
import type { StreamClient } from './coordinator/connection/client';
|
|
@@ -184,6 +185,13 @@ export type CallConstructor = {
|
|
|
184
185
|
*/
|
|
185
186
|
members?: MemberResponse[];
|
|
186
187
|
|
|
188
|
+
/**
|
|
189
|
+
* An optional list of {@link OwnCapability} coming from the backed.
|
|
190
|
+
* If provided, the call will be initialized with the data from this object.
|
|
191
|
+
* This is useful when initializing a new "pending call" from an event.
|
|
192
|
+
*/
|
|
193
|
+
ownCapabilities?: OwnCapability[];
|
|
194
|
+
|
|
187
195
|
/**
|
|
188
196
|
* Flags the call as a ringing call.
|
|
189
197
|
* @default false
|