@stream-io/video-client 1.57.0 → 1.59.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.
Files changed (130) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/e2ee-worker.browser.es.js +1342 -0
  3. package/dist/e2ee-worker.browser.es.js.map +1 -0
  4. package/dist/index.browser.es.js +1141 -117
  5. package/dist/index.browser.es.js.map +1 -1
  6. package/dist/index.cjs.js +1196 -115
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.d.ts +5 -0
  9. package/dist/index.es.js +1174 -117
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/src/Call.d.ts +66 -9
  12. package/dist/src/StreamVideoClient.d.ts +9 -1
  13. package/dist/src/coordinator/connection/connection.d.ts +1 -1
  14. package/dist/src/devices/CameraManager.d.ts +8 -1
  15. package/dist/src/devices/DeviceManager.d.ts +2 -1
  16. package/dist/src/devices/MicrophoneManager.d.ts +8 -1
  17. package/dist/src/devices/SpeakerManager.d.ts +2 -1
  18. package/dist/src/events/participant.d.ts +10 -3
  19. package/dist/src/gen/coordinator/index.d.ts +1386 -240
  20. package/dist/src/gen/video/sfu/models/models.d.ts +8 -0
  21. package/dist/src/helpers/MediaStreamRecorder.d.ts +26 -0
  22. package/dist/src/helpers/TypedEventEmitter.d.ts +23 -0
  23. package/dist/src/helpers/concurrency.d.ts +8 -0
  24. package/dist/src/helpers/ensureExhausted.d.ts +1 -1
  25. package/dist/src/helpers/loopback.d.ts +55 -0
  26. package/dist/src/permissions/PermissionsContext.d.ts +2 -2
  27. package/dist/src/reporting/ClientEventReporter.d.ts +0 -2
  28. package/dist/src/rtc/BasePeerConnection.d.ts +3 -1
  29. package/dist/src/rtc/Subscriber.d.ts +5 -0
  30. package/dist/src/rtc/e2ee/E2EEManager.d.ts +12 -0
  31. package/dist/src/rtc/e2ee/EncryptionManager.d.ts +148 -0
  32. package/dist/src/rtc/e2ee/e2ee-worker.d.ts +25 -0
  33. package/dist/src/rtc/e2ee/events.d.ts +163 -0
  34. package/dist/src/rtc/e2ee/transformSupport.d.ts +21 -0
  35. package/dist/src/rtc/helpers/rtcConfiguration.d.ts +2 -2
  36. package/dist/src/rtc/index.d.ts +1 -0
  37. package/dist/src/rtc/mediaEngine.d.ts +23 -0
  38. package/dist/src/rtc/types.d.ts +2 -0
  39. package/dist/src/store/CallState.d.ts +21 -0
  40. package/dist/src/types.d.ts +15 -6
  41. package/index.ts +5 -0
  42. package/package.json +1 -1
  43. package/src/Call.ts +311 -155
  44. package/src/StreamVideoClient.ts +35 -8
  45. package/src/__tests__/Call.lifecycle.test.ts +33 -2
  46. package/src/__tests__/Call.publishing.test.ts +42 -1
  47. package/src/__tests__/Call.test.ts +15 -0
  48. package/src/__tests__/StreamVideoClient.api.test.ts +33 -0
  49. package/src/__tests__/StreamVideoClient.rewatch.test.ts +213 -0
  50. package/src/__tests__/StreamVideoClient.ringing.test.ts +11 -4
  51. package/src/__tests__/StreamVideoClient.test.ts +14 -12
  52. package/src/coordinator/connection/connection.ts +6 -3
  53. package/src/devices/AudioDeviceManager.ts +6 -0
  54. package/src/devices/CameraManager.ts +67 -8
  55. package/src/devices/DeviceManager.ts +24 -4
  56. package/src/devices/MicrophoneManager.ts +66 -8
  57. package/src/devices/ScreenShareManager.ts +3 -0
  58. package/src/devices/SpeakerManager.ts +42 -12
  59. package/src/devices/__tests__/CameraManager.test.ts +27 -1
  60. package/src/devices/__tests__/DeviceManager.test.ts +49 -1
  61. package/src/devices/__tests__/MicrophoneManager.test.ts +23 -1
  62. package/src/devices/__tests__/MicrophoneManagerRN.test.ts +1 -20
  63. package/src/devices/__tests__/SpeakerManager.test.ts +138 -42
  64. package/src/devices/__tests__/mocks.ts +36 -3
  65. package/src/events/__tests__/participant.test.ts +134 -1
  66. package/src/events/call.ts +6 -3
  67. package/src/events/callEventHandlers.ts +9 -3
  68. package/src/events/participant.ts +42 -7
  69. package/src/gen/coordinator/index.ts +1402 -236
  70. package/src/gen/video/sfu/models/models.ts +15 -0
  71. package/src/helpers/MediaStreamRecorder.ts +104 -0
  72. package/src/helpers/TypedEventEmitter.ts +71 -0
  73. package/src/helpers/__tests__/MediaStreamRecorder.test.ts +324 -0
  74. package/src/helpers/__tests__/TypedEventEmitter.test.ts +133 -0
  75. package/src/helpers/__tests__/concurrency.test.ts +74 -0
  76. package/src/helpers/__tests__/loopback.test.ts +367 -0
  77. package/src/helpers/concurrency.ts +24 -0
  78. package/src/helpers/ensureExhausted.ts +4 -2
  79. package/src/helpers/loopback.ts +200 -0
  80. package/src/permissions/PermissionsContext.ts +10 -5
  81. package/src/reporting/ClientEventReporter.ts +15 -28
  82. package/src/reporting/__tests__/ClientEventReporter.test.ts +3 -7
  83. package/src/rtc/BasePeerConnection.ts +12 -1
  84. package/src/rtc/Publisher.ts +8 -0
  85. package/src/rtc/Subscriber.ts +13 -0
  86. package/src/rtc/__tests__/Publisher.test.ts +101 -0
  87. package/src/rtc/__tests__/Subscriber.test.ts +190 -0
  88. package/src/rtc/__tests__/mocks/webrtc.mocks.ts +31 -0
  89. package/src/rtc/e2ee/E2EEManager.ts +12 -0
  90. package/src/rtc/e2ee/EncryptionManager.ts +336 -0
  91. package/src/rtc/e2ee/SPEC.md +586 -0
  92. package/src/rtc/e2ee/__tests__/E2EEManager.contract.test.ts +39 -0
  93. package/src/rtc/e2ee/__tests__/EncryptionManager.test.ts +490 -0
  94. package/src/rtc/e2ee/__tests__/codec.test.ts +247 -0
  95. package/src/rtc/e2ee/__tests__/conformance.test.ts +184 -0
  96. package/src/rtc/e2ee/__tests__/failureTracker.test.ts +45 -0
  97. package/src/rtc/e2ee/__tests__/frameCounter.test.ts +90 -0
  98. package/src/rtc/e2ee/__tests__/keyStore.test.ts +221 -0
  99. package/src/rtc/e2ee/__tests__/notifications.test.ts +166 -0
  100. package/src/rtc/e2ee/__tests__/perf.test.ts +139 -0
  101. package/src/rtc/e2ee/__tests__/queue.test.ts +61 -0
  102. package/src/rtc/e2ee/__tests__/replayWindow.test.ts +133 -0
  103. package/src/rtc/e2ee/__tests__/trailer.test.ts +143 -0
  104. package/src/rtc/e2ee/__tests__/transform-pipeline.test.ts +839 -0
  105. package/src/rtc/e2ee/__tests__/transformSupport.test.ts +65 -0
  106. package/src/rtc/e2ee/e2ee-worker/codec.ts +220 -0
  107. package/src/rtc/e2ee/e2ee-worker/constants.ts +47 -0
  108. package/src/rtc/e2ee/e2ee-worker/decode.ts +159 -0
  109. package/src/rtc/e2ee/e2ee-worker/e2ee-worker-impl.ts +137 -0
  110. package/src/rtc/e2ee/e2ee-worker/encode.ts +147 -0
  111. package/src/rtc/e2ee/e2ee-worker/failureTracker.ts +26 -0
  112. package/src/rtc/e2ee/e2ee-worker/frameCounter.ts +37 -0
  113. package/src/rtc/e2ee/e2ee-worker/keyStore.ts +211 -0
  114. package/src/rtc/e2ee/e2ee-worker/notifications.ts +190 -0
  115. package/src/rtc/e2ee/e2ee-worker/perf.ts +129 -0
  116. package/src/rtc/e2ee/e2ee-worker/queue.ts +12 -0
  117. package/src/rtc/e2ee/e2ee-worker/replayWindow.ts +131 -0
  118. package/src/rtc/e2ee/e2ee-worker/trailer.ts +155 -0
  119. package/src/rtc/e2ee/e2ee-worker/tsconfig.json +8 -0
  120. package/src/rtc/e2ee/e2ee-worker/types.ts +29 -0
  121. package/src/rtc/e2ee/e2ee-worker.ts +27 -0
  122. package/src/rtc/e2ee/events.ts +179 -0
  123. package/src/rtc/e2ee/transformSupport.ts +35 -0
  124. package/src/rtc/helpers/rtcConfiguration.ts +4 -2
  125. package/src/rtc/index.ts +1 -0
  126. package/src/rtc/mediaEngine.ts +44 -0
  127. package/src/rtc/types.ts +2 -0
  128. package/src/store/CallState.ts +33 -1
  129. package/src/store/__tests__/CallState.test.ts +82 -1
  130. package/src/types.ts +23 -5
