@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.
Files changed (90) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.browser.es.js +1126 -791
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +1126 -791
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.es.js +1126 -791
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/src/Call.d.ts +37 -11
  10. package/dist/src/StreamVideoClient.d.ts +15 -21
  11. package/dist/src/coordinator/connection/types.d.ts +16 -0
  12. package/dist/src/events/call.d.ts +0 -11
  13. package/dist/src/gen/coordinator/index.d.ts +73 -0
  14. package/dist/src/reporting/ClientEventReporter.d.ts +11 -1
  15. package/dist/src/ringing/RingStatePoller.d.ts +46 -0
  16. package/dist/src/ringing/RingTimeout.d.ts +27 -0
  17. package/dist/src/ringing/index.d.ts +4 -0
  18. package/dist/src/ringing/reconcileRingState.d.ts +18 -0
  19. package/dist/src/ringing/resolveOwnRingOutcome.d.ts +32 -0
  20. package/dist/src/rtc/Publisher.d.ts +18 -0
  21. package/dist/src/rtc/TransceiverCache.d.ts +10 -0
  22. package/dist/src/rtc/e2ee/E2EEManager.d.ts +10 -1
  23. package/dist/src/stats/utils.d.ts +6 -0
  24. package/dist/src/store/CallState.d.ts +118 -267
  25. package/dist/src/store/ClientState.d.ts +62 -0
  26. package/dist/src/store/index.d.ts +1 -1
  27. package/dist/src/store/subjects.d.ts +15 -0
  28. package/dist/src/store/types.d.ts +22 -0
  29. package/dist/src/types.d.ts +33 -4
  30. package/index.ts +1 -0
  31. package/package.json +2 -2
  32. package/src/Call.ts +285 -125
  33. package/src/StreamSfuClient.ts +6 -2
  34. package/src/StreamVideoClient.ts +40 -47
  35. package/src/__tests__/Call.autodrop.test.ts +118 -66
  36. package/src/__tests__/Call.getRingState.test.ts +87 -0
  37. package/src/__tests__/Call.lifecycle.test.ts +499 -6
  38. package/src/__tests__/Call.publishing.test.ts +2 -2
  39. package/src/__tests__/Call.ringSettled.test.ts +71 -0
  40. package/src/__tests__/Call.ringingLifecycle.test.ts +242 -0
  41. package/src/__tests__/StreamSfuClient.test.ts +48 -0
  42. package/src/__tests__/StreamVideoClient.disconnect.test.ts +62 -0
  43. package/src/coordinator/connection/types.ts +19 -0
  44. package/src/devices/__tests__/CameraManager.test.ts +2 -2
  45. package/src/devices/__tests__/DeviceManager.test.ts +2 -2
  46. package/src/devices/__tests__/DeviceManagerFilters.test.ts +2 -2
  47. package/src/devices/__tests__/MicrophoneManager.test.ts +2 -2
  48. package/src/devices/__tests__/MicrophoneManagerRN.test.ts +2 -2
  49. package/src/devices/__tests__/ScreenShareManager.test.ts +3 -3
  50. package/src/devices/__tests__/SpeakerManager.test.ts +4 -4
  51. package/src/events/__tests__/call.test.ts +5 -220
  52. package/src/events/call.ts +1 -73
  53. package/src/events/callEventHandlers.ts +12 -23
  54. package/src/gen/coordinator/index.ts +67 -0
  55. package/src/helpers/__tests__/AudioBindingsWatchdog.test.ts +2 -2
  56. package/src/helpers/__tests__/DynascaleManager.test.ts +2 -2
  57. package/src/helpers/__tests__/ViewportTracker.test.ts +2 -2
  58. package/src/reporting/ClientEventReporter.ts +30 -4
  59. package/src/reporting/__tests__/ClientEventReporter.test.ts +184 -7
  60. package/src/ringing/RingStatePoller.ts +177 -0
  61. package/src/ringing/RingTimeout.ts +90 -0
  62. package/src/ringing/__tests__/RingStatePoller.test.ts +462 -0
  63. package/src/ringing/__tests__/RingTimeout.test.ts +199 -0
  64. package/src/ringing/__tests__/reconcileRingState.test.ts +330 -0
  65. package/src/ringing/__tests__/resolveOwnRingOutcome.test.ts +103 -0
  66. package/src/ringing/index.ts +4 -0
  67. package/src/ringing/reconcileRingState.ts +108 -0
  68. package/src/ringing/resolveOwnRingOutcome.ts +58 -0
  69. package/src/rtc/Publisher.ts +66 -12
  70. package/src/rtc/TransceiverCache.ts +17 -0
  71. package/src/rtc/__tests__/Call.reconnect.test.ts +5 -5
  72. package/src/rtc/__tests__/Publisher.test.ts +209 -0
  73. package/src/rtc/__tests__/mocks/webrtc.mocks.ts +1 -0
  74. package/src/rtc/e2ee/E2EEManager.ts +10 -1
  75. package/src/rtc/e2ee/EncryptionManager.ts +1 -1
  76. package/src/rtc/e2ee/SPEC.md +1 -1
  77. package/src/stats/__tests__/utils.test.ts +33 -0
  78. package/src/stats/utils.ts +15 -0
  79. package/src/store/CallState.ts +305 -550
  80. package/src/store/ClientState.ts +101 -0
  81. package/src/store/__tests__/CallState.test.ts +60 -1
  82. package/src/store/__tests__/ClientState.test.ts +35 -0
  83. package/src/store/__tests__/rxUtils.test.ts +67 -1
  84. package/src/store/index.ts +1 -1
  85. package/src/store/rxUtils.ts +8 -4
  86. package/src/store/subjects.ts +30 -0
  87. package/src/store/types.ts +45 -0
  88. package/src/types.ts +40 -4
  89. package/dist/src/store/stateStore.d.ts +0 -84
  90. package/src/store/stateStore.ts +0 -156
