@stream-io/video-client 0.0.1-alpha.7

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 (157) hide show
  1. package/LICENSE +219 -0
  2. package/README.md +14 -0
  3. package/dist/index.d.ts +23 -0
  4. package/dist/index.js +14663 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/src/Batcher.d.ts +12 -0
  7. package/dist/src/CallDropScheduler.d.ts +44 -0
  8. package/dist/src/StreamSfuClient.d.ts +25 -0
  9. package/dist/src/StreamVideoClient.d.ts +145 -0
  10. package/dist/src/__tests__/StreamVideoClient.test.d.ts +1 -0
  11. package/dist/src/config/defaultConfigs.d.ts +2 -0
  12. package/dist/src/config/types.d.ts +29 -0
  13. package/dist/src/coordinator/StreamCoordinatorClient.d.ts +19 -0
  14. package/dist/src/coordinator/connection/base64.d.ts +2 -0
  15. package/dist/src/coordinator/connection/client.d.ts +174 -0
  16. package/dist/src/coordinator/connection/connection.d.ts +139 -0
  17. package/dist/src/coordinator/connection/connection_fallback.d.ts +38 -0
  18. package/dist/src/coordinator/connection/errors.d.ts +16 -0
  19. package/dist/src/coordinator/connection/events.d.ts +7 -0
  20. package/dist/src/coordinator/connection/insights.d.ts +58 -0
  21. package/dist/src/coordinator/connection/signing.d.ts +30 -0
  22. package/dist/src/coordinator/connection/token_manager.d.ts +39 -0
  23. package/dist/src/coordinator/connection/types.d.ts +96 -0
  24. package/dist/src/coordinator/connection/utils.d.ts +25 -0
  25. package/dist/src/devices.d.ts +79 -0
  26. package/dist/src/events/call.d.ts +26 -0
  27. package/dist/src/events/internal.d.ts +8 -0
  28. package/dist/src/events/participant.d.ts +21 -0
  29. package/dist/src/events/speaker.d.ts +10 -0
  30. package/dist/src/gen/coordinator/index.d.ts +1664 -0
  31. package/dist/src/gen/google/protobuf/descriptor.d.ts +1650 -0
  32. package/dist/src/gen/google/protobuf/duration.d.ts +113 -0
  33. package/dist/src/gen/google/protobuf/struct.d.ts +184 -0
  34. package/dist/src/gen/google/protobuf/timestamp.d.ts +158 -0
  35. package/dist/src/gen/video/coordinator/broadcast_v1/broadcast.d.ts +66 -0
  36. package/dist/src/gen/video/coordinator/call_v1/call.d.ts +254 -0
  37. package/dist/src/gen/video/coordinator/client_v1_rpc/client_rpc.client.d.ts +351 -0
  38. package/dist/src/gen/video/coordinator/client_v1_rpc/client_rpc.d.ts +1488 -0
  39. package/dist/src/gen/video/coordinator/client_v1_rpc/envelopes.d.ts +143 -0
  40. package/dist/src/gen/video/coordinator/client_v1_rpc/websocket.d.ts +292 -0
  41. package/dist/src/gen/video/coordinator/edge_v1/edge.d.ts +183 -0
  42. package/dist/src/gen/video/coordinator/event_v1/event.d.ts +411 -0
  43. package/dist/src/gen/video/coordinator/geofence_v1/geofence.d.ts +63 -0
  44. package/dist/src/gen/video/coordinator/member_v1/member.d.ts +59 -0
  45. package/dist/src/gen/video/coordinator/participant_v1/participant.d.ts +103 -0
  46. package/dist/src/gen/video/coordinator/push_v1/push.d.ts +240 -0
  47. package/dist/src/gen/video/coordinator/stat_v1/stat.d.ts +308 -0
  48. package/dist/src/gen/video/coordinator/user_v1/user.d.ts +112 -0
  49. package/dist/src/gen/video/coordinator/utils_v1/utils.d.ts +47 -0
  50. package/dist/src/gen/video/sfu/event/events.d.ts +736 -0
  51. package/dist/src/gen/video/sfu/models/models.d.ts +460 -0
  52. package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +89 -0
  53. package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +320 -0
  54. package/dist/src/helpers/browsers.d.ts +8 -0
  55. package/dist/src/helpers/sound-detector.d.ts +34 -0
  56. package/dist/src/rpc/createClient.d.ts +10 -0
  57. package/dist/src/rpc/index.d.ts +2 -0
  58. package/dist/src/rpc/latency.d.ts +9 -0
  59. package/dist/src/rtc/Call.d.ts +180 -0
  60. package/dist/src/rtc/CallMetadata.d.ts +9 -0
  61. package/dist/src/rtc/Dispatcher.d.ts +9 -0
  62. package/dist/src/rtc/IceTrickleBuffer.d.ts +11 -0
  63. package/dist/src/rtc/callEventHandlers.d.ts +5 -0
  64. package/dist/src/rtc/codecs.d.ts +2 -0
  65. package/dist/src/rtc/helpers/iceCandidate.d.ts +2 -0
  66. package/dist/src/rtc/helpers/tracks.d.ts +3 -0
  67. package/dist/src/rtc/publisher.d.ts +53 -0
  68. package/dist/src/rtc/signal.d.ts +5 -0
  69. package/dist/src/rtc/subscriber.d.ts +7 -0
  70. package/dist/src/rtc/types.d.ts +84 -0
  71. package/dist/src/rtc/videoLayers.d.ts +17 -0
  72. package/dist/src/stats/coordinator-stats-reporter.d.ts +10 -0
  73. package/dist/src/stats/state-store-stats-reporter.d.ts +57 -0
  74. package/dist/src/stats/types.d.ts +42 -0
  75. package/dist/src/store/index.d.ts +2 -0
  76. package/dist/src/store/rxUtils.d.ts +18 -0
  77. package/dist/src/store/stateStore.d.ts +182 -0
  78. package/generate-openapi.sh +32 -0
  79. package/index.ts +30 -0
  80. package/openapitools.json +7 -0
  81. package/package.json +54 -0
  82. package/rollup.config.mjs +48 -0
  83. package/src/Batcher.ts +43 -0
  84. package/src/CallDropScheduler.ts +192 -0
  85. package/src/StreamSfuClient.ts +185 -0
  86. package/src/StreamVideoClient.ts +487 -0
  87. package/src/__tests__/StreamVideoClient.test.ts +83 -0
  88. package/src/config/defaultConfigs.ts +15 -0
  89. package/src/config/types.ts +30 -0
  90. package/src/coordinator/StreamCoordinatorClient.ts +111 -0
  91. package/src/coordinator/connection/base64.ts +80 -0
  92. package/src/coordinator/connection/client.ts +815 -0
  93. package/src/coordinator/connection/connection.ts +750 -0
  94. package/src/coordinator/connection/connection_fallback.ts +239 -0
  95. package/src/coordinator/connection/errors.ts +70 -0
  96. package/src/coordinator/connection/events.ts +10 -0
  97. package/src/coordinator/connection/insights.ts +88 -0
  98. package/src/coordinator/connection/signing.ts +104 -0
  99. package/src/coordinator/connection/token_manager.ts +160 -0
  100. package/src/coordinator/connection/types.ts +120 -0
  101. package/src/coordinator/connection/utils.ts +148 -0
  102. package/src/devices.ts +266 -0
  103. package/src/events/call.ts +166 -0
  104. package/src/events/internal.ts +47 -0
  105. package/src/events/participant.ts +97 -0
  106. package/src/events/speaker.ts +62 -0
  107. package/src/gen/coordinator/index.ts +1653 -0
  108. package/src/gen/google/protobuf/descriptor.ts +3466 -0
  109. package/src/gen/google/protobuf/duration.ts +232 -0
  110. package/src/gen/google/protobuf/struct.ts +481 -0
  111. package/src/gen/google/protobuf/timestamp.ts +291 -0
  112. package/src/gen/video/coordinator/broadcast_v1/broadcast.ts +154 -0
  113. package/src/gen/video/coordinator/call_v1/call.ts +651 -0
  114. package/src/gen/video/coordinator/client_v1_rpc/client_rpc.client.ts +463 -0
  115. package/src/gen/video/coordinator/client_v1_rpc/client_rpc.ts +3819 -0
  116. package/src/gen/video/coordinator/client_v1_rpc/envelopes.ts +424 -0
  117. package/src/gen/video/coordinator/client_v1_rpc/websocket.ts +719 -0
  118. package/src/gen/video/coordinator/edge_v1/edge.ts +532 -0
  119. package/src/gen/video/coordinator/event_v1/event.ts +1171 -0
  120. package/src/gen/video/coordinator/geofence_v1/geofence.ts +128 -0
  121. package/src/gen/video/coordinator/member_v1/member.ts +138 -0
  122. package/src/gen/video/coordinator/participant_v1/participant.ts +261 -0
  123. package/src/gen/video/coordinator/push_v1/push.ts +651 -0
  124. package/src/gen/video/coordinator/stat_v1/stat.ts +656 -0
  125. package/src/gen/video/coordinator/user_v1/user.ts +277 -0
  126. package/src/gen/video/coordinator/utils_v1/utils.ts +98 -0
  127. package/src/gen/video/sfu/event/events.ts +1962 -0
  128. package/src/gen/video/sfu/models/models.ts +1062 -0
  129. package/src/gen/video/sfu/signal_rpc/signal.client.ts +108 -0
  130. package/src/gen/video/sfu/signal_rpc/signal.ts +906 -0
  131. package/src/helpers/browsers.ts +13 -0
  132. package/src/helpers/sound-detector.ts +85 -0
  133. package/src/rpc/createClient.ts +50 -0
  134. package/src/rpc/index.ts +2 -0
  135. package/src/rpc/latency.ts +43 -0
  136. package/src/rtc/Call.ts +585 -0
  137. package/src/rtc/CallMetadata.ts +24 -0
  138. package/src/rtc/Dispatcher.ts +46 -0
  139. package/src/rtc/IceTrickleBuffer.ts +21 -0
  140. package/src/rtc/callEventHandlers.ts +37 -0
  141. package/src/rtc/codecs.ts +61 -0
  142. package/src/rtc/helpers/iceCandidate.ts +16 -0
  143. package/src/rtc/helpers/tracks.ts +18 -0
  144. package/src/rtc/publisher.ts +305 -0
  145. package/src/rtc/signal.ts +34 -0
  146. package/src/rtc/subscriber.ts +85 -0
  147. package/src/rtc/types.ts +105 -0
  148. package/src/rtc/videoLayers.ts +103 -0
  149. package/src/stats/coordinator-stats-reporter.ts +167 -0
  150. package/src/stats/state-store-stats-reporter.ts +364 -0
  151. package/src/stats/types.ts +46 -0
  152. package/src/store/index.ts +2 -0
  153. package/src/store/rxUtils.ts +42 -0
  154. package/src/store/stateStore.ts +341 -0
  155. package/tsconfig.json +25 -0
  156. package/typedoc.json +11 -0
  157. package/vite.config.ts +11 -0
