@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
@@ -12,6 +12,7 @@ type OrphanedTrack = {
12
12
  trackLookupPrefix: string;
13
13
  trackType: TrackType;
14
14
  track: MediaStream;
15
+ receiver?: RTCRtpReceiver;
15
16
  };
16
17
  /**
17
18
  * Holds the state of the current call.
@@ -35,6 +36,7 @@ export declare class CallState {
35
36
  private settingsSubject;
36
37
  private transcribingSubject;
37
38
  private captioningSubject;
39
+ private e2eeEnabledSubject;
38
40
  private endedBySubject;
39
41
  private thumbnailsSubject;
40
42
  private membersSubject;
@@ -188,6 +190,11 @@ export declare class CallState {
188
190
  * Will provide the closed captioning state of this call.
189
191
  */
190
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>;
191
198
  /**
192
199
  * Will provide the user who ended this call.
193
200
  */
@@ -476,6 +483,10 @@ export declare class CallState {
476
483
  * Will provide the transcribing state of this call.
477
484
  */
478
485
  get transcribing(): boolean;
486
+ /**
487
+ * Whether end-to-end encryption is active for this call.
488
+ */
489
+ get e2eeEnabled(): boolean;
479
490
  /**
480
491
  * Will provide the user who ended this call.
481
492
  */
@@ -571,6 +582,16 @@ export declare class CallState {
571
582
  * @param id the ID of the orphaned track to remove.
572
583
  */
573
584
  removeOrphanedTrack: (id: string) => void;
585
+ /**
586
+ * Drops every orphaned track. Call this when the peer connections that own
587
+ * the stored receivers go away (full leave, reconnect, or migration):
588
+ * `pc.close()` does not raise the track `ended` event, so the per-track
589
+ * cleanup never fires and the receivers + their closed PCs would otherwise
590
+ * leak for the call's lifetime.
591
+ *
592
+ * @internal
593
+ */
594
+ removeAllOrphanedTracks: () => void;
574
595
  /**
575
596
  * Takes all orphaned tracks with the given track lookup prefix.
576
597
  * All orphaned tracks with the given track lookup prefix are removed from the call state.
@@ -1,5 +1,5 @@
1
1
  import type { Participant, TrackType, VideoDimension } from './gen/video/sfu/models/models';
2
- import type { AudioSettingsRequestDefaultDeviceEnum, CallRecordingStartedEventRecordingTypeEnum, JoinCallRequest, MemberResponse, OwnCapability, ReactionResponse, StartRecordingRequest, StartRecordingResponse } from './gen/coordinator';
2
+ import type { AudioSettingsRequestDefaultDeviceEnum, CallRecordingStartedEventRecordingTypeEnum, JoinCallRequest, MemberResponse, OwnCapability, VideoReactionResponse, StartRecordingRequest, StartRecordingResponse } from './gen/coordinator';
3
3
  import type { StreamClient } from './coordinator/connection/client';
4
4
  import type { ClientEventReporter } from './reporting';
5
5
  import type { RejectReason, StreamClientOptions, TokenProvider, User } from './coordinator/connection/types';
@@ -7,7 +7,7 @@ import type { Comparator } from './sorting';
7
7
  import type { StreamVideoWriteableStateStore } from './store';
8
8
  import { AxiosError } from 'axios';
9
9
  import type { Call } from './Call';
10
- export type StreamReaction = Pick<ReactionResponse, 'type' | 'emoji_code' | 'custom'>;
10
+ export type StreamReaction = Pick<VideoReactionResponse, 'type' | 'emoji_code' | 'custom'>;
11
11
  export declare enum VisibilityState {
12
12
  UNKNOWN = "UNKNOWN",
13
13
  VISIBLE = "VISIBLE",
@@ -344,8 +344,15 @@ type StreamRNVideoSDKCallManagerRingingParams = {
344
344
  isRingingTypeCall: boolean;
345
345
  };
346
346
  type StreamRNVideoSDKCallManagerSetupParams = StreamRNVideoSDKCallManagerRingingParams & {
347
+ cid: string;
347
348
  defaultDevice: AudioSettingsRequestDefaultDeviceEnum;
348
349
  };
350
+ type StreamRNVideoSDKCallManagerStartParams = StreamRNVideoSDKCallManagerRingingParams & {
351
+ cid: string;
352
+ };
353
+ type StreamRNVideoSDKCallManagerStopParams = StreamRNVideoSDKCallManagerRingingParams & {
354
+ shouldStopCallManager: boolean;
355
+ };
349
356
  type StreamRNVideoSDKEndCallReason =
350
357
  /** Call ended by the local user (e.g., hanging up). */
351
358
  'local'
@@ -371,6 +378,8 @@ type StreamRNVideoSDKCallingX = {
371
378
  joinCall: (call: Call, activeCalls: Call[]) => Promise<void>;
372
379
  endCall: (call: Call, reason?: StreamRNVideoSDKEndCallReason) => Promise<void>;
373
380
  registerOutgoingCall: (call: Call) => Promise<void>;
381
+ wireAudioEngineSubscription: () => void;
382
+ unwireAudioEngineSubscription: () => void;
374
383
  };
375
384
  export type StreamRNVideoSDKGlobals = {
376
385
  callingX: StreamRNVideoSDKCallingX;
@@ -378,15 +387,15 @@ export type StreamRNVideoSDKGlobals = {
378
387
  /**
379
388
  * Sets up the in call manager.
380
389
  */
381
- setup({ defaultDevice, isRingingTypeCall, }: StreamRNVideoSDKCallManagerSetupParams): void;
390
+ setup({ defaultDevice, isRingingTypeCall, cid, }: StreamRNVideoSDKCallManagerSetupParams): void;
382
391
  /**
383
392
  * Starts the in call manager.
384
393
  */
385
- start({ isRingingTypeCall, }: StreamRNVideoSDKCallManagerRingingParams): void;
394
+ start({ isRingingTypeCall, cid, }: StreamRNVideoSDKCallManagerStartParams): void;
386
395
  /**
387
396
  * Stops the in call manager.
388
397
  */
389
- stop({ isRingingTypeCall }: StreamRNVideoSDKCallManagerRingingParams): void;
398
+ stop({ isRingingTypeCall, shouldStopCallManager, }: StreamRNVideoSDKCallManagerStopParams): void;
390
399
  /**
391
400
  * iOS-only. Keeps the audio engine's microphone-input (voice-processing)
392
401
  * chain prepared while the mic is muted, so the `AVAudioEngine` stays full-duplex
@@ -423,5 +432,5 @@ declare global {
423
432
  /**
424
433
  * The options to pass to {@link Call.join} method.
425
434
  */
426
- export type JoinCallData = Omit<JoinCallRequest, 'location'>;
435
+ export type JoinCallData = Omit<JoinCallRequest, 'location' | 'e2ee'>;
427
436
  export { AxiosError };
package/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from './src/stats/types';
11
11
 
12
12
  export * from './src/Call';
13
13
  export * from './src/CallType';
14
+ export * from './src/rtc/mediaEngine';
14
15
  export * from './src/StreamVideoClient';
15
16
  export * from './src/StreamSfuClient';
16
17
  export * from './src/devices';
@@ -22,7 +23,11 @@ export * from './src/helpers/humanize';
22
23
  export * from './src/helpers/DynascaleManager';
23
24
  export * from './src/helpers/ViewportTracker';
24
25
  export * from './src/helpers/sound-detector';
26
+ export * from './src/helpers/loopback';
27
+ export * from './src/helpers/MediaStreamRecorder';
25
28
  export * from './src/helpers/participantUtils';
29
+ export * from './src/rtc/e2ee/E2EEManager';
30
+ export * from './src/rtc/e2ee/EncryptionManager';
26
31
  export * as Browsers from './src/helpers/browsers';
27
32
 
28
33
  export * from './src/logger';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "1.57.0",
3
+ "version": "1.59.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",