@@ -4,7 +4,7 @@ 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';
6
6
  import type { Comparator } from './sorting';
7
- import type { StreamVideoWriteableStateStore } from './store';
7
+ import type { ClientState } from './store';
8
8
  import { AxiosError } from 'axios';
9
9
  import type { Call } from './Call';
10
10
  export type StreamReaction = Pick<VideoReactionResponse, 'type' | 'emoji_code' | 'custom'>;
@@ -293,9 +293,9 @@ export type CallConstructor = {
293
293
  */
294
294
  sortParticipantsBy?: Comparator<StreamVideoParticipant>;
295
295
  /**
296
- * The state store of the client
296
+ * The state of the client.
297
297
  */
298
- clientStore: StreamVideoWriteableStateStore;
298
+ clientState: ClientState;
299
299
  };
300
300
  type StreamVideoClientBaseOptions = {
301
301
  apiKey: string;
@@ -375,14 +375,43 @@ type StreamRNVideoSDKEndCallReason =
375
375
  /** Unknown or unspecified disconnect reason. */
376
376
  | 'unknown';
377
377
  type StreamRNVideoSDKCallingX = {
378
- joinCall: (call: Call, activeCalls: Call[]) => Promise<void>;
378
+ /**
379
+ * @param isCancelled - polled around the bridge's waits: registration is
380
+ * skipped, or undone, when it returns true. Supplied by the join attempt
381
+ * because the call's own state cannot distinguish a fresh join starting
382
+ * from `LEFT` from an abandoned one that reached `LEFT` while waiting.
383
+ */
384
+ joinCall: (call: Call, activeCalls: Call[], isCancelled?: () => boolean) => Promise<void>;
379
385
  endCall: (call: Call, reason?: StreamRNVideoSDKEndCallReason) => Promise<void>;
380
386
  registerOutgoingCall: (call: Call) => Promise<void>;
381
387
  wireAudioEngineSubscription: () => void;
382
388
  unwireAudioEngineSubscription: () => void;
383
389
  };
390
+ /**
391
+ * React Native's preparation and cleanup for a ringing call's join.
392
+ *
393
+ * A ringing call is joined by the SDK rather than by app code, so there is no
394
+ * point at which the app holds the call and can still set it up. These are that
395
+ * point, and the matching release.
396
+ */
397
+ type StreamRNVideoSDKRingingCallLifecycle = {
398
+ /**
399
+ * Runs the app's pre-join setup and resolves once it is done, bounded by a
400
+ * deadline. Rejecting fails the join closed rather than joining with nothing
401
+ * installed.
402
+ */
403
+ beforeJoin: (call: Call) => Promise<void>;
404
+ /**
405
+ * The join failed terminally. Ends the ringing flow and releases what the
406
+ * setup installed. Never rejects, so the original join error survives.
407
+ */
408
+ onJoinFailed: (call: Call) => Promise<void>;
409
+ /** The call has ended; release whatever the pre-join hook installed. */
410
+ onLeave: (call: Call) => void;
411
+ };
384
412
  export type StreamRNVideoSDKGlobals = {
385
413
  callingX: StreamRNVideoSDKCallingX;
414
+ ringingCallLifecycle: StreamRNVideoSDKRingingCallLifecycle;
386
415
  callManager: {
387
416
  /**
388
417
  * Sets up the in call manager.
package/index.ts CHANGED
@@ -26,6 +26,7 @@ export * from './src/helpers/sound-detector';
26
26
  export * from './src/helpers/loopback';
27
27
  export * from './src/helpers/MediaStreamRecorder';
28
28
  export * from './src/helpers/participantUtils';
29
+ export * from './src/helpers/TypedEventEmitter';
29
30
  export * from './src/rtc/e2ee/E2EEManager';
30
31
  export * from './src/rtc/e2ee/EncryptionManager';
31
32
  export * as Browsers from './src/helpers/browsers';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "browser": "dist/index.browser.es.js",
@@ -46,7 +46,7 @@
46
46
  "@openapitools/openapi-generator-cli": "^2.40.1",
47
47
  "@rollup/plugin-replace": "^6.0.3",
48
48
  "@rollup/plugin-typescript": "^12.3.0",
49
- "@stream-io/audio-filters-web": "^0.10.4",
49
+ "@stream-io/audio-filters-web": "^1.0.0-beta.0",
50
50
  "@stream-io/node-sdk": "^0.7.63",
51
51
  "@stream-io/typescript-config": "^0.0.0",
52
52
  "@total-typescript/shoehorn": "^0.1.2",