@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,291 @@
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 "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3)
4
+ // tslint:disable
5
+ //
6
+ // Protocol Buffers - Google's data interchange format
7
+ // Copyright 2008 Google Inc. All rights reserved.
8
+ // https://developers.google.com/protocol-buffers/
9
+ //
10
+ // Redistribution and use in source and binary forms, with or without
11
+ // modification, are permitted provided that the following conditions are
12
+ // met:
13
+ //
14
+ // * Redistributions of source code must retain the above copyright
15
+ // notice, this list of conditions and the following disclaimer.
16
+ // * Redistributions in binary form must reproduce the above
17
+ // copyright notice, this list of conditions and the following disclaimer
18
+ // in the documentation and/or other materials provided with the
19
+ // distribution.
20
+ // * Neither the name of Google Inc. nor the names of its
21
+ // contributors may be used to endorse or promote products derived from
22
+ // this software without specific prior written permission.
23
+ //
24
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ //
36
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
37
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
38
+ import { WireType } from "@protobuf-ts/runtime";
39
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
40
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
41
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
42
+ import type { PartialMessage } from "@protobuf-ts/runtime";
43
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
44
+ import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
45
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
46
+ import type { JsonValue } from "@protobuf-ts/runtime";
47
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
48
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
49
+ import { PbLong } from "@protobuf-ts/runtime";
50
+ import { MessageType } from "@protobuf-ts/runtime";
51
+ /**
52
+ * A Timestamp represents a point in time independent of any time zone or local
53
+ * calendar, encoded as a count of seconds and fractions of seconds at
54
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
55
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
56
+ * Gregorian calendar backwards to year one.
57
+ *
58
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
59
+ * second table is needed for interpretation, using a [24-hour linear
60
+ * smear](https://developers.google.com/time/smear).
61
+ *
62
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
63
+ * restricting to that range, we ensure that we can convert to and from [RFC
64
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
65
+ *
66
+ * # Examples
67
+ *
68
+ * Example 1: Compute Timestamp from POSIX `time()`.
69
+ *
70
+ * Timestamp timestamp;
71
+ * timestamp.set_seconds(time(NULL));
72
+ * timestamp.set_nanos(0);
73
+ *
74
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
75
+ *
76
+ * struct timeval tv;
77
+ * gettimeofday(&tv, NULL);
78
+ *
79
+ * Timestamp timestamp;
80
+ * timestamp.set_seconds(tv.tv_sec);
81
+ * timestamp.set_nanos(tv.tv_usec * 1000);
82
+ *
83
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
84
+ *
85
+ * FILETIME ft;
86
+ * GetSystemTimeAsFileTime(&ft);
87
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
88
+ *
89
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
90
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
91
+ * Timestamp timestamp;
92
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
93
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
94
+ *
95
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
96
+ *
97
+ * long millis = System.currentTimeMillis();
98
+ *
99
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
100
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
101
+ *
102
+ *
103
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
104
+ *
105
+ * Instant now = Instant.now();
106
+ *
107
+ * Timestamp timestamp =
108
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
109
+ * .setNanos(now.getNano()).build();
110
+ *
111
+ *
112
+ * Example 6: Compute Timestamp from current time in Python.
113
+ *
114
+ * timestamp = Timestamp()
115
+ * timestamp.GetCurrentTime()
116
+ *
117
+ * # JSON Mapping
118
+ *
119
+ * In JSON format, the Timestamp type is encoded as a string in the
120
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
121
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
122
+ * where {year} is always expressed using four digits while {month}, {day},
123
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
124
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
125
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
126
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
127
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
128
+ * able to accept both UTC and other timezones (as indicated by an offset).
129
+ *
130
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
131
+ * 01:30 UTC on January 15, 2017.
132
+ *
133
+ * In JavaScript, one can convert a Date object to this format using the
134
+ * standard
135
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
136
+ * method. In Python, a standard `datetime.datetime` object can be converted
137
+ * to this format using
138
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
139
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
140
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
141
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
142
+ * ) to obtain a formatter capable of generating timestamps in this format.
143
+ *
144
+ *
145
+ *
146
+ * @generated from protobuf message google.protobuf.Timestamp
147
+ */
148
+ export interface Timestamp {
149
+ /**
150
+ * Represents seconds of UTC time since Unix epoch
151
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
152
+ * 9999-12-31T23:59:59Z inclusive.
153
+ *
154
+ * @generated from protobuf field: int64 seconds = 1;
155
+ */
156
+ seconds: string;
157
+ /**
158
+ * Non-negative fractions of a second at nanosecond resolution. Negative
159
+ * second values with fractions must still have non-negative nanos values
160
+ * that count forward in time. Must be from 0 to 999,999,999
161
+ * inclusive.
162
+ *
163
+ * @generated from protobuf field: int32 nanos = 2;
164
+ */
165
+ nanos: number;
166
+ }
167
+ // @generated message type with reflection information, may provide speed optimized methods
168
+ class Timestamp$Type extends MessageType<Timestamp> {
169
+ constructor() {
170
+ super("google.protobuf.Timestamp", [
171
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
172
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
173
+ ]);
174
+ }
175
+ /**
176
+ * Creates a new `Timestamp` for the current time.
177
+ */
178
+ now(): Timestamp {
179
+ const msg = this.create();
180
+ const ms = Date.now();
181
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toString();
182
+ msg.nanos = (ms % 1000) * 1000000;
183
+ return msg;
184
+ }
185
+ /**
186
+ * Converts a `Timestamp` to a JavaScript Date.
187
+ */
188
+ toDate(message: Timestamp): Date {
189
+ return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
190
+ }
191
+ /**
192
+ * Converts a JavaScript Date to a `Timestamp`.
193
+ */
194
+ fromDate(date: Date): Timestamp {
195
+ const msg = this.create();
196
+ const ms = date.getTime();
197
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toString();
198
+ msg.nanos = (ms % 1000) * 1000000;
199
+ return msg;
200
+ }
201
+ /**
202
+ * In JSON format, the `Timestamp` type is encoded as a string
203
+ * in the RFC 3339 format.
204
+ */
205
+ internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
206
+ let ms = PbLong.from(message.seconds).toNumber() * 1000;
207
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
208
+ throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
209
+ if (message.nanos < 0)
210
+ throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
211
+ let z = "Z";
212
+ if (message.nanos > 0) {
213
+ let nanosStr = (message.nanos + 1000000000).toString().substring(1);
214
+ if (nanosStr.substring(3) === "000000")
215
+ z = "." + nanosStr.substring(0, 3) + "Z";
216
+ else if (nanosStr.substring(6) === "000")
217
+ z = "." + nanosStr.substring(0, 6) + "Z";
218
+ else
219
+ z = "." + nanosStr + "Z";
220
+ }
221
+ return new Date(ms).toISOString().replace(".000Z", z);
222
+ }
223
+ /**
224
+ * In JSON format, the `Timestamp` type is encoded as a string
225
+ * in the RFC 3339 format.
226
+ */
227
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {
228
+ if (typeof json !== "string")
229
+ throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
230
+ let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
231
+ if (!matches)
232
+ throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
233
+ let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
234
+ if (Number.isNaN(ms))
235
+ throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
236
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
237
+ throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
238
+ if (!target)
239
+ target = this.create();
240
+ target.seconds = PbLong.from(ms / 1000).toString();
241
+ target.nanos = 0;
242
+ if (matches[7])
243
+ target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
244
+ return target;
245
+ }
246
+ create(value?: PartialMessage<Timestamp>): Timestamp {
247
+ const message = { seconds: "0", nanos: 0 };
248
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
249
+ if (value !== undefined)
250
+ reflectionMergePartial<Timestamp>(this, message, value);
251
+ return message;
252
+ }
253
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp {
254
+ let message = target ?? this.create(), end = reader.pos + length;
255
+ while (reader.pos < end) {
256
+ let [fieldNo, wireType] = reader.tag();
257
+ switch (fieldNo) {
258
+ case /* int64 seconds */ 1:
259
+ message.seconds = reader.int64().toString();
260
+ break;
261
+ case /* int32 nanos */ 2:
262
+ message.nanos = reader.int32();
263
+ break;
264
+ default:
265
+ let u = options.readUnknownField;
266
+ if (u === "throw")
267
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
268
+ let d = reader.skip(wireType);
269
+ if (u !== false)
270
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
271
+ }
272
+ }
273
+ return message;
274
+ }
275
+ internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
276
+ /* int64 seconds = 1; */
277
+ if (message.seconds !== "0")
278
+ writer.tag(1, WireType.Varint).int64(message.seconds);
279
+ /* int32 nanos = 2; */
280
+ if (message.nanos !== 0)
281
+ writer.tag(2, WireType.Varint).int32(message.nanos);
282
+ let u = options.writeUnknownFields;
283
+ if (u !== false)
284
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
285
+ return writer;
286
+ }
287
+ }
288
+ /**
289
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
290
+ */
291
+ export const Timestamp = new Timestamp$Type();
@@ -0,0 +1,154 @@
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/broadcast_v1/broadcast.proto" (package "stream.video.coordinator.broadcast_v1", syntax proto3)
4
+ // tslint:disable
5
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
6
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
7
+ import { WireType } from "@protobuf-ts/runtime";
8
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
9
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
10
+ import { UnknownFieldHandler } 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
+ /**
16
+ * @generated from protobuf message stream.video.coordinator.broadcast_v1.RTMPOptions
17
+ */
18
+ export interface RTMPOptions {
19
+ /**
20
+ * @generated from protobuf field: repeated string urls = 1;
21
+ */
22
+ urls: string[];
23
+ }
24
+ /**
25
+ * @generated from protobuf message stream.video.coordinator.broadcast_v1.Broadcast
26
+ */
27
+ export interface Broadcast {
28
+ /**
29
+ * @generated from protobuf field: stream.video.coordinator.broadcast_v1.RTMPOptions rtmp = 1;
30
+ */
31
+ rtmp?: RTMPOptions;
32
+ /**
33
+ * @generated from protobuf field: string hls_url = 2;
34
+ */
35
+ hlsUrl: string;
36
+ }
37
+ /**
38
+ * @generated from protobuf enum stream.video.coordinator.broadcast_v1.Codec
39
+ */
40
+ export enum Codec {
41
+ /**
42
+ * @generated from protobuf enum value: CODEC_H264_UNSPECIFIED = 0;
43
+ */
44
+ H264_UNSPECIFIED = 0,
45
+ /**
46
+ * @generated from protobuf enum value: CODEC_VP8 = 1;
47
+ */
48
+ VP8 = 1,
49
+ /**
50
+ * @generated from protobuf enum value: CODEC_VP9 = 2;
51
+ */
52
+ VP9 = 2
53
+ }
54
+ // @generated message type with reflection information, may provide speed optimized methods
55
+ class RTMPOptions$Type extends MessageType<RTMPOptions> {
56
+ constructor() {
57
+ super("stream.video.coordinator.broadcast_v1.RTMPOptions", [
58
+ { no: 1, name: "urls", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
59
+ ]);
60
+ }
61
+ create(value?: PartialMessage<RTMPOptions>): RTMPOptions {
62
+ const message = { urls: [] };
63
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
64
+ if (value !== undefined)
65
+ reflectionMergePartial<RTMPOptions>(this, message, value);
66
+ return message;
67
+ }
68
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RTMPOptions): RTMPOptions {
69
+ let message = target ?? this.create(), end = reader.pos + length;
70
+ while (reader.pos < end) {
71
+ let [fieldNo, wireType] = reader.tag();
72
+ switch (fieldNo) {
73
+ case /* repeated string urls */ 1:
74
+ message.urls.push(reader.string());
75
+ break;
76
+ default:
77
+ let u = options.readUnknownField;
78
+ if (u === "throw")
79
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
80
+ let d = reader.skip(wireType);
81
+ if (u !== false)
82
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
83
+ }
84
+ }
85
+ return message;
86
+ }
87
+ internalBinaryWrite(message: RTMPOptions, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
88
+ /* repeated string urls = 1; */
89
+ for (let i = 0; i < message.urls.length; i++)
90
+ writer.tag(1, WireType.LengthDelimited).string(message.urls[i]);
91
+ let u = options.writeUnknownFields;
92
+ if (u !== false)
93
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
94
+ return writer;
95
+ }
96
+ }
97
+ /**
98
+ * @generated MessageType for protobuf message stream.video.coordinator.broadcast_v1.RTMPOptions
99
+ */
100
+ export const RTMPOptions = new RTMPOptions$Type();
101
+ // @generated message type with reflection information, may provide speed optimized methods
102
+ class Broadcast$Type extends MessageType<Broadcast> {
103
+ constructor() {
104
+ super("stream.video.coordinator.broadcast_v1.Broadcast", [
105
+ { no: 1, name: "rtmp", kind: "message", T: () => RTMPOptions },
106
+ { no: 2, name: "hls_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
107
+ ]);
108
+ }
109
+ create(value?: PartialMessage<Broadcast>): Broadcast {
110
+ const message = { hlsUrl: "" };
111
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
112
+ if (value !== undefined)
113
+ reflectionMergePartial<Broadcast>(this, message, value);
114
+ return message;
115
+ }
116
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Broadcast): Broadcast {
117
+ let message = target ?? this.create(), end = reader.pos + length;
118
+ while (reader.pos < end) {
119
+ let [fieldNo, wireType] = reader.tag();
120
+ switch (fieldNo) {
121
+ case /* stream.video.coordinator.broadcast_v1.RTMPOptions rtmp */ 1:
122
+ message.rtmp = RTMPOptions.internalBinaryRead(reader, reader.uint32(), options, message.rtmp);
123
+ break;
124
+ case /* string hls_url */ 2:
125
+ message.hlsUrl = reader.string();
126
+ break;
127
+ default:
128
+ let u = options.readUnknownField;
129
+ if (u === "throw")
130
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
131
+ let d = reader.skip(wireType);
132
+ if (u !== false)
133
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
134
+ }
135
+ }
136
+ return message;
137
+ }
138
+ internalBinaryWrite(message: Broadcast, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
139
+ /* stream.video.coordinator.broadcast_v1.RTMPOptions rtmp = 1; */
140
+ if (message.rtmp)
141
+ RTMPOptions.internalBinaryWrite(message.rtmp, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
142
+ /* string hls_url = 2; */
143
+ if (message.hlsUrl !== "")
144
+ writer.tag(2, WireType.LengthDelimited).string(message.hlsUrl);
145
+ let u = options.writeUnknownFields;
146
+ if (u !== false)
147
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
148
+ return writer;
149
+ }
150
+ }
151
+ /**
152
+ * @generated MessageType for protobuf message stream.video.coordinator.broadcast_v1.Broadcast
153
+ */
154
+ export const Broadcast = new Broadcast$Type();