@stream-io/video-client 1.4.7 → 1.5.0-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 (77) hide show
  1. package/CHANGELOG.md +238 -0
  2. package/dist/index.browser.es.js +1977 -1477
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +1975 -1474
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +1977 -1477
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/Call.d.ts +93 -9
  9. package/dist/src/StreamSfuClient.d.ts +72 -56
  10. package/dist/src/StreamVideoClient.d.ts +2 -2
  11. package/dist/src/coordinator/connection/client.d.ts +3 -4
  12. package/dist/src/coordinator/connection/types.d.ts +5 -1
  13. package/dist/src/devices/InputMediaDeviceManager.d.ts +4 -0
  14. package/dist/src/devices/MicrophoneManager.d.ts +1 -1
  15. package/dist/src/events/callEventHandlers.d.ts +1 -3
  16. package/dist/src/events/internal.d.ts +4 -0
  17. package/dist/src/gen/video/sfu/event/events.d.ts +106 -4
  18. package/dist/src/gen/video/sfu/models/models.d.ts +64 -65
  19. package/dist/src/helpers/ensureExhausted.d.ts +1 -0
  20. package/dist/src/helpers/withResolvers.d.ts +14 -0
  21. package/dist/src/logger.d.ts +1 -0
  22. package/dist/src/rpc/createClient.d.ts +2 -0
  23. package/dist/src/rpc/index.d.ts +1 -0
  24. package/dist/src/rpc/retryable.d.ts +23 -0
  25. package/dist/src/rtc/Dispatcher.d.ts +1 -1
  26. package/dist/src/rtc/IceTrickleBuffer.d.ts +0 -1
  27. package/dist/src/rtc/Publisher.d.ts +24 -25
  28. package/dist/src/rtc/Subscriber.d.ts +12 -11
  29. package/dist/src/rtc/helpers/rtcConfiguration.d.ts +2 -0
  30. package/dist/src/rtc/helpers/tracks.d.ts +3 -3
  31. package/dist/src/rtc/signal.d.ts +1 -1
  32. package/dist/src/store/CallState.d.ts +46 -2
  33. package/package.json +5 -5
  34. package/src/Call.ts +618 -563
  35. package/src/StreamSfuClient.ts +277 -246
  36. package/src/StreamVideoClient.ts +15 -16
  37. package/src/__tests__/Call.test.ts +145 -2
  38. package/src/__tests__/StreamVideoClient.api.test.ts +168 -0
  39. package/src/coordinator/connection/client.ts +25 -8
  40. package/src/coordinator/connection/connection.ts +2 -1
  41. package/src/coordinator/connection/types.ts +6 -0
  42. package/src/devices/BrowserPermission.ts +1 -1
  43. package/src/devices/CameraManager.ts +1 -1
  44. package/src/devices/InputMediaDeviceManager.ts +12 -3
  45. package/src/devices/MicrophoneManager.ts +3 -3
  46. package/src/devices/devices.ts +1 -1
  47. package/src/events/__tests__/mutes.test.ts +10 -13
  48. package/src/events/__tests__/participant.test.ts +75 -0
  49. package/src/events/callEventHandlers.ts +4 -7
  50. package/src/events/internal.ts +20 -3
  51. package/src/events/mutes.ts +5 -3
  52. package/src/events/participant.ts +48 -15
  53. package/src/gen/video/sfu/event/events.ts +451 -8
  54. package/src/gen/video/sfu/models/models.ts +211 -204
  55. package/src/helpers/ensureExhausted.ts +5 -0
  56. package/src/helpers/withResolvers.ts +43 -0
  57. package/src/logger.ts +3 -1
  58. package/src/rpc/__tests__/retryable.test.ts +72 -0
  59. package/src/rpc/createClient.ts +21 -0
  60. package/src/rpc/index.ts +1 -0
  61. package/src/rpc/retryable.ts +57 -0
  62. package/src/rtc/Dispatcher.ts +6 -2
  63. package/src/rtc/IceTrickleBuffer.ts +2 -2
  64. package/src/rtc/Publisher.ts +127 -163
  65. package/src/rtc/Subscriber.ts +94 -155
  66. package/src/rtc/__tests__/Publisher.test.ts +18 -95
  67. package/src/rtc/__tests__/Subscriber.test.ts +63 -99
  68. package/src/rtc/__tests__/videoLayers.test.ts +2 -2
  69. package/src/rtc/helpers/rtcConfiguration.ts +11 -0
  70. package/src/rtc/helpers/tracks.ts +27 -7
  71. package/src/rtc/signal.ts +3 -3
  72. package/src/rtc/videoLayers.ts +1 -10
  73. package/src/stats/SfuStatsReporter.ts +1 -0
  74. package/src/store/CallState.ts +111 -3
  75. package/src/store/__tests__/CallState.test.ts +58 -37
  76. package/dist/src/rtc/flows/join.d.ts +0 -20
  77. package/src/rtc/flows/join.ts +0 -65
