@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,656 @@
1
+ /* eslint-disable */
2
+ // @generated by protobuf-ts 2.8.1 with parameter long_type_string,client_generic,server_none,eslint_disable
3
+ // @generated from protobuf file "video/coordinator/stat_v1/stat.proto" (package "stream.video.coordinator.stat_v1", syntax proto3)
4
+ // tslint:disable
5
+ import { WireType } from "@protobuf-ts/runtime";
6
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
7
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
8
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
9
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
10
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
11
+ import type { PartialMessage } from "@protobuf-ts/runtime";
12
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
13
+ import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
14
+ import { MessageType } from "@protobuf-ts/runtime";
15
+ import { Timestamp } from "../../../google/protobuf/timestamp";
16
+ import { Duration } from "../../../google/protobuf/duration";
17
+ /**
18
+ * ParticipantConnected is fired when a user joins a call
19
+ *
20
+ * @generated from protobuf message stream.video.coordinator.stat_v1.ParticipantConnected
21
+ */
22
+ export interface ParticipantConnected {
23
+ }
24
+ /**
25
+ * ParticipantDisconnected is fired when a user leaves a call
26
+ *
27
+ * @generated from protobuf message stream.video.coordinator.stat_v1.ParticipantDisconnected
28
+ */
29
+ export interface ParticipantDisconnected {
30
+ }
31
+ /**
32
+ * The participant experienced a significant amount of audio/video freeze when observing a given peer
33
+ *
34
+ * @generated from protobuf message stream.video.coordinator.stat_v1.Freeze
35
+ */
36
+ export interface Freeze {
37
+ /**
38
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaType media_type = 1;
39
+ */
40
+ mediaType: MediaType;
41
+ /**
42
+ * Sender of the media stream
43
+ *
44
+ * @generated from protobuf field: string peer_id = 2;
45
+ */
46
+ peerId: string;
47
+ /**
48
+ * @generated from protobuf field: google.protobuf.Duration duration = 3;
49
+ */
50
+ duration?: Duration;
51
+ }
52
+ /**
53
+ * A participant started/ended sending/receiving audio/video for a given reason
54
+ *
55
+ * @generated from protobuf message stream.video.coordinator.stat_v1.MediaStateChanged
56
+ */
57
+ export interface MediaStateChanged {
58
+ /**
59
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaType media_type = 1;
60
+ */
61
+ mediaType: MediaType;
62
+ /**
63
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaStateChange change = 2;
64
+ */
65
+ change: MediaStateChange;
66
+ /**
67
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaDirection direction = 3;
68
+ */
69
+ direction: MediaDirection;
70
+ /**
71
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaStateChangeReason reason = 4;
72
+ */
73
+ reason: MediaStateChangeReason;
74
+ }
75
+ /**
76
+ * A stat event from the perspective of a particular participant
77
+ *
78
+ * @generated from protobuf message stream.video.coordinator.stat_v1.TimelineEvent
79
+ */
80
+ export interface TimelineEvent {
81
+ /**
82
+ * Event timestamp as RFC3339 string.
83
+ *
84
+ * @generated from protobuf field: google.protobuf.Timestamp timestamp = 1;
85
+ */
86
+ timestamp?: Timestamp;
87
+ /**
88
+ * @generated from protobuf oneof: event
89
+ */
90
+ event: {
91
+ oneofKind: "participantConnected";
92
+ /**
93
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.ParticipantConnected participant_connected = 2;
94
+ */
95
+ participantConnected: ParticipantConnected;
96
+ } | {
97
+ oneofKind: "participantDisconnected";
98
+ /**
99
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.ParticipantDisconnected participant_disconnected = 3;
100
+ */
101
+ participantDisconnected: ParticipantDisconnected;
102
+ } | {
103
+ oneofKind: "mediaStateChanged";
104
+ /**
105
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.MediaStateChanged media_state_changed = 4;
106
+ */
107
+ mediaStateChanged: MediaStateChanged;
108
+ } | {
109
+ oneofKind: "freeze";
110
+ /**
111
+ * @generated from protobuf field: stream.video.coordinator.stat_v1.Freeze freeze = 5;
112
+ */
113
+ freeze: Freeze;
114
+ } | {
115
+ oneofKind: undefined;
116
+ };
117
+ }
118
+ /**
119
+ * @generated from protobuf message stream.video.coordinator.stat_v1.CallParticipantTimeline
120
+ */
121
+ export interface CallParticipantTimeline {
122
+ /**
123
+ * The events in this timeline are from the perspective of the user with this ID
124
+ *
125
+ * @generated from protobuf field: string user_id = 1;
126
+ */
127
+ userId: string;
128
+ /**
129
+ * time when participant joined
130
+ *
131
+ * @generated from protobuf field: google.protobuf.Timestamp start = 2;
132
+ */
133
+ start?: Timestamp;
134
+ /**
135
+ * time when participant left
136
+ *
137
+ * @generated from protobuf field: google.protobuf.Timestamp end = 3;
138
+ */
139
+ end?: Timestamp;
140
+ /**
141
+ * @generated from protobuf field: repeated stream.video.coordinator.stat_v1.TimelineEvent events = 4;
142
+ */
143
+ events: TimelineEvent[];
144
+ }
145
+ /**
146
+ * @generated from protobuf message stream.video.coordinator.stat_v1.Session
147
+ */
148
+ export interface Session {
149
+ /**
150
+ * @generated from protobuf field: string session_id = 1;
151
+ */
152
+ sessionId: string;
153
+ /**
154
+ * @generated from protobuf field: string call_id = 2;
155
+ */
156
+ callId: string;
157
+ /**
158
+ * @generated from protobuf field: string call_type = 3;
159
+ */
160
+ callType: string;
161
+ /**
162
+ * time when first participant joined
163
+ *
164
+ * @generated from protobuf field: google.protobuf.Timestamp start = 4;
165
+ */
166
+ start?: Timestamp;
167
+ /**
168
+ * time when last participant left
169
+ *
170
+ * @generated from protobuf field: google.protobuf.Timestamp end = 5;
171
+ */
172
+ end?: Timestamp;
173
+ }
174
+ /**
175
+ * @generated from protobuf enum stream.video.coordinator.stat_v1.MediaType
176
+ */
177
+ export enum MediaType {
178
+ /**
179
+ * @generated from protobuf enum value: MEDIA_TYPE_UNSPECIFIED = 0;
180
+ */
181
+ UNSPECIFIED = 0,
182
+ /**
183
+ * @generated from protobuf enum value: MEDIA_TYPE_AUDIO = 1;
184
+ */
185
+ AUDIO = 1,
186
+ /**
187
+ * @generated from protobuf enum value: MEDIA_TYPE_VIDEO = 2;
188
+ */
189
+ VIDEO = 2,
190
+ /**
191
+ * @generated from protobuf enum value: MEDIA_TYPE_SCREEN_SHARE = 3;
192
+ */
193
+ SCREEN_SHARE = 3
194
+ }
195
+ /**
196
+ * @generated from protobuf enum stream.video.coordinator.stat_v1.MediaStateChange
197
+ */
198
+ export enum MediaStateChange {
199
+ /**
200
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_UNSPECIFIED = 0;
201
+ */
202
+ UNSPECIFIED = 0,
203
+ /**
204
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_STARTED = 1;
205
+ */
206
+ STARTED = 1,
207
+ /**
208
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_ENDED = 2;
209
+ */
210
+ ENDED = 2
211
+ }
212
+ /**
213
+ * @generated from protobuf enum stream.video.coordinator.stat_v1.MediaDirection
214
+ */
215
+ export enum MediaDirection {
216
+ /**
217
+ * @generated from protobuf enum value: MEDIA_DIRECTION_UNSPECIFIED = 0;
218
+ */
219
+ UNSPECIFIED = 0,
220
+ /**
221
+ * @generated from protobuf enum value: MEDIA_DIRECTION_SEND = 1;
222
+ */
223
+ SEND = 1,
224
+ /**
225
+ * @generated from protobuf enum value: MEDIA_DIRECTION_RECEIVE = 2;
226
+ */
227
+ RECEIVE = 2
228
+ }
229
+ /**
230
+ * @generated from protobuf enum stream.video.coordinator.stat_v1.MediaStateChangeReason
231
+ */
232
+ export enum MediaStateChangeReason {
233
+ /**
234
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_REASON_UNSPECIFIED = 0;
235
+ */
236
+ UNSPECIFIED = 0,
237
+ /**
238
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_REASON_MUTE = 1;
239
+ */
240
+ MUTE = 1,
241
+ /**
242
+ * @generated from protobuf enum value: MEDIA_STATE_CHANGE_REASON_CONNECTION = 2;
243
+ */
244
+ CONNECTION = 2
245
+ }
246
+ // @generated message type with reflection information, may provide speed optimized methods
247
+ class ParticipantConnected$Type extends MessageType<ParticipantConnected> {
248
+ constructor() {
249
+ super("stream.video.coordinator.stat_v1.ParticipantConnected", []);
250
+ }
251
+ create(value?: PartialMessage<ParticipantConnected>): ParticipantConnected {
252
+ const message = {};
253
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
254
+ if (value !== undefined)
255
+ reflectionMergePartial<ParticipantConnected>(this, message, value);
256
+ return message;
257
+ }
258
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ParticipantConnected): ParticipantConnected {
259
+ return target ?? this.create();
260
+ }
261
+ internalBinaryWrite(message: ParticipantConnected, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
262
+ let u = options.writeUnknownFields;
263
+ if (u !== false)
264
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
265
+ return writer;
266
+ }
267
+ }
268
+ /**
269
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.ParticipantConnected
270
+ */
271
+ export const ParticipantConnected = new ParticipantConnected$Type();
272
+ // @generated message type with reflection information, may provide speed optimized methods
273
+ class ParticipantDisconnected$Type extends MessageType<ParticipantDisconnected> {
274
+ constructor() {
275
+ super("stream.video.coordinator.stat_v1.ParticipantDisconnected", []);
276
+ }
277
+ create(value?: PartialMessage<ParticipantDisconnected>): ParticipantDisconnected {
278
+ const message = {};
279
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
280
+ if (value !== undefined)
281
+ reflectionMergePartial<ParticipantDisconnected>(this, message, value);
282
+ return message;
283
+ }
284
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ParticipantDisconnected): ParticipantDisconnected {
285
+ return target ?? this.create();
286
+ }
287
+ internalBinaryWrite(message: ParticipantDisconnected, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
288
+ let u = options.writeUnknownFields;
289
+ if (u !== false)
290
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
291
+ return writer;
292
+ }
293
+ }
294
+ /**
295
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.ParticipantDisconnected
296
+ */
297
+ export const ParticipantDisconnected = new ParticipantDisconnected$Type();
298
+ // @generated message type with reflection information, may provide speed optimized methods
299
+ class Freeze$Type extends MessageType<Freeze> {
300
+ constructor() {
301
+ super("stream.video.coordinator.stat_v1.Freeze", [
302
+ { no: 1, name: "media_type", kind: "enum", T: () => ["stream.video.coordinator.stat_v1.MediaType", MediaType, "MEDIA_TYPE_"] },
303
+ { no: 2, name: "peer_id", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
304
+ { no: 3, name: "duration", kind: "message", T: () => Duration }
305
+ ]);
306
+ }
307
+ create(value?: PartialMessage<Freeze>): Freeze {
308
+ const message = { mediaType: 0, peerId: "" };
309
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
310
+ if (value !== undefined)
311
+ reflectionMergePartial<Freeze>(this, message, value);
312
+ return message;
313
+ }
314
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Freeze): Freeze {
315
+ let message = target ?? this.create(), end = reader.pos + length;
316
+ while (reader.pos < end) {
317
+ let [fieldNo, wireType] = reader.tag();
318
+ switch (fieldNo) {
319
+ case /* stream.video.coordinator.stat_v1.MediaType media_type */ 1:
320
+ message.mediaType = reader.int32();
321
+ break;
322
+ case /* string peer_id */ 2:
323
+ message.peerId = reader.string();
324
+ break;
325
+ case /* google.protobuf.Duration duration */ 3:
326
+ message.duration = Duration.internalBinaryRead(reader, reader.uint32(), options, message.duration);
327
+ break;
328
+ default:
329
+ let u = options.readUnknownField;
330
+ if (u === "throw")
331
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
332
+ let d = reader.skip(wireType);
333
+ if (u !== false)
334
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
335
+ }
336
+ }
337
+ return message;
338
+ }
339
+ internalBinaryWrite(message: Freeze, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
340
+ /* stream.video.coordinator.stat_v1.MediaType media_type = 1; */
341
+ if (message.mediaType !== 0)
342
+ writer.tag(1, WireType.Varint).int32(message.mediaType);
343
+ /* string peer_id = 2; */
344
+ if (message.peerId !== "")
345
+ writer.tag(2, WireType.LengthDelimited).string(message.peerId);
346
+ /* google.protobuf.Duration duration = 3; */
347
+ if (message.duration)
348
+ Duration.internalBinaryWrite(message.duration, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
349
+ let u = options.writeUnknownFields;
350
+ if (u !== false)
351
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
352
+ return writer;
353
+ }
354
+ }
355
+ /**
356
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.Freeze
357
+ */
358
+ export const Freeze = new Freeze$Type();
359
+ // @generated message type with reflection information, may provide speed optimized methods
360
+ class MediaStateChanged$Type extends MessageType<MediaStateChanged> {
361
+ constructor() {
362
+ super("stream.video.coordinator.stat_v1.MediaStateChanged", [
363
+ { no: 1, name: "media_type", kind: "enum", T: () => ["stream.video.coordinator.stat_v1.MediaType", MediaType, "MEDIA_TYPE_"] },
364
+ { no: 2, name: "change", kind: "enum", T: () => ["stream.video.coordinator.stat_v1.MediaStateChange", MediaStateChange, "MEDIA_STATE_CHANGE_"] },
365
+ { no: 3, name: "direction", kind: "enum", T: () => ["stream.video.coordinator.stat_v1.MediaDirection", MediaDirection, "MEDIA_DIRECTION_"] },
366
+ { no: 4, name: "reason", kind: "enum", T: () => ["stream.video.coordinator.stat_v1.MediaStateChangeReason", MediaStateChangeReason, "MEDIA_STATE_CHANGE_REASON_"] }
367
+ ]);
368
+ }
369
+ create(value?: PartialMessage<MediaStateChanged>): MediaStateChanged {
370
+ const message = { mediaType: 0, change: 0, direction: 0, reason: 0 };
371
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
372
+ if (value !== undefined)
373
+ reflectionMergePartial<MediaStateChanged>(this, message, value);
374
+ return message;
375
+ }
376
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MediaStateChanged): MediaStateChanged {
377
+ let message = target ?? this.create(), end = reader.pos + length;
378
+ while (reader.pos < end) {
379
+ let [fieldNo, wireType] = reader.tag();
380
+ switch (fieldNo) {
381
+ case /* stream.video.coordinator.stat_v1.MediaType media_type */ 1:
382
+ message.mediaType = reader.int32();
383
+ break;
384
+ case /* stream.video.coordinator.stat_v1.MediaStateChange change */ 2:
385
+ message.change = reader.int32();
386
+ break;
387
+ case /* stream.video.coordinator.stat_v1.MediaDirection direction */ 3:
388
+ message.direction = reader.int32();
389
+ break;
390
+ case /* stream.video.coordinator.stat_v1.MediaStateChangeReason reason */ 4:
391
+ message.reason = reader.int32();
392
+ break;
393
+ default:
394
+ let u = options.readUnknownField;
395
+ if (u === "throw")
396
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
397
+ let d = reader.skip(wireType);
398
+ if (u !== false)
399
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
400
+ }
401
+ }
402
+ return message;
403
+ }
404
+ internalBinaryWrite(message: MediaStateChanged, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
405
+ /* stream.video.coordinator.stat_v1.MediaType media_type = 1; */
406
+ if (message.mediaType !== 0)
407
+ writer.tag(1, WireType.Varint).int32(message.mediaType);
408
+ /* stream.video.coordinator.stat_v1.MediaStateChange change = 2; */
409
+ if (message.change !== 0)
410
+ writer.tag(2, WireType.Varint).int32(message.change);
411
+ /* stream.video.coordinator.stat_v1.MediaDirection direction = 3; */
412
+ if (message.direction !== 0)
413
+ writer.tag(3, WireType.Varint).int32(message.direction);
414
+ /* stream.video.coordinator.stat_v1.MediaStateChangeReason reason = 4; */
415
+ if (message.reason !== 0)
416
+ writer.tag(4, WireType.Varint).int32(message.reason);
417
+ let u = options.writeUnknownFields;
418
+ if (u !== false)
419
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
420
+ return writer;
421
+ }
422
+ }
423
+ /**
424
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.MediaStateChanged
425
+ */
426
+ export const MediaStateChanged = new MediaStateChanged$Type();
427
+ // @generated message type with reflection information, may provide speed optimized methods
428
+ class TimelineEvent$Type extends MessageType<TimelineEvent> {
429
+ constructor() {
430
+ super("stream.video.coordinator.stat_v1.TimelineEvent", [
431
+ { no: 1, name: "timestamp", kind: "message", T: () => Timestamp },
432
+ { no: 2, name: "participant_connected", kind: "message", oneof: "event", T: () => ParticipantConnected },
433
+ { no: 3, name: "participant_disconnected", kind: "message", oneof: "event", T: () => ParticipantDisconnected },
434
+ { no: 4, name: "media_state_changed", kind: "message", oneof: "event", T: () => MediaStateChanged },
435
+ { no: 5, name: "freeze", kind: "message", oneof: "event", T: () => Freeze }
436
+ ]);
437
+ }
438
+ create(value?: PartialMessage<TimelineEvent>): TimelineEvent {
439
+ const message = { event: { oneofKind: undefined } };
440
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
441
+ if (value !== undefined)
442
+ reflectionMergePartial<TimelineEvent>(this, message, value);
443
+ return message;
444
+ }
445
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TimelineEvent): TimelineEvent {
446
+ let message = target ?? this.create(), end = reader.pos + length;
447
+ while (reader.pos < end) {
448
+ let [fieldNo, wireType] = reader.tag();
449
+ switch (fieldNo) {
450
+ case /* google.protobuf.Timestamp timestamp */ 1:
451
+ message.timestamp = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp);
452
+ break;
453
+ case /* stream.video.coordinator.stat_v1.ParticipantConnected participant_connected */ 2:
454
+ message.event = {
455
+ oneofKind: "participantConnected",
456
+ participantConnected: ParticipantConnected.internalBinaryRead(reader, reader.uint32(), options, (message.event as any).participantConnected)
457
+ };
458
+ break;
459
+ case /* stream.video.coordinator.stat_v1.ParticipantDisconnected participant_disconnected */ 3:
460
+ message.event = {
461
+ oneofKind: "participantDisconnected",
462
+ participantDisconnected: ParticipantDisconnected.internalBinaryRead(reader, reader.uint32(), options, (message.event as any).participantDisconnected)
463
+ };
464
+ break;
465
+ case /* stream.video.coordinator.stat_v1.MediaStateChanged media_state_changed */ 4:
466
+ message.event = {
467
+ oneofKind: "mediaStateChanged",
468
+ mediaStateChanged: MediaStateChanged.internalBinaryRead(reader, reader.uint32(), options, (message.event as any).mediaStateChanged)
469
+ };
470
+ break;
471
+ case /* stream.video.coordinator.stat_v1.Freeze freeze */ 5:
472
+ message.event = {
473
+ oneofKind: "freeze",
474
+ freeze: Freeze.internalBinaryRead(reader, reader.uint32(), options, (message.event as any).freeze)
475
+ };
476
+ break;
477
+ default:
478
+ let u = options.readUnknownField;
479
+ if (u === "throw")
480
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
481
+ let d = reader.skip(wireType);
482
+ if (u !== false)
483
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
484
+ }
485
+ }
486
+ return message;
487
+ }
488
+ internalBinaryWrite(message: TimelineEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
489
+ /* google.protobuf.Timestamp timestamp = 1; */
490
+ if (message.timestamp)
491
+ Timestamp.internalBinaryWrite(message.timestamp, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
492
+ /* stream.video.coordinator.stat_v1.ParticipantConnected participant_connected = 2; */
493
+ if (message.event.oneofKind === "participantConnected")
494
+ ParticipantConnected.internalBinaryWrite(message.event.participantConnected, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
495
+ /* stream.video.coordinator.stat_v1.ParticipantDisconnected participant_disconnected = 3; */
496
+ if (message.event.oneofKind === "participantDisconnected")
497
+ ParticipantDisconnected.internalBinaryWrite(message.event.participantDisconnected, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
498
+ /* stream.video.coordinator.stat_v1.MediaStateChanged media_state_changed = 4; */
499
+ if (message.event.oneofKind === "mediaStateChanged")
500
+ MediaStateChanged.internalBinaryWrite(message.event.mediaStateChanged, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
501
+ /* stream.video.coordinator.stat_v1.Freeze freeze = 5; */
502
+ if (message.event.oneofKind === "freeze")
503
+ Freeze.internalBinaryWrite(message.event.freeze, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
504
+ let u = options.writeUnknownFields;
505
+ if (u !== false)
506
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
507
+ return writer;
508
+ }
509
+ }
510
+ /**
511
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.TimelineEvent
512
+ */
513
+ export const TimelineEvent = new TimelineEvent$Type();
514
+ // @generated message type with reflection information, may provide speed optimized methods
515
+ class CallParticipantTimeline$Type extends MessageType<CallParticipantTimeline> {
516
+ constructor() {
517
+ super("stream.video.coordinator.stat_v1.CallParticipantTimeline", [
518
+ { no: 1, name: "user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
519
+ { no: 2, name: "start", kind: "message", T: () => Timestamp },
520
+ { no: 3, name: "end", kind: "message", T: () => Timestamp },
521
+ { no: 4, name: "events", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TimelineEvent }
522
+ ]);
523
+ }
524
+ create(value?: PartialMessage<CallParticipantTimeline>): CallParticipantTimeline {
525
+ const message = { userId: "", events: [] };
526
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
527
+ if (value !== undefined)
528
+ reflectionMergePartial<CallParticipantTimeline>(this, message, value);
529
+ return message;
530
+ }
531
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CallParticipantTimeline): CallParticipantTimeline {
532
+ let message = target ?? this.create(), end = reader.pos + length;
533
+ while (reader.pos < end) {
534
+ let [fieldNo, wireType] = reader.tag();
535
+ switch (fieldNo) {
536
+ case /* string user_id */ 1:
537
+ message.userId = reader.string();
538
+ break;
539
+ case /* google.protobuf.Timestamp start */ 2:
540
+ message.start = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.start);
541
+ break;
542
+ case /* google.protobuf.Timestamp end */ 3:
543
+ message.end = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.end);
544
+ break;
545
+ case /* repeated stream.video.coordinator.stat_v1.TimelineEvent events */ 4:
546
+ message.events.push(TimelineEvent.internalBinaryRead(reader, reader.uint32(), options));
547
+ break;
548
+ default:
549
+ let u = options.readUnknownField;
550
+ if (u === "throw")
551
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
552
+ let d = reader.skip(wireType);
553
+ if (u !== false)
554
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
555
+ }
556
+ }
557
+ return message;
558
+ }
559
+ internalBinaryWrite(message: CallParticipantTimeline, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
560
+ /* string user_id = 1; */
561
+ if (message.userId !== "")
562
+ writer.tag(1, WireType.LengthDelimited).string(message.userId);
563
+ /* google.protobuf.Timestamp start = 2; */
564
+ if (message.start)
565
+ Timestamp.internalBinaryWrite(message.start, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
566
+ /* google.protobuf.Timestamp end = 3; */
567
+ if (message.end)
568
+ Timestamp.internalBinaryWrite(message.end, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
569
+ /* repeated stream.video.coordinator.stat_v1.TimelineEvent events = 4; */
570
+ for (let i = 0; i < message.events.length; i++)
571
+ TimelineEvent.internalBinaryWrite(message.events[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
572
+ let u = options.writeUnknownFields;
573
+ if (u !== false)
574
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
575
+ return writer;
576
+ }
577
+ }
578
+ /**
579
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.CallParticipantTimeline
580
+ */
581
+ export const CallParticipantTimeline = new CallParticipantTimeline$Type();
582
+ // @generated message type with reflection information, may provide speed optimized methods
583
+ class Session$Type extends MessageType<Session> {
584
+ constructor() {
585
+ super("stream.video.coordinator.stat_v1.Session", [
586
+ { no: 1, name: "session_id", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "1" } } } },
587
+ { no: 2, name: "call_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
588
+ { no: 3, name: "call_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
589
+ { no: 4, name: "start", kind: "message", T: () => Timestamp },
590
+ { no: 5, name: "end", kind: "message", T: () => Timestamp }
591
+ ]);
592
+ }
593
+ create(value?: PartialMessage<Session>): Session {
594
+ const message = { sessionId: "", callId: "", callType: "" };
595
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
596
+ if (value !== undefined)
597
+ reflectionMergePartial<Session>(this, message, value);
598
+ return message;
599
+ }
600
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Session): Session {
601
+ let message = target ?? this.create(), end = reader.pos + length;
602
+ while (reader.pos < end) {
603
+ let [fieldNo, wireType] = reader.tag();
604
+ switch (fieldNo) {
605
+ case /* string session_id */ 1:
606
+ message.sessionId = reader.string();
607
+ break;
608
+ case /* string call_id */ 2:
609
+ message.callId = reader.string();
610
+ break;
611
+ case /* string call_type */ 3:
612
+ message.callType = reader.string();
613
+ break;
614
+ case /* google.protobuf.Timestamp start */ 4:
615
+ message.start = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.start);
616
+ break;
617
+ case /* google.protobuf.Timestamp end */ 5:
618
+ message.end = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.end);
619
+ break;
620
+ default:
621
+ let u = options.readUnknownField;
622
+ if (u === "throw")
623
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
624
+ let d = reader.skip(wireType);
625
+ if (u !== false)
626
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
627
+ }
628
+ }
629
+ return message;
630
+ }
631
+ internalBinaryWrite(message: Session, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
632
+ /* string session_id = 1; */
633
+ if (message.sessionId !== "")
634
+ writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
635
+ /* string call_id = 2; */
636
+ if (message.callId !== "")
637
+ writer.tag(2, WireType.LengthDelimited).string(message.callId);
638
+ /* string call_type = 3; */
639
+ if (message.callType !== "")
640
+ writer.tag(3, WireType.LengthDelimited).string(message.callType);
641
+ /* google.protobuf.Timestamp start = 4; */
642
+ if (message.start)
643
+ Timestamp.internalBinaryWrite(message.start, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
644
+ /* google.protobuf.Timestamp end = 5; */
645
+ if (message.end)
646
+ Timestamp.internalBinaryWrite(message.end, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
647
+ let u = options.writeUnknownFields;
648
+ if (u !== false)
649
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
650
+ return writer;
651
+ }
652
+ }
653
+ /**
654
+ * @generated MessageType for protobuf message stream.video.coordinator.stat_v1.Session
655
+ */
656
+ export const Session = new Session$Type();