@stream-io/video-client 1.56.0 → 1.58.0
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 +23 -0
- package/dist/e2ee-worker.browser.es.js +1342 -0
- package/dist/e2ee-worker.browser.es.js.map +1 -0
- package/dist/index.browser.es.js +867 -71
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +911 -70
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +900 -71
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +52 -6
- package/dist/src/coordinator/connection/connection.d.ts +1 -1
- package/dist/src/devices/CameraManager.d.ts +6 -0
- package/dist/src/devices/DeviceManager.d.ts +1 -0
- package/dist/src/devices/MicrophoneManager.d.ts +6 -0
- package/dist/src/devices/SpeakerManager.d.ts +2 -1
- package/dist/src/events/participant.d.ts +10 -3
- package/dist/src/gen/coordinator/index.d.ts +1363 -243
- package/dist/src/gen/video/sfu/models/models.d.ts +8 -0
- package/dist/src/helpers/MediaPlaybackWatchdog.d.ts +4 -0
- package/dist/src/helpers/TypedEventEmitter.d.ts +23 -0
- package/dist/src/helpers/ensureExhausted.d.ts +1 -1
- package/dist/src/permissions/PermissionsContext.d.ts +2 -2
- package/dist/src/rtc/BasePeerConnection.d.ts +3 -1
- package/dist/src/rtc/e2ee/E2EEManager.d.ts +12 -0
- package/dist/src/rtc/e2ee/EncryptionManager.d.ts +148 -0
- package/dist/src/rtc/e2ee/e2ee-worker.d.ts +25 -0
- package/dist/src/rtc/e2ee/events.d.ts +163 -0
- package/dist/src/rtc/e2ee/transformSupport.d.ts +21 -0
- package/dist/src/rtc/helpers/rtcConfiguration.d.ts +2 -2
- package/dist/src/rtc/index.d.ts +1 -0
- package/dist/src/rtc/mediaEngine.d.ts +23 -0
- package/dist/src/rtc/types.d.ts +2 -0
- package/dist/src/store/CallState.d.ts +21 -0
- package/dist/src/types.d.ts +15 -6
- package/index.ts +3 -0
- package/package.json +11 -11
- package/src/Call.ts +160 -26
- package/src/__tests__/Call.test.ts +15 -0
- package/src/coordinator/connection/connection.ts +6 -3
- package/src/devices/AudioDeviceManager.ts +6 -0
- package/src/devices/CameraManager.ts +51 -4
- package/src/devices/DeviceManager.ts +17 -0
- package/src/devices/MicrophoneManager.ts +55 -5
- package/src/devices/ScreenShareManager.ts +3 -0
- package/src/devices/SpeakerManager.ts +42 -12
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +2 -22
- package/src/devices/__tests__/SpeakerManager.test.ts +138 -42
- package/src/devices/__tests__/mocks.ts +36 -3
- package/src/devices/devicePersistence.ts +1 -2
- package/src/events/__tests__/participant.test.ts +134 -1
- package/src/events/callEventHandlers.ts +9 -3
- package/src/events/participant.ts +42 -7
- package/src/gen/coordinator/index.ts +1384 -244
- package/src/gen/video/sfu/models/models.ts +15 -0
- package/src/helpers/MediaPlaybackWatchdog.ts +35 -16
- package/src/helpers/TypedEventEmitter.ts +71 -0
- package/src/helpers/__tests__/MediaPlaybackWatchdog.test.ts +137 -8
- package/src/helpers/__tests__/TypedEventEmitter.test.ts +133 -0
- package/src/helpers/__tests__/ViewportTracker.test.ts +1 -2
- package/src/helpers/ensureExhausted.ts +4 -2
- package/src/permissions/PermissionsContext.ts +10 -5
- package/src/reporting/ClientEventReporter.ts +2 -8
- package/src/rtc/BasePeerConnection.ts +12 -1
- package/src/rtc/Publisher.ts +8 -0
- package/src/rtc/Subscriber.ts +5 -0
- package/src/rtc/__tests__/Publisher.test.ts +101 -0
- package/src/rtc/__tests__/Subscriber.test.ts +89 -0
- package/src/rtc/__tests__/mocks/webrtc.mocks.ts +31 -0
- package/src/rtc/e2ee/E2EEManager.ts +12 -0
- package/src/rtc/e2ee/EncryptionManager.ts +336 -0
- package/src/rtc/e2ee/SPEC.md +586 -0
- package/src/rtc/e2ee/__tests__/E2EEManager.contract.test.ts +39 -0
- package/src/rtc/e2ee/__tests__/EncryptionManager.test.ts +490 -0
- package/src/rtc/e2ee/__tests__/codec.test.ts +247 -0
- package/src/rtc/e2ee/__tests__/conformance.test.ts +184 -0
- package/src/rtc/e2ee/__tests__/failureTracker.test.ts +45 -0
- package/src/rtc/e2ee/__tests__/frameCounter.test.ts +90 -0
- package/src/rtc/e2ee/__tests__/keyStore.test.ts +221 -0
- package/src/rtc/e2ee/__tests__/notifications.test.ts +166 -0
- package/src/rtc/e2ee/__tests__/perf.test.ts +139 -0
- package/src/rtc/e2ee/__tests__/queue.test.ts +61 -0
- package/src/rtc/e2ee/__tests__/replayWindow.test.ts +133 -0
- package/src/rtc/e2ee/__tests__/trailer.test.ts +143 -0
- package/src/rtc/e2ee/__tests__/transform-pipeline.test.ts +839 -0
- package/src/rtc/e2ee/__tests__/transformSupport.test.ts +65 -0
- package/src/rtc/e2ee/e2ee-worker/codec.ts +220 -0
- package/src/rtc/e2ee/e2ee-worker/constants.ts +47 -0
- package/src/rtc/e2ee/e2ee-worker/decode.ts +159 -0
- package/src/rtc/e2ee/e2ee-worker/e2ee-worker-impl.ts +137 -0
- package/src/rtc/e2ee/e2ee-worker/encode.ts +147 -0
- package/src/rtc/e2ee/e2ee-worker/failureTracker.ts +26 -0
- package/src/rtc/e2ee/e2ee-worker/frameCounter.ts +37 -0
- package/src/rtc/e2ee/e2ee-worker/keyStore.ts +211 -0
- package/src/rtc/e2ee/e2ee-worker/notifications.ts +190 -0
- package/src/rtc/e2ee/e2ee-worker/perf.ts +129 -0
- package/src/rtc/e2ee/e2ee-worker/queue.ts +12 -0
- package/src/rtc/e2ee/e2ee-worker/replayWindow.ts +131 -0
- package/src/rtc/e2ee/e2ee-worker/trailer.ts +155 -0
- package/src/rtc/e2ee/e2ee-worker/tsconfig.json +8 -0
- package/src/rtc/e2ee/e2ee-worker/types.ts +29 -0
- package/src/rtc/e2ee/e2ee-worker.ts +27 -0
- package/src/rtc/e2ee/events.ts +179 -0
- package/src/rtc/e2ee/transformSupport.ts +35 -0
- package/src/rtc/helpers/rtcConfiguration.ts +4 -2
- package/src/rtc/index.ts +1 -0
- package/src/rtc/mediaEngine.ts +44 -0
- package/src/rtc/types.ts +3 -2
- package/src/stats/rtc/types.ts +8 -2
- package/src/store/CallState.ts +34 -3
- package/src/store/__tests__/CallState.test.ts +82 -1
- package/src/types.ts +24 -9
package/dist/src/Call.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Publisher, Subscriber, TrackPublishOptions } from './rtc';
|
|
1
|
+
import { type CallMediaEngine, Publisher, Subscriber, TrackPublishOptions } from './rtc';
|
|
2
|
+
import type { E2EEManager } from './rtc/e2ee/E2EEManager';
|
|
2
3
|
import { CallState } from './store';
|
|
3
4
|
import { ScopedLogger } from './logger';
|
|
4
|
-
import
|
|
5
|
+
import { AcceptCallResponse, BlockUserResponse, CallRingEvent, CallSettingsResponse, CollectUserFeedbackRequest, CollectUserFeedbackResponse, DeleteCallRequest, DeleteCallResponse, DeleteRecordingResponse, DeleteTranscriptionResponse, EndCallResponse, GetCallReportResponse, GetCallResponse, GetCallSessionParticipantStatsDetailsResponse, GetOrCreateCallRequest, GetOrCreateCallResponse, GoLiveRequest, GoLiveResponse, JoinCallResponse, KickUserRequest, KickUserResponse, ListRecordingsResponse, ListTranscriptionsResponse, MuteUsersResponse, PinRequest, PinResponse, QueryCallMembersRequest, QueryCallMembersResponse, QueryCallParticipantsRequest, QueryCallParticipantsResponse, QueryCallSessionParticipantStatsResponse, QueryCallSessionParticipantStatsTimelineResponse, QueryCallStatsMapResponse, RejectCallResponse, RequestPermissionRequest, RequestPermissionResponse, RingCallRequest, RingCallResponse, SendCallEventResponse, SendVideoReactionRequest, SendVideoReactionResponse, StartClosedCaptionsRequest, StartClosedCaptionsResponse, StartFrameRecordingRequest, StartFrameRecordingResponse, StartHLSBroadcastingResponse, StartRTMPBroadcastsRequest, StartRTMPBroadcastsResponse, StartTranscriptionRequest, StartTranscriptionResponse, StopAllRTMPBroadcastsResponse, StopClosedCaptionsRequest, StopClosedCaptionsResponse, StopFrameRecordingResponse, StopHLSBroadcastingResponse, StopLiveRequest, StopLiveResponse, StopRecordingResponse, StopRTMPBroadcastsResponse, StopTranscriptionResponse, UnblockUserResponse, UnpinRequest, UnpinResponse, UpdateCallMembersRequest, UpdateCallMembersResponse, UpdateCallRequest, UpdateCallResponse, UpdateUserPermissionsRequest, UpdateUserPermissionsRequestGrantPermissionsEnum, UpdateUserPermissionsRequestRevokePermissionsEnum, UpdateUserPermissionsResponse } from './gen/coordinator';
|
|
5
6
|
import { AudioTrackType, CallConstructor, CallLeaveOptions, CallRecordingType, ClientPublishOptions, ClosedCaptionsSettings, JoinCallData, StartCallRecordingFnType, TrackMuteType, VideoTrackType } from './types';
|
|
6
7
|
import { ClientCapability, TrackType, VideoDimension } from './gen/video/sfu/models/models';
|
|
7
8
|
import { Tracer } from './stats';
|
|
@@ -84,6 +85,7 @@ export declare class Call {
|
|
|
84
85
|
readonly blockedAudioTracker: BlockedAudioTracker;
|
|
85
86
|
subscriber?: Subscriber;
|
|
86
87
|
publisher?: Publisher;
|
|
88
|
+
e2eeManager?: E2EEManager;
|
|
87
89
|
/**
|
|
88
90
|
* Flag telling whether this call is a "ringing" call.
|
|
89
91
|
*/
|
|
@@ -132,6 +134,8 @@ export declare class Call {
|
|
|
132
134
|
private allowOwnTracksLoopback;
|
|
133
135
|
private hasJoinedOnce;
|
|
134
136
|
private deviceSettingsAppliedOnce;
|
|
137
|
+
private callManagerStarted;
|
|
138
|
+
private leaveGeneration;
|
|
135
139
|
private credentials?;
|
|
136
140
|
private initialized;
|
|
137
141
|
private readonly acceptRejectConcurrencyTag;
|
|
@@ -148,6 +152,13 @@ export declare class Call {
|
|
|
148
152
|
* A list of capabilities that the client supports and are enabled.
|
|
149
153
|
*/
|
|
150
154
|
private clientCapabilities;
|
|
155
|
+
/**
|
|
156
|
+
* The in-flight per-call media engine. On web/React this resolves to a thin
|
|
157
|
+
* globals-backed engine (no provider registered); React Native registers a
|
|
158
|
+
* provider that owns a per-call native factory.
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
private mediaEnginePromise?;
|
|
151
162
|
/**
|
|
152
163
|
* Constructs a new `Call` instance.
|
|
153
164
|
*
|
|
@@ -325,10 +336,26 @@ export declare class Call {
|
|
|
325
336
|
* Retrieves credentials for joining the call.
|
|
326
337
|
*
|
|
327
338
|
* @internal
|
|
328
|
-
*
|
|
329
339
|
* @param data the join call data.
|
|
330
340
|
*/
|
|
331
341
|
doJoinRequest: (data?: JoinCallData) => Promise<JoinCallResponse>;
|
|
342
|
+
/**
|
|
343
|
+
* Whether the per-call media engine currently exists. True from join until leave.
|
|
344
|
+
*
|
|
345
|
+
* @internal an internal getter and should not be used outside the SDK.
|
|
346
|
+
*/
|
|
347
|
+
get hasMediaEngine(): boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Ensures a {@link CallMediaEngine} exists for this call's media session and
|
|
350
|
+
* returns it. Idempotent: the engine is created once via the registered
|
|
351
|
+
* provider (see `setCallMediaEngineProvider`) and cached until `leave()`
|
|
352
|
+
* disposes it. Concurrent callers (e.g. camera + microphone enabling in
|
|
353
|
+
* parallel) share the same engine because the in-flight creation promise is
|
|
354
|
+
* cached, never the unresolved result.
|
|
355
|
+
*
|
|
356
|
+
* @internal
|
|
357
|
+
*/
|
|
358
|
+
ensureMediaFactory: () => Promise<CallMediaEngine>;
|
|
332
359
|
/**
|
|
333
360
|
* Handles the closing of the SFU signal connection.
|
|
334
361
|
*
|
|
@@ -433,6 +460,25 @@ export declare class Call {
|
|
|
433
460
|
* @param options the options to use.
|
|
434
461
|
*/
|
|
435
462
|
updatePublishOptions: (options: ClientPublishOptions) => void;
|
|
463
|
+
/**
|
|
464
|
+
* Set the E2EE (end-to-end encryption) manager for this call.
|
|
465
|
+
*
|
|
466
|
+
* Must be called before {@link join} so the RTCPeerConnection can be
|
|
467
|
+
* configured for E2EE.
|
|
468
|
+
*
|
|
469
|
+
* The manager is kept across {@link leave} so a rejoin of this same instance
|
|
470
|
+
* stays encrypted: do not dispose it while this call may be joined again.
|
|
471
|
+
* A disposed manager throws from `encrypt`/`decrypt` rather than silently
|
|
472
|
+
* publishing nothing, so re-attach a fresh one instead of reusing it.
|
|
473
|
+
*
|
|
474
|
+
* @param e2ee - Any `E2EEManager`. Use `EncryptionManager.create()` for the
|
|
475
|
+
* built-in AES-GCM scheme, or pass your own implementation.
|
|
476
|
+
* @throws if called after the peer connections have been built (i.e. after
|
|
477
|
+
* `join`): those PCs were already configured without an encryptor, so
|
|
478
|
+
* adopting a manager now would silently publish/receive cleartext for
|
|
479
|
+
* the live session.
|
|
480
|
+
*/
|
|
481
|
+
setE2EEManager: (e2ee: E2EEManager) => void;
|
|
436
482
|
/**
|
|
437
483
|
* Notifies the SFU that a noise cancellation process has started.
|
|
438
484
|
*
|
|
@@ -491,7 +537,7 @@ export declare class Call {
|
|
|
491
537
|
*
|
|
492
538
|
* @param reaction the reaction to send.
|
|
493
539
|
*/
|
|
494
|
-
sendReaction: (reaction:
|
|
540
|
+
sendReaction: (reaction: SendVideoReactionRequest) => Promise<SendVideoReactionResponse>;
|
|
495
541
|
/**
|
|
496
542
|
* Blocks the user with the given `userId`.
|
|
497
543
|
*
|
|
@@ -584,7 +630,7 @@ export declare class Call {
|
|
|
584
630
|
* @param userId the id of the user to grant permissions to.
|
|
585
631
|
* @param permissions the permissions to grant.
|
|
586
632
|
*/
|
|
587
|
-
grantPermissions: (userId: string, permissions: string[]) => Promise<UpdateUserPermissionsResponse>;
|
|
633
|
+
grantPermissions: (userId: string, permissions: string[] | UpdateUserPermissionsRequestGrantPermissionsEnum[]) => Promise<UpdateUserPermissionsResponse>;
|
|
588
634
|
/**
|
|
589
635
|
* Allows you to revoke certain permissions from a user in a call.
|
|
590
636
|
* The permissions are specific to the call experience and do not survive the call itself.
|
|
@@ -597,7 +643,7 @@ export declare class Call {
|
|
|
597
643
|
* @param userId the id of the user to revoke permissions from.
|
|
598
644
|
* @param permissions the permissions to revoke.
|
|
599
645
|
*/
|
|
600
|
-
revokePermissions: (userId: string, permissions: string[]) => Promise<UpdateUserPermissionsResponse>;
|
|
646
|
+
revokePermissions: (userId: string, permissions: string[] | UpdateUserPermissionsRequestRevokePermissionsEnum[]) => Promise<UpdateUserPermissionsResponse>;
|
|
601
647
|
/**
|
|
602
648
|
* Allows you to grant or revoke a specific permission to a user in a call. The permissions are specific to the call experience and do not survive the call itself.
|
|
603
649
|
* When revoking a permission, this endpoint will also mute the relevant track from the user. This is similar to muting a user with the difference that the user will not be able to unmute afterwards.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StreamClient } from './client';
|
|
2
2
|
import type { UR, WSConnectionError } from './types';
|
|
3
3
|
import type { LogLevel } from '@stream-io/logger';
|
|
4
|
-
import
|
|
4
|
+
import { ConnectedEvent } from '../../gen/coordinator';
|
|
5
5
|
/**
|
|
6
6
|
* StableWSConnection - A WS connection that reconnects upon failure.
|
|
7
7
|
* - the browser will sometimes report that you're online or offline
|
|
@@ -37,6 +37,12 @@ export declare class CameraManager extends DeviceManager<CameraManagerState> {
|
|
|
37
37
|
width: number;
|
|
38
38
|
height: number;
|
|
39
39
|
}): Promise<void>;
|
|
40
|
+
enable(): Promise<void>;
|
|
41
|
+
disable(options: {
|
|
42
|
+
forceStop?: boolean;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
disable(forceStop?: boolean): Promise<void>;
|
|
45
|
+
toggle(): Promise<void>;
|
|
40
46
|
/**
|
|
41
47
|
* Applies the video settings to the camera.
|
|
42
48
|
*
|
|
@@ -118,6 +118,7 @@ export declare abstract class DeviceManager<S extends DeviceManagerState<C>, C =
|
|
|
118
118
|
protected stopPublishStream(): Promise<void>;
|
|
119
119
|
protected getTracks(): MediaStreamTrack[];
|
|
120
120
|
protected muteStream(stopTracks?: boolean): Promise<void>;
|
|
121
|
+
protected reconcileOptimisticStatus: () => Promise<void>;
|
|
121
122
|
private disableTracks;
|
|
122
123
|
private enableTracks;
|
|
123
124
|
private stopTracks;
|
|
@@ -20,6 +20,12 @@ export declare class MicrophoneManager extends AudioDeviceManager<MicrophoneMana
|
|
|
20
20
|
private silenceThresholdMs;
|
|
21
21
|
constructor(call: Call, devicePersistence: Required<DevicePersistenceOptions>, disableMode?: TrackDisableMode);
|
|
22
22
|
setup(): void;
|
|
23
|
+
enable(): Promise<void>;
|
|
24
|
+
disable(options: {
|
|
25
|
+
forceStop?: boolean;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
disable(forceStop?: boolean): Promise<void>;
|
|
28
|
+
toggle(): Promise<void>;
|
|
23
29
|
/**
|
|
24
30
|
* Enables noise cancellation for the microphone.
|
|
25
31
|
*
|
|
@@ -10,7 +10,7 @@ export declare class SpeakerManager {
|
|
|
10
10
|
private defaultDevice?;
|
|
11
11
|
private readonly devicePersistence;
|
|
12
12
|
constructor(call: Call, devicePreferences: Required<DevicePersistenceOptions>);
|
|
13
|
-
apply(settings: CallSettingsResponse): void
|
|
13
|
+
apply(settings: CallSettingsResponse): Promise<void>;
|
|
14
14
|
private applyWeb;
|
|
15
15
|
private applyRN;
|
|
16
16
|
setup(): void;
|
|
@@ -51,5 +51,6 @@ export declare class SpeakerManager {
|
|
|
51
51
|
* @param volume a number between 0 and 1. Set it to `undefined` to use the default volume.
|
|
52
52
|
*/
|
|
53
53
|
setParticipantVolume(sessionId: string, volume: number | undefined): void;
|
|
54
|
+
private findDevice;
|
|
54
55
|
private persistSpeakerDevicePreference;
|
|
55
56
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { ParticipantJoined, ParticipantLeft, ParticipantUpdated, TrackPublished, TrackUnpublished } from '../gen/video/sfu/event/events';
|
|
2
2
|
import { CallState } from '../store';
|
|
3
|
+
import type { E2EEManager } from '../rtc/e2ee/E2EEManager';
|
|
4
|
+
/**
|
|
5
|
+
* Reads the call's current encryption manager. Deliberately not the manager
|
|
6
|
+
* itself: `Call.setE2EEManager` may be called after these handlers are wired up.
|
|
7
|
+
*/
|
|
8
|
+
type GetE2EEManager = () => E2EEManager | undefined;
|
|
3
9
|
/**
|
|
4
10
|
* An event responder which handles the `participantJoined` event.
|
|
5
11
|
*/
|
|
6
|
-
export declare const watchParticipantJoined: (state: CallState) => (e: ParticipantJoined) => void;
|
|
12
|
+
export declare const watchParticipantJoined: (state: CallState, e2ee?: GetE2EEManager | undefined) => (e: ParticipantJoined) => void;
|
|
7
13
|
/**
|
|
8
14
|
* An event responder which handles the `participantLeft` event.
|
|
9
15
|
*/
|
|
@@ -16,9 +22,10 @@ export declare const watchParticipantUpdated: (state: CallState) => (e: Particip
|
|
|
16
22
|
* An event responder which handles the `trackPublished` event.
|
|
17
23
|
* The SFU will send this event when a participant publishes a track.
|
|
18
24
|
*/
|
|
19
|
-
export declare const watchTrackPublished: (state: CallState) => (e: TrackPublished) => void;
|
|
25
|
+
export declare const watchTrackPublished: (state: CallState, e2ee?: GetE2EEManager | undefined) => (e: TrackPublished) => void;
|
|
20
26
|
/**
|
|
21
27
|
* An event responder which handles the `trackUnpublished` event.
|
|
22
28
|
* The SFU will send this event when a participant unpublishes a track.
|
|
23
29
|
*/
|
|
24
|
-
export declare const watchTrackUnpublished: (state: CallState) => (e: TrackUnpublished) => void;
|
|
30
|
+
export declare const watchTrackUnpublished: (state: CallState, e2ee?: GetE2EEManager | undefined) => (e: TrackUnpublished) => void;
|
|
31
|
+
export {};
|