@@ -0,0 +1,320 @@
1
+ import { ServiceType } from "@protobuf-ts/runtime-rpc";
2
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
3
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
4
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
5
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
6
+ import type { PartialMessage } from "@protobuf-ts/runtime";
7
+ import { MessageType } from "@protobuf-ts/runtime";
8
+ import { TrackInfo } from "../models/models";
9
+ import { PeerType } from "../models/models";
10
+ import { VideoDimension } from "../models/models";
11
+ import { TrackType } from "../models/models";
12
+ import { Error } from "../models/models";
13
+ /**
14
+ * @generated from protobuf message stream.video.sfu.signal.UpdateMuteStatesRequest
15
+ */
16
+ export interface UpdateMuteStatesRequest {
17
+ /**
18
+ * @generated from protobuf field: string session_id = 1;
19
+ */
20
+ sessionId: string;
21
+ /**
22
+ * @generated from protobuf field: repeated stream.video.sfu.signal.TrackMuteState mute_states = 3;
23
+ */
24
+ muteStates: TrackMuteState[];
25
+ }
26
+ /**
27
+ * @generated from protobuf message stream.video.sfu.signal.UpdateMuteStatesResponse
28
+ */
29
+ export interface UpdateMuteStatesResponse {
30
+ /**
31
+ * @generated from protobuf field: stream.video.sfu.models.Error error = 4;
32
+ */
33
+ error?: Error;
34
+ }
35
+ /**
36
+ * @generated from protobuf message stream.video.sfu.signal.TrackMuteState
37
+ */
38
+ export interface TrackMuteState {
39
+ /**
40
+ * @generated from protobuf field: stream.video.sfu.models.TrackType track_type = 1;
41
+ */
42
+ trackType: TrackType;
43
+ /**
44
+ * @generated from protobuf field: bool muted = 2;
45
+ */
46
+ muted: boolean;
47
+ }
48
+ /**
49
+ * @generated from protobuf message stream.video.sfu.signal.AudioMuteChanged
50
+ */
51
+ export interface AudioMuteChanged {
52
+ /**
53
+ * @generated from protobuf field: bool muted = 1;
54
+ */
55
+ muted: boolean;
56
+ }
57
+ /**
58
+ * @generated from protobuf message stream.video.sfu.signal.VideoMuteChanged
59
+ */
60
+ export interface VideoMuteChanged {
61
+ /**
62
+ * @generated from protobuf field: bool muted = 2;
63
+ */
64
+ muted: boolean;
65
+ }
66
+ /**
67
+ * @generated from protobuf message stream.video.sfu.signal.UpdateSubscriptionsRequest
68
+ */
69
+ export interface UpdateSubscriptionsRequest {
70
+ /**
71
+ * @generated from protobuf field: string session_id = 2;
72
+ */
73
+ sessionId: string;
74
+ /**
75
+ * @generated from protobuf field: repeated stream.video.sfu.signal.TrackSubscriptionDetails tracks = 3;
76
+ */
77
+ tracks: TrackSubscriptionDetails[];
78
+ }
79
+ /**
80
+ * @generated from protobuf message stream.video.sfu.signal.UpdateSubscriptionsResponse
81
+ */
82
+ export interface UpdateSubscriptionsResponse {
83
+ /**
84
+ * @generated from protobuf field: stream.video.sfu.models.Error error = 4;
85
+ */
86
+ error?: Error;
87
+ }
88
+ /**
89
+ * @generated from protobuf message stream.video.sfu.signal.TrackSubscriptionDetails
90
+ */
91
+ export interface TrackSubscriptionDetails {
92
+ /**
93
+ * @generated from protobuf field: string user_id = 1;
94
+ */
95
+ userId: string;
96
+ /**
97
+ * @generated from protobuf field: string session_id = 2;
98
+ */
99
+ sessionId: string;
100
+ /**
101
+ * @generated from protobuf field: stream.video.sfu.models.TrackType track_type = 3;
102
+ */
103
+ trackType: TrackType;
104
+ /**
105
+ * @generated from protobuf field: stream.video.sfu.models.VideoDimension dimension = 4;
106
+ */
107
+ dimension?: VideoDimension;
108
+ }
109
+ /**
110
+ * @generated from protobuf message stream.video.sfu.signal.SendAnswerRequest
111
+ */
112
+ export interface SendAnswerRequest {
113
+ /**
114
+ * @generated from protobuf field: stream.video.sfu.models.PeerType peer_type = 1;
115
+ */
116
+ peerType: PeerType;
117
+ /**
118
+ * @generated from protobuf field: string sdp = 2;
119
+ */
120
+ sdp: string;
121
+ /**
122
+ * @generated from protobuf field: string session_id = 3;
123
+ */
124
+ sessionId: string;
125
+ }
126
+ /**
127
+ * @generated from protobuf message stream.video.sfu.signal.SendAnswerResponse
128
+ */
129
+ export interface SendAnswerResponse {
130
+ /**
131
+ * @generated from protobuf field: stream.video.sfu.models.Error error = 4;
132
+ */
133
+ error?: Error;
134
+ }
135
+ /**
136
+ * @generated from protobuf message stream.video.sfu.signal.ICETrickleResponse
137
+ */
138
+ export interface ICETrickleResponse {
139
+ /**
140
+ * @generated from protobuf field: stream.video.sfu.models.Error error = 4;
141
+ */
142
+ error?: Error;
143
+ }
144
+ /**
145
+ * @generated from protobuf message stream.video.sfu.signal.SetPublisherRequest
146
+ */
147
+ export interface SetPublisherRequest {
148
+ /**
149
+ * sdp offer
150
+ *
151
+ * @generated from protobuf field: string sdp = 1;
152
+ */
153
+ sdp: string;
154
+ /**
155
+ * @generated from protobuf field: string session_id = 2;
156
+ */
157
+ sessionId: string;
158
+ /**
159
+ * @generated from protobuf field: repeated stream.video.sfu.models.TrackInfo tracks = 3;
160
+ */
161
+ tracks: TrackInfo[];
162
+ }
163
+ /**
164
+ * @generated from protobuf message stream.video.sfu.signal.SetPublisherResponse
165
+ */
166
+ export interface SetPublisherResponse {
167
+ /**
168
+ * sdp answer
169
+ *
170
+ * @generated from protobuf field: string sdp = 1;
171
+ */
172
+ sdp: string;
173
+ /**
174
+ * @generated from protobuf field: string session_id = 2;
175
+ */
176
+ sessionId: string;
177
+ /**
178
+ * @generated from protobuf field: bool ice_restart = 3;
179
+ */
180
+ iceRestart: boolean;
181
+ /**
182
+ * @generated from protobuf field: stream.video.sfu.models.Error error = 4;
183
+ */
184
+ error?: Error;
185
+ }
186
+ declare class UpdateMuteStatesRequest$Type extends MessageType<UpdateMuteStatesRequest> {
187
+ constructor();
188
+ create(value?: PartialMessage<UpdateMuteStatesRequest>): UpdateMuteStatesRequest;
189
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateMuteStatesRequest): UpdateMuteStatesRequest;
190
+ internalBinaryWrite(message: UpdateMuteStatesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
191
+ }
192
+ /**
193
+ * @generated MessageType for protobuf message stream.video.sfu.signal.UpdateMuteStatesRequest
194
+ */
195
+ export declare const UpdateMuteStatesRequest: UpdateMuteStatesRequest$Type;
196
+ declare class UpdateMuteStatesResponse$Type extends MessageType<UpdateMuteStatesResponse> {
197
+ constructor();
198
+ create(value?: PartialMessage<UpdateMuteStatesResponse>): UpdateMuteStatesResponse;
199
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateMuteStatesResponse): UpdateMuteStatesResponse;
200
+ internalBinaryWrite(message: UpdateMuteStatesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
201
+ }
202
+ /**
203
+ * @generated MessageType for protobuf message stream.video.sfu.signal.UpdateMuteStatesResponse
204
+ */
205
+ export declare const UpdateMuteStatesResponse: UpdateMuteStatesResponse$Type;
206
+ declare class TrackMuteState$Type extends MessageType<TrackMuteState> {
207
+ constructor();
208
+ create(value?: PartialMessage<TrackMuteState>): TrackMuteState;
209
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TrackMuteState): TrackMuteState;
210
+ internalBinaryWrite(message: TrackMuteState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
211
+ }
212
+ /**
213
+ * @generated MessageType for protobuf message stream.video.sfu.signal.TrackMuteState
214
+ */
215
+ export declare const TrackMuteState: TrackMuteState$Type;
216
+ declare class AudioMuteChanged$Type extends MessageType<AudioMuteChanged> {
217
+ constructor();
218
+ create(value?: PartialMessage<AudioMuteChanged>): AudioMuteChanged;
219
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AudioMuteChanged): AudioMuteChanged;
220
+ internalBinaryWrite(message: AudioMuteChanged, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
221
+ }
222
+ /**
223
+ * @generated MessageType for protobuf message stream.video.sfu.signal.AudioMuteChanged
224
+ */
225
+ export declare const AudioMuteChanged: AudioMuteChanged$Type;
226
+ declare class VideoMuteChanged$Type extends MessageType<VideoMuteChanged> {
227
+ constructor();
228
+ create(value?: PartialMessage<VideoMuteChanged>): VideoMuteChanged;
229
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: VideoMuteChanged): VideoMuteChanged;
230
+ internalBinaryWrite(message: VideoMuteChanged, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
231
+ }
232
+ /**
233
+ * @generated MessageType for protobuf message stream.video.sfu.signal.VideoMuteChanged
234
+ */
235
+ export declare const VideoMuteChanged: VideoMuteChanged$Type;
236
+ declare class UpdateSubscriptionsRequest$Type extends MessageType<UpdateSubscriptionsRequest> {
237
+ constructor();
238
+ create(value?: PartialMessage<UpdateSubscriptionsRequest>): UpdateSubscriptionsRequest;
239
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateSubscriptionsRequest): UpdateSubscriptionsRequest;
240
+ internalBinaryWrite(message: UpdateSubscriptionsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
241
+ }
242
+ /**
243
+ * @generated MessageType for protobuf message stream.video.sfu.signal.UpdateSubscriptionsRequest
244
+ */
245
+ export declare const UpdateSubscriptionsRequest: UpdateSubscriptionsRequest$Type;
246
+ declare class UpdateSubscriptionsResponse$Type extends MessageType<UpdateSubscriptionsResponse> {
247
+ constructor();
248
+ create(value?: PartialMessage<UpdateSubscriptionsResponse>): UpdateSubscriptionsResponse;
249
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateSubscriptionsResponse): UpdateSubscriptionsResponse;
250
+ internalBinaryWrite(message: UpdateSubscriptionsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
251
+ }
252
+ /**
253
+ * @generated MessageType for protobuf message stream.video.sfu.signal.UpdateSubscriptionsResponse
254
+ */
255
+ export declare const UpdateSubscriptionsResponse: UpdateSubscriptionsResponse$Type;
256
+ declare class TrackSubscriptionDetails$Type extends MessageType<TrackSubscriptionDetails> {
257
+ constructor();
258
+ create(value?: PartialMessage<TrackSubscriptionDetails>): TrackSubscriptionDetails;
259
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TrackSubscriptionDetails): TrackSubscriptionDetails;
260
+ internalBinaryWrite(message: TrackSubscriptionDetails, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
261
+ }
262
+ /**
263
+ * @generated MessageType for protobuf message stream.video.sfu.signal.TrackSubscriptionDetails
264
+ */
265
+ export declare const TrackSubscriptionDetails: TrackSubscriptionDetails$Type;
266
+ declare class SendAnswerRequest$Type extends MessageType<SendAnswerRequest> {
267
+ constructor();
268
+ create(value?: PartialMessage<SendAnswerRequest>): SendAnswerRequest;
269
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SendAnswerRequest): SendAnswerRequest;
270
+ internalBinaryWrite(message: SendAnswerRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
271
+ }
272
+ /**
273
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SendAnswerRequest
274
+ */
275
+ export declare const SendAnswerRequest: SendAnswerRequest$Type;
276
+ declare class SendAnswerResponse$Type extends MessageType<SendAnswerResponse> {
277
+ constructor();
278
+ create(value?: PartialMessage<SendAnswerResponse>): SendAnswerResponse;
279
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SendAnswerResponse): SendAnswerResponse;
280
+ internalBinaryWrite(message: SendAnswerResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
281
+ }
282
+ /**
283
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SendAnswerResponse
284
+ */
285
+ export declare const SendAnswerResponse: SendAnswerResponse$Type;
286
+ declare class ICETrickleResponse$Type extends MessageType<ICETrickleResponse> {
287
+ constructor();
288
+ create(value?: PartialMessage<ICETrickleResponse>): ICETrickleResponse;
289
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ICETrickleResponse): ICETrickleResponse;
290
+ internalBinaryWrite(message: ICETrickleResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
291
+ }
292
+ /**
293
+ * @generated MessageType for protobuf message stream.video.sfu.signal.ICETrickleResponse
294
+ */
295
+ export declare const ICETrickleResponse: ICETrickleResponse$Type;
296
+ declare class SetPublisherRequest$Type extends MessageType<SetPublisherRequest> {
297
+ constructor();
298
+ create(value?: PartialMessage<SetPublisherRequest>): SetPublisherRequest;
299
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SetPublisherRequest): SetPublisherRequest;
300
+ internalBinaryWrite(message: SetPublisherRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
301
+ }
302
+ /**
303
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SetPublisherRequest
304
+ */
305
+ export declare const SetPublisherRequest: SetPublisherRequest$Type;
306
+ declare class SetPublisherResponse$Type extends MessageType<SetPublisherResponse> {
307
+ constructor();
308
+ create(value?: PartialMessage<SetPublisherResponse>): SetPublisherResponse;
309
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SetPublisherResponse): SetPublisherResponse;
310
+ internalBinaryWrite(message: SetPublisherResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
311
+ }
312
+ /**
313
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SetPublisherResponse
314
+ */
315
+ export declare const SetPublisherResponse: SetPublisherResponse$Type;
316
+ /**
317
+ * @generated ServiceType for protobuf service stream.video.sfu.signal.SignalServer
318
+ */
319
+ export declare const SignalServer: ServiceType;
320
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checks whether the current browser is Safari.
3
+ */
4
+ export declare const isSafari: () => boolean;
5
+ /**
6
+ * Checks whether the current browser is Firefox.
7
+ */
8
+ export declare const isFirefox: () => boolean;
@@ -0,0 +1,34 @@
1
+ export type SoundDetectorOptions = {
2
+ /**
3
+ * Defines how often the detector should check whether a sound is present.
4
+ * Defaults to 500ms.
5
+ */
6
+ detectionFrequencyInMs?: number;
7
+ /**
8
+ * Defines the audio level threshold before a "change" is emitted.
9
+ * Defaults to 150. This value should be in the range of 0-255.
10
+ */
11
+ audioLevelThreshold?: number;
12
+ /**
13
+ * See https://developer.mozilla.org/en-US/docs/web/api/analysernode/fftsize
14
+ *
15
+ * Defaults to 128.
16
+ */
17
+ fftSize?: number;
18
+ /**
19
+ * Defines whether the provided audio stream should be stopped (destroyed)
20
+ * when the sound detector is stopped.
21
+ *
22
+ * Defaults to `true`.
23
+ */
24
+ destroyStreamOnStop?: boolean;
25
+ };
26
+ /**
27
+ * Creates a new sound detector.
28
+ *
29
+ * @param audioStream the audio stream to observe. Depending on the provided configuration, this stream might be destroyed when the sound detector is stopped.
30
+ * @param onSoundDetectedStateChanged a callback which is called when the sound state changes.
31
+ * @param options custom options for the sound detector.
32
+ * @returns a clean-up function which once invoked stops the sound detector.
33
+ */
34
+ export declare const createSoundDetector: (audioStream: MediaStream, onSoundDetectedStateChanged: (isSoundDetected: boolean) => void, options?: SoundDetectorOptions) => () => Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { RpcInterceptor } from '@protobuf-ts/runtime-rpc';
2
+ import { TwirpOptions } from '@protobuf-ts/twirp-transport';
3
+ import { SignalServerClient } from '../gen/video/sfu/signal_rpc/signal.client';
4
+ export declare const withHeaders: (headers: Record<string, string>) => RpcInterceptor;
5
+ /**
6
+ * Creates new SignalServerClient instance.
7
+ *
8
+ * @param options the twirp options.
9
+ */
10
+ export declare const createSignalClient: (options?: TwirpOptions) => SignalServerClient;
@@ -0,0 +1,2 @@
1
+ export * from './createClient';
2
+ export * from './latency';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Measures the latency of the current client to the given endpoint.
3
+ * Uses HTML Image tag in order to avoid CORS issues.
4
+ *
5
+ * @param endpoint the endpoint.
6
+ * @param rounds the number of measuring rounds to perform.
7
+ * @param timeoutAfterMs the request cancellation period.
8
+ */
9
+ export declare const measureResourceLoadLatencyTo: (endpoint: string, rounds?: number, timeoutAfterMs?: number) => Promise<number[]>;
@@ -0,0 +1,180 @@
1
+ import { StreamSfuClient } from '../StreamSfuClient';
2
+ import { CallState, TrackType } from '../gen/video/sfu/models/models';
3
+ import { SfuEventListener } from './Dispatcher';
4
+ import { StreamVideoWriteableStateStore } from '../store';
5
+ import type { CallOptions, PublishOptions, SubscriptionChanges } from './types';
6
+ import { Batcher } from '../Batcher';
7
+ import { CallMetadata } from './CallMetadata';
8
+ /**
9
+ * A `Call` object represents the active call the user is part of. It's not enough to have a `Call` instance, you will also need to call the [`join`](#join) method.
10
+ */
11
+ export declare class Call {
12
+ private readonly client;
13
+ private readonly options;
14
+ private readonly stateStore;
15
+ private readonly userBatcher;
16
+ /**
17
+ * Contains metadata about the call, for example who created the call. You can also extract the call ID from this object, which you'll need for certain API calls (for example to start a recording).
18
+ */
19
+ data: CallMetadata;
20
+ private readonly subscriber;
21
+ private readonly publisher;
22
+ private readonly trackSubscriptionsSubject;
23
+ private statsReporter;
24
+ private joined$;
25
+ /**
26
+ * Don't call the constructor directly, use the [`StreamVideoClient.joinCall`](./StreamVideoClient.md/#joincall) method to construct a `Call` instance.
27
+ * @param client
28
+ * @param data
29
+ * @param options
30
+ * @param stateStore
31
+ * @param userBatcher
32
+ */
33
+ constructor(data: CallMetadata, client: StreamSfuClient, options: CallOptions, stateStore: StreamVideoWriteableStateStore, userBatcher: Batcher<string>);
34
+ /**
35
+ * You can subscribe to WebSocket events provided by the API. To remove a subscription, call the `off` method.
36
+ * Please note that subscribing to WebSocket events is an advanced use-case, for most use-cases it should be enough to watch for changes in the [reactive state store](./StreamVideoClient.md/#readonlystatestore).
37
+ * @param eventName
38
+ * @param fn
39
+ * @returns
40
+ */
41
+ on: (eventName: string, fn: SfuEventListener) => () => void;
42
+ /**
43
+ * Remove subscription for WebSocket events that were created by the `on` method.
44
+ * @param eventName
45
+ * @param fn
46
+ * @returns
47
+ */
48
+ off: (eventName: string, fn: SfuEventListener) => void;
49
+ /**
50
+ * Leave the call and stop the media streams that were published by the call.
51
+ */
52
+ leave: () => void;
53
+ /**
54
+ * Will initiate a call session with the server and return the call state. Don't call this method directly, use the [`StreamVideoClient.joinCall`](./StreamVideoClient.md/#joincall) method that takes care of this operation.
55
+ *
56
+ * If the join was successful the [`activeCall$` state variable](./StreamVideClient/#readonlystatestore) will be set
57
+ *
58
+ * @returns a promise which resolves once the call join-flow has finished.
59
+ */
60
+ join: () => Promise<CallState | undefined>;
61
+ /**
62
+ * Starts publishing the given video stream to the call.
63
+ * The stream will be stopped if the user changes an input device, or if the user leaves the call.
64
+ *
65
+ * If the method was successful the [`activeCall$` state variable](./StreamVideClient/#readonlystatestore) will be cleared
66
+ *
67
+ * Consecutive calls to this method will replace the previously published stream.
68
+ * The previous video stream will be stopped.
69
+ *
70
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
71
+ *
72
+ * @param videoStream the video stream to publish.
73
+ * @param opts the options to use when publishing the stream.
74
+ */
75
+ publishVideoStream: (videoStream: MediaStream, opts?: PublishOptions) => Promise<void>;
76
+ /**
77
+ * Starts publishing the given audio stream to the call.
78
+ * The stream will be stopped if the user changes an input device, or if the user leaves the call.
79
+ *
80
+ * Consecutive calls to this method will replace the audio stream that is currently being published.
81
+ * The previous audio stream will be stopped.
82
+ *
83
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
84
+ *
85
+ * @param audioStream the audio stream to publish.
86
+ */
87
+ publishAudioStream: (audioStream: MediaStream) => Promise<void>;
88
+ /**
89
+ * Starts publishing the given screen-share stream to the call.
90
+ *
91
+ * Consecutive calls to this method will replace the previous screen-share stream.
92
+ * The previous screen-share stream will be stopped.
93
+ *
94
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
95
+ *
96
+ * @param screenShareStream the screen-share stream to publish.
97
+ */
98
+ publishScreenShareStream: (screenShareStream: MediaStream) => Promise<void>;
99
+ /**
100
+ * Stops publishing the given track type to the call, if it is currently being published.
101
+ * Underlying track will be stopped and removed from the publisher.
102
+ *
103
+ * The `audioDeviceId`/`videoDeviceId` property of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore) won't be updated, you can do that by calling the [`setAudioDevice`](#setaudiodevice)/[`setVideoDevice`](#setvideodevice) method.
104
+ *
105
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
106
+ *
107
+ * @param trackType the track type to stop publishing.
108
+ */
109
+ stopPublish: (trackType: TrackType) => Promise<void>;
110
+ /**
111
+ * Update track subscription configuration for one or more participants.
112
+ * You have to create a subscription for each participant for all the different kinds of tracks you want to receive.
113
+ * You can only subscribe for tracks after the participant started publishing the given kind of track.
114
+ *
115
+ * @param kind the kind of subscription to update.
116
+ * @param changes the list of subscription changes to do.
117
+ */
118
+ updateSubscriptionsPartial: (kind: 'video' | 'screen', changes: SubscriptionChanges) => void;
119
+ private updateSubscriptions;
120
+ /**
121
+ * @deprecated use the `callStatsReport$` state [store variable](./StreamVideoClient.md/#readonlystatestore) instead
122
+ * @param kind
123
+ * @param selector
124
+ * @returns
125
+ */
126
+ getStats: (kind: 'subscriber' | 'publisher', selector?: MediaStreamTrack) => Promise<RTCStatsReport | undefined>;
127
+ /**
128
+ * Will enhance the reported stats with additional participant-specific information (`callStatsReport$` state [store variable](./StreamVideoClient.md/#readonlystatestore)).
129
+ * This is usually helpful when detailed stats for a specific participant are needed.
130
+ *
131
+ * @param sessionId the sessionId to start reporting for.
132
+ */
133
+ startReportingStatsFor: (sessionId: string) => void;
134
+ /**
135
+ * Opposite of `startReportingStatsFor`.
136
+ * Will turn off stats reporting for a specific participant.
137
+ *
138
+ * @param sessionId the sessionId to stop reporting for.
139
+ */
140
+ stopReportingStatsFor: (sessionId: string) => void;
141
+ /**
142
+ * Sets the used audio output device (`audioOutputDeviceId` of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore).
143
+ *
144
+ * This method only stores the selection, if you're using custom UI components, you'll have to implement the audio switching, for more information see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/sinkId.
145
+ *
146
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
147
+ *
148
+ * @param deviceId the selected device, `undefined` means the user wants to use the system's default audio output
149
+ */
150
+ setAudioOutputDevice: (deviceId?: string) => void;
151
+ /**
152
+ * Sets the `audioDeviceId` property of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore)).
153
+ *
154
+ * This method only stores the selection, if you want to start publishing a media stream call the [`publishAudioStream` method](#publishaudiostream) that will set `audioDeviceId` as well.
155
+ *
156
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
157
+ *
158
+ * @param deviceId the selected device, pass `undefined` to clear the device selection
159
+ */
160
+ setAudioDevice: (deviceId?: string) => void;
161
+ /**
162
+ * Sets the `videoDeviceId` property of the [`localParticipant$`](./StreamVideoClient.md/#readonlystatestore).
163
+ *
164
+ * This method only stores the selection, if you want to start publishing a media stream call the [`publishVideoStream` method](#publishvideostream) that will set `videoDeviceId` as well.
165
+ *
166
+ * @angular It's recommended to use the [`InCallDeviceManagerService`](./InCallDeviceManagerService.md) that takes care of this operation for you.
167
+ *
168
+ * @param deviceId the selected device, pass `undefined` to clear the device selection
169
+ */
170
+ setVideoDevice: (deviceId?: string) => void;
171
+ /**
172
+ * @internal
173
+ * @param enabledRids
174
+ * @returns
175
+ */
176
+ updatePublishQuality: (enabledRids: string[]) => Promise<void>;
177
+ private get participants();
178
+ private handleOnTrack;
179
+ private assertCallJoined;
180
+ }
@@ -0,0 +1,9 @@
1
+ import type { CallResponse, MemberResponse, UserResponse } from '../gen/coordinator';
2
+ export type UserResponseMap = {
3
+ [userId: string]: UserResponse;
4
+ };
5
+ export declare class CallMetadata {
6
+ call: CallResponse;
7
+ users: UserResponseMap;
8
+ constructor(call: CallResponse, members?: MemberResponse[]);
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { SfuEvent } from '../gen/video/sfu/event/events';
2
+ export type SfuEventListener = (event: SfuEvent) => void;
3
+ export declare class Dispatcher {
4
+ private subscribers;
5
+ dispatch: (message: SfuEvent) => void;
6
+ on: (eventName: string, fn: SfuEventListener) => () => void;
7
+ off: (eventName: string, fn: SfuEventListener) => void;
8
+ offAll: (eventName?: string) => void;
9
+ }
@@ -0,0 +1,11 @@
1
+ import { ReplaySubject } from 'rxjs';
2
+ import { ICETrickle } from '../gen/video/sfu/models/models';
3
+ /**
4
+ * A buffer for ICE Candidates. Used for ICE Trickle:
5
+ * - https://bloggeek.me/webrtcglossary/trickle-ice/
6
+ */
7
+ export declare class IceTrickleBuffer {
8
+ readonly subscriberCandidates: ReplaySubject<ICETrickle>;
9
+ readonly publisherCandidates: ReplaySubject<ICETrickle>;
10
+ push: (iceTrickle: ICETrickle) => void;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { Call } from './Call';
2
+ import { Dispatcher } from './Dispatcher';
3
+ import { StreamVideoWriteableStateStore } from '../store';
4
+ import { Batcher } from '../Batcher';
5
+ export declare const registerEventHandlers: (call: Call, store: StreamVideoWriteableStateStore, dispatcher: Dispatcher, userBatcher: Batcher<string>) => void;
@@ -0,0 +1,2 @@
1
+ export declare const getPreferredCodecs: (kind: 'audio' | 'video', videoCodec: string) => RTCRtpCodecCapability[] | undefined;
2
+ export declare const getGenericSdp: (direction: RTCRtpTransceiverDirection) => Promise<string | undefined>;
@@ -0,0 +1,2 @@
1
+ import { ICETrickle } from '../../gen/video/sfu/models/models';
2
+ export declare function getIceCandidate(candidate: RTCIceCandidate): ICETrickle['iceCandidate'];
@@ -0,0 +1,3 @@
1
+ import { TrackType } from '../../gen/video/sfu/models/models';
2
+ import type { StreamVideoParticipant } from '../types';
3
+ export declare const trackTypeToParticipantStreamKey: (trackType: TrackType) => keyof StreamVideoParticipant | undefined;