@@ -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 type { 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, SendReactionRequest, SendReactionResponse, 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, UpdateUserPermissionsResponse } from './gen/coordinator';
5
+ import { AcceptCallResponse, BlockUserResponse, CallRingEvent, CallSettingsResponse, CallStateResponseFields, 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
  *
@@ -212,6 +223,13 @@ export declare class Call {
212
223
  * @internal
213
224
  */
214
225
  updateFromRingingEvent: (event: CallRingEvent) => Promise<void>;
226
+ /**
227
+ * Applies a backend-provided call state snapshot
228
+ * (call, members, own capabilities) to this instance.
229
+ *
230
+ * @internal an internal method and should not be used outside the SDK.
231
+ */
232
+ updateFromCallStateResponse: (response: CallStateResponseFields) => void;
215
233
  /**
216
234
  * Loads the information about the call.
217
235
  *
@@ -275,12 +293,12 @@ export declare class Call {
275
293
  *
276
294
  * @returns a promise which resolves once the call join-flow has finished.
277
295
  */
278
- join: ({ maxJoinRetries, joinResponseTimeout, rpcRequestTimeout, allowOwnTracksLoopback, ...data }?: JoinCallData & {
296
+ join: (args_0?: (JoinCallData & {
279
297
  maxJoinRetries?: number;
280
298
  joinResponseTimeout?: number;
281
299
  rpcRequestTimeout?: number;
282
300
  allowOwnTracksLoopback?: boolean;
283
- }) => Promise<void>;
301
+ }) | undefined) => Promise<void>;
284
302
  /**
285
303
  * Will make a single attempt to watch for call related WebSocket events
286
304
  * and initiate a call session with the server.
@@ -325,10 +343,26 @@ export declare class Call {
325
343
  * Retrieves credentials for joining the call.
326
344
  *
327
345
  * @internal
328
- *
329
346
  * @param data the join call data.
330
347
  */
331
348
  doJoinRequest: (data?: JoinCallData) => Promise<JoinCallResponse>;
349
+ /**
350
+ * Whether the per-call media engine currently exists. True from join until leave.
351
+ *
352
+ * @internal an internal getter and should not be used outside the SDK.
353
+ */
354
+ get hasMediaEngine(): boolean;
355
+ /**
356
+ * Ensures a {@link CallMediaEngine} exists for this call's media session and
357
+ * returns it. Idempotent: the engine is created once via the registered
358
+ * provider (see `setCallMediaEngineProvider`) and cached until `leave()`
359
+ * disposes it. Concurrent callers (e.g. camera + microphone enabling in
360
+ * parallel) share the same engine because the in-flight creation promise is
361
+ * cached, never the unresolved result.
362
+ *
363
+ * @internal
364
+ */
365
+ ensureMediaFactory: () => Promise<CallMediaEngine>;
332
366
  /**
333
367
  * Handles the closing of the SFU signal connection.
334
368
  *
@@ -433,6 +467,25 @@ export declare class Call {
433
467
  * @param options the options to use.
434
468
  */
435
469
  updatePublishOptions: (options: ClientPublishOptions) => void;
470
+ /**
471
+ * Set the E2EE (end-to-end encryption) manager for this call.
472
+ *
473
+ * Must be called before {@link join} so the RTCPeerConnection can be
474
+ * configured for E2EE.
475
+ *
476
+ * The manager is kept across {@link leave} so a rejoin of this same instance
477
+ * stays encrypted: do not dispose it while this call may be joined again.
478
+ * A disposed manager throws from `encrypt`/`decrypt` rather than silently
479
+ * publishing nothing, so re-attach a fresh one instead of reusing it.
480
+ *
481
+ * @param e2ee - Any `E2EEManager`. Use `EncryptionManager.create()` for the
482
+ * built-in AES-GCM scheme, or pass your own implementation.
483
+ * @throws if called after the peer connections have been built (i.e. after
484
+ * `join`): those PCs were already configured without an encryptor, so
485
+ * adopting a manager now would silently publish/receive cleartext for
486
+ * the live session.
487
+ */
488
+ setE2EEManager: (e2ee: E2EEManager) => void;
436
489
  /**
437
490
  * Notifies the SFU that a noise cancellation process has started.
438
491
  *
@@ -491,7 +544,7 @@ export declare class Call {
491
544
  *
492
545
  * @param reaction the reaction to send.
493
546
  */
494
- sendReaction: (reaction: SendReactionRequest) => Promise<SendReactionResponse>;
547
+ sendReaction: (reaction: SendVideoReactionRequest) => Promise<SendVideoReactionResponse>;
495
548
  /**
496
549
  * Blocks the user with the given `userId`.
497
550
  *
@@ -584,7 +637,7 @@ export declare class Call {
584
637
  * @param userId the id of the user to grant permissions to.
585
638
  * @param permissions the permissions to grant.
586
639
  */
587
- grantPermissions: (userId: string, permissions: string[]) => Promise<UpdateUserPermissionsResponse>;
640
+ grantPermissions: (userId: string, permissions: string[] | UpdateUserPermissionsRequestGrantPermissionsEnum[]) => Promise<UpdateUserPermissionsResponse>;
588
641
  /**
589
642
  * Allows you to revoke certain permissions from a user in a call.
590
643
  * The permissions are specific to the call experience and do not survive the call itself.
@@ -597,7 +650,7 @@ export declare class Call {
597
650
  * @param userId the id of the user to revoke permissions from.
598
651
  * @param permissions the permissions to revoke.
599
652
  */
600
- revokePermissions: (userId: string, permissions: string[]) => Promise<UpdateUserPermissionsResponse>;
653
+ revokePermissions: (userId: string, permissions: string[] | UpdateUserPermissionsRequestRevokePermissionsEnum[]) => Promise<UpdateUserPermissionsResponse>;
601
654
  /**
602
655
  * 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
656
  * 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.
@@ -822,7 +875,11 @@ export declare class Call {
822
875
  *
823
876
  * @internal
824
877
  */
825
- applyDeviceConfig: (settings: CallSettingsResponse, publish: boolean, skipSpeakerApply: boolean) => Promise<void>;
878
+ applyDeviceConfig: (settings: CallSettingsResponse, opts: {
879
+ publish: boolean;
880
+ skipSpeakerApply?: boolean;
881
+ withDisabledDevices?: boolean;
882
+ }) => Promise<void>;
826
883
  /**
827
884
  * Will begin tracking the given element for visibility changes within the
828
885
  * configured viewport element (`call.setViewport`).
@@ -50,6 +50,11 @@ export declare class StreamVideoClient {
50
50
  * @param e the event.
51
51
  */
52
52
  private initCallFromEvent;
53
+ /**
54
+ * Queries the API for calls matching the given filters.
55
+ * @param data the query data.
56
+ */
57
+ private doQueryCalls;
53
58
  /**
54
59
  * Rewatches the given calls with retry logic.
55
60
  * @param callsToReWatch array of call IDs to rewatch
@@ -110,8 +115,11 @@ export declare class StreamVideoClient {
110
115
  * Will query the API for calls matching the given filters.
111
116
  *
112
117
  * @param data the query data.
118
+ * @param opts additional options, for tweaking the API behavior.
113
119
  */
114
- queryCalls: (data?: QueryCallsRequest) => Promise<{
120
+ queryCalls: (data?: QueryCallsRequest, opts?: {
121
+ withDisabledDevices?: boolean;
122
+ }) => Promise<{
115
123
  calls: Call[];
116
124
  duration: string;
117
125
  next?: string;
@@ -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 type { ConnectedEvent } from '../../gen/coordinator';
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,13 +37,20 @@ 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
  *
43
49
  * @param settings the video settings to apply.
44
50
  * @param publish whether to publish the stream after applying the settings.
51
+ * @param forceDisabled whether to keep the camera disabled, regardless of server-side or local preferences.
45
52
  */
46
- apply(settings: VideoSettingsResponse, publish: boolean): Promise<void>;
53
+ apply(settings: VideoSettingsResponse, publish: boolean, forceDisabled?: boolean): Promise<void>;
47
54
  protected getDevices(): Observable<MediaDeviceInfo[]>;
48
55
  protected getResolvedConstraints(constraints: MediaTrackConstraints): MediaTrackConstraints;
49
56
  protected getStream(constraints: MediaTrackConstraints): Promise<MediaStream>;
@@ -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;
@@ -129,6 +130,6 @@ export declare abstract class DeviceManager<S extends DeviceManagerState<C>, C =
129
130
  protected findDevice(devices: MediaDeviceInfo[], deviceId: string): MediaDeviceInfo | undefined;
130
131
  private dispatchDeviceDisconnectedEvent;
131
132
  private persistPreference;
132
- protected applyPersistedPreferences(enabledInCallType: boolean): Promise<boolean>;
133
+ protected applyPersistedPreferences(enabledInCallType: boolean, forceDisabled?: boolean): Promise<boolean>;
133
134
  private applyMutedState;
134
135
  }
@@ -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
  *
@@ -63,8 +69,9 @@ export declare class MicrophoneManager extends AudioDeviceManager<MicrophoneMana
63
69
  * Applies the audio settings to the microphone.
64
70
  * @param settings the audio settings to apply.
65
71
  * @param publish whether to publish the stream after applying the settings.
72
+ * @param forceDisabled whether to keep the mic disabled, regardless of server-side or local preferences.
66
73
  */
67
- apply(settings: AudioSettingsResponse, publish: boolean): Promise<void>;
74
+ apply(settings: AudioSettingsResponse, publish: boolean, forceDisabled?: boolean): Promise<void>;
68
75
  protected getDevices(): Observable<MediaDeviceInfo[]>;
69
76
  protected getStream(constraints: MediaTrackConstraints): Promise<MediaStream>;
70
77
  protected doSetAudioBitrateProfile(profile: AudioBitrateProfile): void;
@@ -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 {};