@@ -1,20 +0,0 @@
1
- import { JoinCallData } from '../../types';
2
- import { StreamClient } from '../../coordinator/connection/client';
3
- /**
4
- * Collects all necessary information to join a call, talks to the coordinator
5
- * and returns the necessary information to join the call.
6
- *
7
- * @param httpClient the http client to use.
8
- * @param type the type of the call.
9
- * @param id the id of the call.
10
- * @param data the data for the call.
11
- */
12
- export declare const join: (httpClient: StreamClient, type: string, id: string, data?: JoinCallData) => Promise<{
13
- connectionConfig: RTCConfiguration | undefined;
14
- sfuServer: import("../../gen/coordinator").SFUResponse;
15
- token: string;
16
- metadata: import("../../gen/coordinator").CallResponse;
17
- members: import("../../gen/coordinator").MemberResponse[];
18
- ownCapabilities: import("../../gen/coordinator").OwnCapability[];
19
- statsOptions: import("../../gen/coordinator").StatsOptions;
20
- }>;
@@ -1,65 +0,0 @@
1
- import {
2
- ICEServer,
3
- JoinCallRequest,
4
- JoinCallResponse,
5
- } from '../../gen/coordinator';
6
- import { JoinCallData } from '../../types';
7
- import { StreamClient } from '../../coordinator/connection/client';
8
-
9
- /**
10
- * Collects all necessary information to join a call, talks to the coordinator
11
- * and returns the necessary information to join the call.
12
- *
13
- * @param httpClient the http client to use.
14
- * @param type the type of the call.
15
- * @param id the id of the call.
16
- * @param data the data for the call.
17
- */
18
- export const join = async (
19
- httpClient: StreamClient,
20
- type: string,
21
- id: string,
22
- data?: JoinCallData,
23
- ) => {
24
- const { call, credentials, members, own_capabilities, stats_options } =
25
- await doJoin(httpClient, type, id, data);
26
-
27
- return {
28
- connectionConfig: toRtcConfiguration(credentials.ice_servers),
29
- sfuServer: credentials.server,
30
- token: credentials.token,
31
- metadata: call,
32
- members,
33
- ownCapabilities: own_capabilities,
34
- statsOptions: stats_options,
35
- };
36
- };
37
-
38
- const doJoin = async (
39
- httpClient: StreamClient,
40
- type: string,
41
- id: string,
42
- data?: JoinCallData,
43
- ) => {
44
- const location = await httpClient.getLocationHint();
45
- const request: JoinCallRequest = {
46
- ...data,
47
- location,
48
- };
49
- return httpClient.post<JoinCallResponse, JoinCallRequest>(
50
- `/call/${type}/${id}/join`,
51
- request,
52
- );
53
- };
54
-
55
- const toRtcConfiguration = (config?: ICEServer[]) => {
56
- if (!config || config.length === 0) return undefined;
57
- const rtcConfig: RTCConfiguration = {
58
- iceServers: config.map((ice) => ({
59
- urls: ice.urls,
60
- username: ice.username,
61
- credential: ice.password,
62
- })),
63
- };
64
- return rtcConfig;
65
- };