livekit-client 0.17.5 → 0.17.6-rc1

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 (153) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +26 -20
  3. package/dist/api/SignalClient.d.ts +1 -0
  4. package/dist/connect.d.ts +2 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/livekit-client.esm.js +17344 -0
  7. package/dist/livekit-client.esm.js.map +1 -0
  8. package/dist/livekit-client.umd.js +17388 -0
  9. package/dist/livekit-client.umd.js.map +1 -0
  10. package/dist/logger.d.ts +22 -11
  11. package/dist/options.d.ts +4 -2
  12. package/dist/proto/google/protobuf/timestamp.d.ts +1 -1
  13. package/dist/proto/livekit_models.d.ts +4 -1
  14. package/dist/proto/livekit_rtc.d.ts +45 -2
  15. package/dist/room/DeviceManager.d.ts +1 -1
  16. package/dist/room/RTCEngine.d.ts +1 -1
  17. package/dist/room/Room.d.ts +2 -2
  18. package/dist/room/events.d.ts +1 -1
  19. package/dist/room/participant/LocalParticipant.d.ts +9 -5
  20. package/dist/room/participant/RemoteParticipant.d.ts +9 -0
  21. package/dist/room/track/RemoteAudioTrack.d.ts +11 -0
  22. package/dist/test/mocks.d.ts +11 -0
  23. package/package.json +40 -15
  24. package/.eslintrc.js +0 -17
  25. package/.gitmodules +0 -3
  26. package/dist/api/RequestQueue.js +0 -61
  27. package/dist/api/RequestQueue.js.map +0 -1
  28. package/dist/api/SignalClient.js +0 -428
  29. package/dist/api/SignalClient.js.map +0 -1
  30. package/dist/connect.js +0 -130
  31. package/dist/connect.js.map +0 -1
  32. package/dist/index.js +0 -71
  33. package/dist/index.js.map +0 -1
  34. package/dist/logger.js +0 -24
  35. package/dist/logger.js.map +0 -1
  36. package/dist/options.js +0 -3
  37. package/dist/options.js.map +0 -1
  38. package/dist/proto/google/protobuf/timestamp.js +0 -108
  39. package/dist/proto/google/protobuf/timestamp.js.map +0 -1
  40. package/dist/proto/livekit_models.js +0 -2262
  41. package/dist/proto/livekit_models.js.map +0 -1
  42. package/dist/proto/livekit_rtc.js +0 -2544
  43. package/dist/proto/livekit_rtc.js.map +0 -1
  44. package/dist/room/DeviceManager.js +0 -62
  45. package/dist/room/DeviceManager.js.map +0 -1
  46. package/dist/room/PCTransport.js +0 -91
  47. package/dist/room/PCTransport.js.map +0 -1
  48. package/dist/room/RTCEngine.js +0 -562
  49. package/dist/room/RTCEngine.js.map +0 -1
  50. package/dist/room/Room.js +0 -767
  51. package/dist/room/Room.js.map +0 -1
  52. package/dist/room/errors.js +0 -68
  53. package/dist/room/errors.js.map +0 -1
  54. package/dist/room/events.js +0 -385
  55. package/dist/room/events.js.map +0 -1
  56. package/dist/room/participant/LocalParticipant.js +0 -647
  57. package/dist/room/participant/LocalParticipant.js.map +0 -1
  58. package/dist/room/participant/Participant.js +0 -189
  59. package/dist/room/participant/Participant.js.map +0 -1
  60. package/dist/room/participant/ParticipantTrackPermission.js +0 -16
  61. package/dist/room/participant/ParticipantTrackPermission.js.map +0 -1
  62. package/dist/room/participant/RemoteParticipant.js +0 -194
  63. package/dist/room/participant/RemoteParticipant.js.map +0 -1
  64. package/dist/room/participant/publishUtils.js +0 -189
  65. package/dist/room/participant/publishUtils.js.map +0 -1
  66. package/dist/room/participant/publishUtils.test.d.ts +0 -1
  67. package/dist/room/participant/publishUtils.test.js +0 -118
  68. package/dist/room/participant/publishUtils.test.js.map +0 -1
  69. package/dist/room/stats.js +0 -26
  70. package/dist/room/stats.js.map +0 -1
  71. package/dist/room/track/LocalAudioTrack.js +0 -153
  72. package/dist/room/track/LocalAudioTrack.js.map +0 -1
  73. package/dist/room/track/LocalTrack.js +0 -158
  74. package/dist/room/track/LocalTrack.js.map +0 -1
  75. package/dist/room/track/LocalTrackPublication.js +0 -64
  76. package/dist/room/track/LocalTrackPublication.js.map +0 -1
  77. package/dist/room/track/LocalVideoTrack.js +0 -297
  78. package/dist/room/track/LocalVideoTrack.js.map +0 -1
  79. package/dist/room/track/LocalVideoTrack.test.d.ts +0 -1
  80. package/dist/room/track/LocalVideoTrack.test.js +0 -68
  81. package/dist/room/track/LocalVideoTrack.test.js.map +0 -1
  82. package/dist/room/track/RemoteAudioTrack.js +0 -64
  83. package/dist/room/track/RemoteAudioTrack.js.map +0 -1
  84. package/dist/room/track/RemoteTrack.js +0 -49
  85. package/dist/room/track/RemoteTrack.js.map +0 -1
  86. package/dist/room/track/RemoteTrackPublication.js +0 -178
  87. package/dist/room/track/RemoteTrackPublication.js.map +0 -1
  88. package/dist/room/track/RemoteVideoTrack.js +0 -201
  89. package/dist/room/track/RemoteVideoTrack.js.map +0 -1
  90. package/dist/room/track/Track.js +0 -283
  91. package/dist/room/track/Track.js.map +0 -1
  92. package/dist/room/track/TrackPublication.js +0 -92
  93. package/dist/room/track/TrackPublication.js.map +0 -1
  94. package/dist/room/track/create.js +0 -131
  95. package/dist/room/track/create.js.map +0 -1
  96. package/dist/room/track/defaults.js +0 -21
  97. package/dist/room/track/defaults.js.map +0 -1
  98. package/dist/room/track/options.js +0 -100
  99. package/dist/room/track/options.js.map +0 -1
  100. package/dist/room/track/types.js +0 -3
  101. package/dist/room/track/types.js.map +0 -1
  102. package/dist/room/track/utils.js +0 -113
  103. package/dist/room/track/utils.js.map +0 -1
  104. package/dist/room/track/utils.test.d.ts +0 -1
  105. package/dist/room/track/utils.test.js +0 -85
  106. package/dist/room/track/utils.test.js.map +0 -1
  107. package/dist/room/utils.js +0 -79
  108. package/dist/room/utils.js.map +0 -1
  109. package/dist/version.js +0 -6
  110. package/dist/version.js.map +0 -1
  111. package/jest.config.js +0 -6
  112. package/src/api/RequestQueue.ts +0 -53
  113. package/src/api/SignalClient.ts +0 -499
  114. package/src/connect.ts +0 -100
  115. package/src/index.ts +0 -47
  116. package/src/logger.ts +0 -22
  117. package/src/options.ts +0 -149
  118. package/src/proto/google/protobuf/timestamp.ts +0 -232
  119. package/src/proto/livekit_models.ts +0 -2676
  120. package/src/proto/livekit_rtc.ts +0 -3269
  121. package/src/room/DeviceManager.ts +0 -57
  122. package/src/room/PCTransport.ts +0 -86
  123. package/src/room/RTCEngine.ts +0 -652
  124. package/src/room/Room.ts +0 -951
  125. package/src/room/errors.ts +0 -65
  126. package/src/room/events.ts +0 -424
  127. package/src/room/participant/LocalParticipant.ts +0 -734
  128. package/src/room/participant/Participant.ts +0 -269
  129. package/src/room/participant/ParticipantTrackPermission.ts +0 -32
  130. package/src/room/participant/RemoteParticipant.ts +0 -243
  131. package/src/room/participant/publishUtils.test.ts +0 -145
  132. package/src/room/participant/publishUtils.ts +0 -225
  133. package/src/room/stats.ts +0 -130
  134. package/src/room/track/LocalAudioTrack.ts +0 -137
  135. package/src/room/track/LocalTrack.ts +0 -161
  136. package/src/room/track/LocalTrackPublication.ts +0 -66
  137. package/src/room/track/LocalVideoTrack.test.ts +0 -70
  138. package/src/room/track/LocalVideoTrack.ts +0 -293
  139. package/src/room/track/RemoteAudioTrack.ts +0 -58
  140. package/src/room/track/RemoteTrack.ts +0 -62
  141. package/src/room/track/RemoteTrackPublication.ts +0 -198
  142. package/src/room/track/RemoteVideoTrack.ts +0 -235
  143. package/src/room/track/Track.ts +0 -343
  144. package/src/room/track/TrackPublication.ts +0 -120
  145. package/src/room/track/create.ts +0 -121
  146. package/src/room/track/defaults.ts +0 -23
  147. package/src/room/track/options.ts +0 -281
  148. package/src/room/track/types.ts +0 -20
  149. package/src/room/track/utils.test.ts +0 -93
  150. package/src/room/track/utils.ts +0 -115
  151. package/src/room/utils.ts +0 -70
  152. package/src/version.ts +0 -2
  153. package/tsconfig.eslint.json +0 -11
@@ -1,3269 +0,0 @@
1
- /* eslint-disable */
2
- import Long from "long";
3
- import * as _m0 from "protobufjs/minimal";
4
- import {
5
- TrackType,
6
- TrackSource,
7
- Room,
8
- ParticipantInfo,
9
- ClientConfiguration,
10
- TrackInfo,
11
- VideoQuality,
12
- ConnectionQuality,
13
- VideoLayer,
14
- ParticipantTracks,
15
- SpeakerInfo,
16
- trackTypeFromJSON,
17
- trackSourceFromJSON,
18
- trackTypeToJSON,
19
- trackSourceToJSON,
20
- videoQualityFromJSON,
21
- videoQualityToJSON,
22
- connectionQualityFromJSON,
23
- connectionQualityToJSON,
24
- } from "./livekit_models";
25
-
26
- export const protobufPackage = "livekit";
27
-
28
- export enum SignalTarget {
29
- PUBLISHER = 0,
30
- SUBSCRIBER = 1,
31
- UNRECOGNIZED = -1,
32
- }
33
-
34
- export function signalTargetFromJSON(object: any): SignalTarget {
35
- switch (object) {
36
- case 0:
37
- case "PUBLISHER":
38
- return SignalTarget.PUBLISHER;
39
- case 1:
40
- case "SUBSCRIBER":
41
- return SignalTarget.SUBSCRIBER;
42
- case -1:
43
- case "UNRECOGNIZED":
44
- default:
45
- return SignalTarget.UNRECOGNIZED;
46
- }
47
- }
48
-
49
- export function signalTargetToJSON(object: SignalTarget): string {
50
- switch (object) {
51
- case SignalTarget.PUBLISHER:
52
- return "PUBLISHER";
53
- case SignalTarget.SUBSCRIBER:
54
- return "SUBSCRIBER";
55
- default:
56
- return "UNKNOWN";
57
- }
58
- }
59
-
60
- export enum StreamState {
61
- ACTIVE = 0,
62
- PAUSED = 1,
63
- UNRECOGNIZED = -1,
64
- }
65
-
66
- export function streamStateFromJSON(object: any): StreamState {
67
- switch (object) {
68
- case 0:
69
- case "ACTIVE":
70
- return StreamState.ACTIVE;
71
- case 1:
72
- case "PAUSED":
73
- return StreamState.PAUSED;
74
- case -1:
75
- case "UNRECOGNIZED":
76
- default:
77
- return StreamState.UNRECOGNIZED;
78
- }
79
- }
80
-
81
- export function streamStateToJSON(object: StreamState): string {
82
- switch (object) {
83
- case StreamState.ACTIVE:
84
- return "ACTIVE";
85
- case StreamState.PAUSED:
86
- return "PAUSED";
87
- default:
88
- return "UNKNOWN";
89
- }
90
- }
91
-
92
- export interface SignalRequest {
93
- /** initial join exchange, for publisher */
94
- offer?: SessionDescription | undefined;
95
- /** participant answering publisher offer */
96
- answer?: SessionDescription | undefined;
97
- trickle?: TrickleRequest | undefined;
98
- addTrack?: AddTrackRequest | undefined;
99
- /** mute the participant's published tracks */
100
- mute?: MuteTrackRequest | undefined;
101
- /** Subscribe or unsubscribe from tracks */
102
- subscription?: UpdateSubscription | undefined;
103
- /** Update settings of subscribed tracks */
104
- trackSetting?: UpdateTrackSettings | undefined;
105
- /** Immediately terminate session */
106
- leave?: LeaveRequest | undefined;
107
- /**
108
- * Set active published layers, deprecated in favor of automatic tracking
109
- * SetSimulcastLayers simulcast = 9;
110
- * Update published video layers
111
- */
112
- updateLayers?: UpdateVideoLayers | undefined;
113
- /** Update subscriber permissions */
114
- subscriptionPermission?: SubscriptionPermission | undefined;
115
- /** sync client's subscribe state to server during reconnect */
116
- syncState?: SyncState | undefined;
117
- /** Simulate conditions, for client validations */
118
- simulate?: SimulateScenario | undefined;
119
- }
120
-
121
- export interface SignalResponse {
122
- /** sent when join is accepted */
123
- join?: JoinResponse | undefined;
124
- /** sent when server answers publisher */
125
- answer?: SessionDescription | undefined;
126
- /** sent when server is sending subscriber an offer */
127
- offer?: SessionDescription | undefined;
128
- /** sent when an ICE candidate is available */
129
- trickle?: TrickleRequest | undefined;
130
- /** sent when participants in the room has changed */
131
- update?: ParticipantUpdate | undefined;
132
- /** sent to the participant when their track has been published */
133
- trackPublished?: TrackPublishedResponse | undefined;
134
- /** Immediately terminate session */
135
- leave?: LeaveRequest | undefined;
136
- /** server initiated mute */
137
- mute?: MuteTrackRequest | undefined;
138
- /** indicates changes to speaker status, including when they've gone to not speaking */
139
- speakersChanged?: SpeakersChanged | undefined;
140
- /** sent when metadata of the room has changed */
141
- roomUpdate?: RoomUpdate | undefined;
142
- /** when connection quality changed */
143
- connectionQuality?: ConnectionQualityUpdate | undefined;
144
- /**
145
- * when streamed tracks state changed, used to notify when any of the streams were paused due to
146
- * congestion
147
- */
148
- streamStateUpdate?: StreamStateUpdate | undefined;
149
- /** when max subscribe quality changed, used by dynamic broadcasting to disable unused layers */
150
- subscribedQualityUpdate?: SubscribedQualityUpdate | undefined;
151
- /** when subscription permission changed */
152
- subscriptionPermissionUpdate?: SubscriptionPermissionUpdate | undefined;
153
- /** update the token the client was using, to prevent an active client from using an expired token */
154
- refreshToken: string | undefined;
155
- /** server initiated track unpublish */
156
- trackUnpublished?: TrackUnpublishedResponse | undefined;
157
- }
158
-
159
- export interface AddTrackRequest {
160
- /** client ID of track, to match it when RTC track is received */
161
- cid: string;
162
- name: string;
163
- type: TrackType;
164
- /** to be deprecated in favor of layers */
165
- width: number;
166
- height: number;
167
- /** true to add track and initialize to muted */
168
- muted: boolean;
169
- /** true if DTX (Discontinuous Transmission) is disabled for audio */
170
- disableDtx: boolean;
171
- source: TrackSource;
172
- layers: VideoLayer[];
173
- }
174
-
175
- export interface TrickleRequest {
176
- candidateInit: string;
177
- target: SignalTarget;
178
- }
179
-
180
- export interface MuteTrackRequest {
181
- sid: string;
182
- muted: boolean;
183
- }
184
-
185
- export interface JoinResponse {
186
- room?: Room;
187
- participant?: ParticipantInfo;
188
- otherParticipants: ParticipantInfo[];
189
- serverVersion: string;
190
- iceServers: ICEServer[];
191
- /** use subscriber as the primary PeerConnection */
192
- subscriberPrimary: boolean;
193
- /**
194
- * when the current server isn't available, return alternate url to retry connection
195
- * when this is set, the other fields will be largely empty
196
- */
197
- alternativeUrl: string;
198
- clientConfiguration?: ClientConfiguration;
199
- serverRegion: string;
200
- }
201
-
202
- export interface TrackPublishedResponse {
203
- cid: string;
204
- track?: TrackInfo;
205
- }
206
-
207
- export interface TrackUnpublishedResponse {
208
- trackSid: string;
209
- }
210
-
211
- export interface SessionDescription {
212
- /** "answer" | "offer" | "pranswer" | "rollback" */
213
- type: string;
214
- sdp: string;
215
- }
216
-
217
- export interface ParticipantUpdate {
218
- participants: ParticipantInfo[];
219
- }
220
-
221
- export interface UpdateSubscription {
222
- trackSids: string[];
223
- subscribe: boolean;
224
- participantTracks: ParticipantTracks[];
225
- }
226
-
227
- export interface UpdateTrackSettings {
228
- trackSids: string[];
229
- /** when true, the track is placed in a paused state, with no new data returned */
230
- disabled: boolean;
231
- /** deprecated in favor of width & height */
232
- quality: VideoQuality;
233
- /** for video, width to receive */
234
- width: number;
235
- /** for video, height to receive */
236
- height: number;
237
- }
238
-
239
- export interface LeaveRequest {
240
- /**
241
- * sent when server initiates the disconnect due to server-restart
242
- * indicates clients should attempt full-reconnect sequence
243
- */
244
- canReconnect: boolean;
245
- }
246
-
247
- /** message to indicate published video track dimensions are changing */
248
- export interface UpdateVideoLayers {
249
- trackSid: string;
250
- layers: VideoLayer[];
251
- }
252
-
253
- export interface ICEServer {
254
- urls: string[];
255
- username: string;
256
- credential: string;
257
- }
258
-
259
- export interface SpeakersChanged {
260
- speakers: SpeakerInfo[];
261
- }
262
-
263
- export interface RoomUpdate {
264
- room?: Room;
265
- }
266
-
267
- export interface ConnectionQualityInfo {
268
- participantSid: string;
269
- quality: ConnectionQuality;
270
- score: number;
271
- }
272
-
273
- export interface ConnectionQualityUpdate {
274
- updates: ConnectionQualityInfo[];
275
- }
276
-
277
- export interface StreamStateInfo {
278
- participantSid: string;
279
- trackSid: string;
280
- state: StreamState;
281
- }
282
-
283
- export interface StreamStateUpdate {
284
- streamStates: StreamStateInfo[];
285
- }
286
-
287
- export interface SubscribedQuality {
288
- quality: VideoQuality;
289
- enabled: boolean;
290
- }
291
-
292
- export interface SubscribedQualityUpdate {
293
- trackSid: string;
294
- subscribedQualities: SubscribedQuality[];
295
- }
296
-
297
- export interface TrackPermission {
298
- participantSid: string;
299
- allTracks: boolean;
300
- trackSids: string[];
301
- }
302
-
303
- export interface SubscriptionPermission {
304
- allParticipants: boolean;
305
- trackPermissions: TrackPermission[];
306
- }
307
-
308
- export interface SubscriptionPermissionUpdate {
309
- participantSid: string;
310
- trackSid: string;
311
- allowed: boolean;
312
- }
313
-
314
- export interface SyncState {
315
- answer?: SessionDescription;
316
- subscription?: UpdateSubscription;
317
- publishTracks: TrackPublishedResponse[];
318
- dataChannels: DataChannelInfo[];
319
- }
320
-
321
- export interface DataChannelInfo {
322
- label: string;
323
- id: number;
324
- }
325
-
326
- export interface SimulateScenario {
327
- /** simulate N seconds of speaker activity */
328
- speakerUpdate: number | undefined;
329
- /** simulate local node failure */
330
- nodeFailure: boolean | undefined;
331
- /** simulate migration */
332
- migration: boolean | undefined;
333
- /** server to send leave */
334
- serverLeave: boolean | undefined;
335
- }
336
-
337
- function createBaseSignalRequest(): SignalRequest {
338
- return {
339
- offer: undefined,
340
- answer: undefined,
341
- trickle: undefined,
342
- addTrack: undefined,
343
- mute: undefined,
344
- subscription: undefined,
345
- trackSetting: undefined,
346
- leave: undefined,
347
- updateLayers: undefined,
348
- subscriptionPermission: undefined,
349
- syncState: undefined,
350
- simulate: undefined,
351
- };
352
- }
353
-
354
- export const SignalRequest = {
355
- encode(
356
- message: SignalRequest,
357
- writer: _m0.Writer = _m0.Writer.create()
358
- ): _m0.Writer {
359
- if (message.offer !== undefined) {
360
- SessionDescription.encode(
361
- message.offer,
362
- writer.uint32(10).fork()
363
- ).ldelim();
364
- }
365
- if (message.answer !== undefined) {
366
- SessionDescription.encode(
367
- message.answer,
368
- writer.uint32(18).fork()
369
- ).ldelim();
370
- }
371
- if (message.trickle !== undefined) {
372
- TrickleRequest.encode(message.trickle, writer.uint32(26).fork()).ldelim();
373
- }
374
- if (message.addTrack !== undefined) {
375
- AddTrackRequest.encode(
376
- message.addTrack,
377
- writer.uint32(34).fork()
378
- ).ldelim();
379
- }
380
- if (message.mute !== undefined) {
381
- MuteTrackRequest.encode(message.mute, writer.uint32(42).fork()).ldelim();
382
- }
383
- if (message.subscription !== undefined) {
384
- UpdateSubscription.encode(
385
- message.subscription,
386
- writer.uint32(50).fork()
387
- ).ldelim();
388
- }
389
- if (message.trackSetting !== undefined) {
390
- UpdateTrackSettings.encode(
391
- message.trackSetting,
392
- writer.uint32(58).fork()
393
- ).ldelim();
394
- }
395
- if (message.leave !== undefined) {
396
- LeaveRequest.encode(message.leave, writer.uint32(66).fork()).ldelim();
397
- }
398
- if (message.updateLayers !== undefined) {
399
- UpdateVideoLayers.encode(
400
- message.updateLayers,
401
- writer.uint32(82).fork()
402
- ).ldelim();
403
- }
404
- if (message.subscriptionPermission !== undefined) {
405
- SubscriptionPermission.encode(
406
- message.subscriptionPermission,
407
- writer.uint32(90).fork()
408
- ).ldelim();
409
- }
410
- if (message.syncState !== undefined) {
411
- SyncState.encode(message.syncState, writer.uint32(98).fork()).ldelim();
412
- }
413
- if (message.simulate !== undefined) {
414
- SimulateScenario.encode(
415
- message.simulate,
416
- writer.uint32(106).fork()
417
- ).ldelim();
418
- }
419
- return writer;
420
- },
421
-
422
- decode(input: _m0.Reader | Uint8Array, length?: number): SignalRequest {
423
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
424
- let end = length === undefined ? reader.len : reader.pos + length;
425
- const message = createBaseSignalRequest();
426
- while (reader.pos < end) {
427
- const tag = reader.uint32();
428
- switch (tag >>> 3) {
429
- case 1:
430
- message.offer = SessionDescription.decode(reader, reader.uint32());
431
- break;
432
- case 2:
433
- message.answer = SessionDescription.decode(reader, reader.uint32());
434
- break;
435
- case 3:
436
- message.trickle = TrickleRequest.decode(reader, reader.uint32());
437
- break;
438
- case 4:
439
- message.addTrack = AddTrackRequest.decode(reader, reader.uint32());
440
- break;
441
- case 5:
442
- message.mute = MuteTrackRequest.decode(reader, reader.uint32());
443
- break;
444
- case 6:
445
- message.subscription = UpdateSubscription.decode(
446
- reader,
447
- reader.uint32()
448
- );
449
- break;
450
- case 7:
451
- message.trackSetting = UpdateTrackSettings.decode(
452
- reader,
453
- reader.uint32()
454
- );
455
- break;
456
- case 8:
457
- message.leave = LeaveRequest.decode(reader, reader.uint32());
458
- break;
459
- case 10:
460
- message.updateLayers = UpdateVideoLayers.decode(
461
- reader,
462
- reader.uint32()
463
- );
464
- break;
465
- case 11:
466
- message.subscriptionPermission = SubscriptionPermission.decode(
467
- reader,
468
- reader.uint32()
469
- );
470
- break;
471
- case 12:
472
- message.syncState = SyncState.decode(reader, reader.uint32());
473
- break;
474
- case 13:
475
- message.simulate = SimulateScenario.decode(reader, reader.uint32());
476
- break;
477
- default:
478
- reader.skipType(tag & 7);
479
- break;
480
- }
481
- }
482
- return message;
483
- },
484
-
485
- fromJSON(object: any): SignalRequest {
486
- return {
487
- offer: isSet(object.offer)
488
- ? SessionDescription.fromJSON(object.offer)
489
- : undefined,
490
- answer: isSet(object.answer)
491
- ? SessionDescription.fromJSON(object.answer)
492
- : undefined,
493
- trickle: isSet(object.trickle)
494
- ? TrickleRequest.fromJSON(object.trickle)
495
- : undefined,
496
- addTrack: isSet(object.addTrack)
497
- ? AddTrackRequest.fromJSON(object.addTrack)
498
- : undefined,
499
- mute: isSet(object.mute)
500
- ? MuteTrackRequest.fromJSON(object.mute)
501
- : undefined,
502
- subscription: isSet(object.subscription)
503
- ? UpdateSubscription.fromJSON(object.subscription)
504
- : undefined,
505
- trackSetting: isSet(object.trackSetting)
506
- ? UpdateTrackSettings.fromJSON(object.trackSetting)
507
- : undefined,
508
- leave: isSet(object.leave)
509
- ? LeaveRequest.fromJSON(object.leave)
510
- : undefined,
511
- updateLayers: isSet(object.updateLayers)
512
- ? UpdateVideoLayers.fromJSON(object.updateLayers)
513
- : undefined,
514
- subscriptionPermission: isSet(object.subscriptionPermission)
515
- ? SubscriptionPermission.fromJSON(object.subscriptionPermission)
516
- : undefined,
517
- syncState: isSet(object.syncState)
518
- ? SyncState.fromJSON(object.syncState)
519
- : undefined,
520
- simulate: isSet(object.simulate)
521
- ? SimulateScenario.fromJSON(object.simulate)
522
- : undefined,
523
- };
524
- },
525
-
526
- toJSON(message: SignalRequest): unknown {
527
- const obj: any = {};
528
- message.offer !== undefined &&
529
- (obj.offer = message.offer
530
- ? SessionDescription.toJSON(message.offer)
531
- : undefined);
532
- message.answer !== undefined &&
533
- (obj.answer = message.answer
534
- ? SessionDescription.toJSON(message.answer)
535
- : undefined);
536
- message.trickle !== undefined &&
537
- (obj.trickle = message.trickle
538
- ? TrickleRequest.toJSON(message.trickle)
539
- : undefined);
540
- message.addTrack !== undefined &&
541
- (obj.addTrack = message.addTrack
542
- ? AddTrackRequest.toJSON(message.addTrack)
543
- : undefined);
544
- message.mute !== undefined &&
545
- (obj.mute = message.mute
546
- ? MuteTrackRequest.toJSON(message.mute)
547
- : undefined);
548
- message.subscription !== undefined &&
549
- (obj.subscription = message.subscription
550
- ? UpdateSubscription.toJSON(message.subscription)
551
- : undefined);
552
- message.trackSetting !== undefined &&
553
- (obj.trackSetting = message.trackSetting
554
- ? UpdateTrackSettings.toJSON(message.trackSetting)
555
- : undefined);
556
- message.leave !== undefined &&
557
- (obj.leave = message.leave
558
- ? LeaveRequest.toJSON(message.leave)
559
- : undefined);
560
- message.updateLayers !== undefined &&
561
- (obj.updateLayers = message.updateLayers
562
- ? UpdateVideoLayers.toJSON(message.updateLayers)
563
- : undefined);
564
- message.subscriptionPermission !== undefined &&
565
- (obj.subscriptionPermission = message.subscriptionPermission
566
- ? SubscriptionPermission.toJSON(message.subscriptionPermission)
567
- : undefined);
568
- message.syncState !== undefined &&
569
- (obj.syncState = message.syncState
570
- ? SyncState.toJSON(message.syncState)
571
- : undefined);
572
- message.simulate !== undefined &&
573
- (obj.simulate = message.simulate
574
- ? SimulateScenario.toJSON(message.simulate)
575
- : undefined);
576
- return obj;
577
- },
578
-
579
- fromPartial<I extends Exact<DeepPartial<SignalRequest>, I>>(
580
- object: I
581
- ): SignalRequest {
582
- const message = createBaseSignalRequest();
583
- message.offer =
584
- object.offer !== undefined && object.offer !== null
585
- ? SessionDescription.fromPartial(object.offer)
586
- : undefined;
587
- message.answer =
588
- object.answer !== undefined && object.answer !== null
589
- ? SessionDescription.fromPartial(object.answer)
590
- : undefined;
591
- message.trickle =
592
- object.trickle !== undefined && object.trickle !== null
593
- ? TrickleRequest.fromPartial(object.trickle)
594
- : undefined;
595
- message.addTrack =
596
- object.addTrack !== undefined && object.addTrack !== null
597
- ? AddTrackRequest.fromPartial(object.addTrack)
598
- : undefined;
599
- message.mute =
600
- object.mute !== undefined && object.mute !== null
601
- ? MuteTrackRequest.fromPartial(object.mute)
602
- : undefined;
603
- message.subscription =
604
- object.subscription !== undefined && object.subscription !== null
605
- ? UpdateSubscription.fromPartial(object.subscription)
606
- : undefined;
607
- message.trackSetting =
608
- object.trackSetting !== undefined && object.trackSetting !== null
609
- ? UpdateTrackSettings.fromPartial(object.trackSetting)
610
- : undefined;
611
- message.leave =
612
- object.leave !== undefined && object.leave !== null
613
- ? LeaveRequest.fromPartial(object.leave)
614
- : undefined;
615
- message.updateLayers =
616
- object.updateLayers !== undefined && object.updateLayers !== null
617
- ? UpdateVideoLayers.fromPartial(object.updateLayers)
618
- : undefined;
619
- message.subscriptionPermission =
620
- object.subscriptionPermission !== undefined &&
621
- object.subscriptionPermission !== null
622
- ? SubscriptionPermission.fromPartial(object.subscriptionPermission)
623
- : undefined;
624
- message.syncState =
625
- object.syncState !== undefined && object.syncState !== null
626
- ? SyncState.fromPartial(object.syncState)
627
- : undefined;
628
- message.simulate =
629
- object.simulate !== undefined && object.simulate !== null
630
- ? SimulateScenario.fromPartial(object.simulate)
631
- : undefined;
632
- return message;
633
- },
634
- };
635
-
636
- function createBaseSignalResponse(): SignalResponse {
637
- return {
638
- join: undefined,
639
- answer: undefined,
640
- offer: undefined,
641
- trickle: undefined,
642
- update: undefined,
643
- trackPublished: undefined,
644
- leave: undefined,
645
- mute: undefined,
646
- speakersChanged: undefined,
647
- roomUpdate: undefined,
648
- connectionQuality: undefined,
649
- streamStateUpdate: undefined,
650
- subscribedQualityUpdate: undefined,
651
- subscriptionPermissionUpdate: undefined,
652
- refreshToken: undefined,
653
- trackUnpublished: undefined,
654
- };
655
- }
656
-
657
- export const SignalResponse = {
658
- encode(
659
- message: SignalResponse,
660
- writer: _m0.Writer = _m0.Writer.create()
661
- ): _m0.Writer {
662
- if (message.join !== undefined) {
663
- JoinResponse.encode(message.join, writer.uint32(10).fork()).ldelim();
664
- }
665
- if (message.answer !== undefined) {
666
- SessionDescription.encode(
667
- message.answer,
668
- writer.uint32(18).fork()
669
- ).ldelim();
670
- }
671
- if (message.offer !== undefined) {
672
- SessionDescription.encode(
673
- message.offer,
674
- writer.uint32(26).fork()
675
- ).ldelim();
676
- }
677
- if (message.trickle !== undefined) {
678
- TrickleRequest.encode(message.trickle, writer.uint32(34).fork()).ldelim();
679
- }
680
- if (message.update !== undefined) {
681
- ParticipantUpdate.encode(
682
- message.update,
683
- writer.uint32(42).fork()
684
- ).ldelim();
685
- }
686
- if (message.trackPublished !== undefined) {
687
- TrackPublishedResponse.encode(
688
- message.trackPublished,
689
- writer.uint32(50).fork()
690
- ).ldelim();
691
- }
692
- if (message.leave !== undefined) {
693
- LeaveRequest.encode(message.leave, writer.uint32(66).fork()).ldelim();
694
- }
695
- if (message.mute !== undefined) {
696
- MuteTrackRequest.encode(message.mute, writer.uint32(74).fork()).ldelim();
697
- }
698
- if (message.speakersChanged !== undefined) {
699
- SpeakersChanged.encode(
700
- message.speakersChanged,
701
- writer.uint32(82).fork()
702
- ).ldelim();
703
- }
704
- if (message.roomUpdate !== undefined) {
705
- RoomUpdate.encode(message.roomUpdate, writer.uint32(90).fork()).ldelim();
706
- }
707
- if (message.connectionQuality !== undefined) {
708
- ConnectionQualityUpdate.encode(
709
- message.connectionQuality,
710
- writer.uint32(98).fork()
711
- ).ldelim();
712
- }
713
- if (message.streamStateUpdate !== undefined) {
714
- StreamStateUpdate.encode(
715
- message.streamStateUpdate,
716
- writer.uint32(106).fork()
717
- ).ldelim();
718
- }
719
- if (message.subscribedQualityUpdate !== undefined) {
720
- SubscribedQualityUpdate.encode(
721
- message.subscribedQualityUpdate,
722
- writer.uint32(114).fork()
723
- ).ldelim();
724
- }
725
- if (message.subscriptionPermissionUpdate !== undefined) {
726
- SubscriptionPermissionUpdate.encode(
727
- message.subscriptionPermissionUpdate,
728
- writer.uint32(122).fork()
729
- ).ldelim();
730
- }
731
- if (message.refreshToken !== undefined) {
732
- writer.uint32(130).string(message.refreshToken);
733
- }
734
- if (message.trackUnpublished !== undefined) {
735
- TrackUnpublishedResponse.encode(
736
- message.trackUnpublished,
737
- writer.uint32(138).fork()
738
- ).ldelim();
739
- }
740
- return writer;
741
- },
742
-
743
- decode(input: _m0.Reader | Uint8Array, length?: number): SignalResponse {
744
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
745
- let end = length === undefined ? reader.len : reader.pos + length;
746
- const message = createBaseSignalResponse();
747
- while (reader.pos < end) {
748
- const tag = reader.uint32();
749
- switch (tag >>> 3) {
750
- case 1:
751
- message.join = JoinResponse.decode(reader, reader.uint32());
752
- break;
753
- case 2:
754
- message.answer = SessionDescription.decode(reader, reader.uint32());
755
- break;
756
- case 3:
757
- message.offer = SessionDescription.decode(reader, reader.uint32());
758
- break;
759
- case 4:
760
- message.trickle = TrickleRequest.decode(reader, reader.uint32());
761
- break;
762
- case 5:
763
- message.update = ParticipantUpdate.decode(reader, reader.uint32());
764
- break;
765
- case 6:
766
- message.trackPublished = TrackPublishedResponse.decode(
767
- reader,
768
- reader.uint32()
769
- );
770
- break;
771
- case 8:
772
- message.leave = LeaveRequest.decode(reader, reader.uint32());
773
- break;
774
- case 9:
775
- message.mute = MuteTrackRequest.decode(reader, reader.uint32());
776
- break;
777
- case 10:
778
- message.speakersChanged = SpeakersChanged.decode(
779
- reader,
780
- reader.uint32()
781
- );
782
- break;
783
- case 11:
784
- message.roomUpdate = RoomUpdate.decode(reader, reader.uint32());
785
- break;
786
- case 12:
787
- message.connectionQuality = ConnectionQualityUpdate.decode(
788
- reader,
789
- reader.uint32()
790
- );
791
- break;
792
- case 13:
793
- message.streamStateUpdate = StreamStateUpdate.decode(
794
- reader,
795
- reader.uint32()
796
- );
797
- break;
798
- case 14:
799
- message.subscribedQualityUpdate = SubscribedQualityUpdate.decode(
800
- reader,
801
- reader.uint32()
802
- );
803
- break;
804
- case 15:
805
- message.subscriptionPermissionUpdate =
806
- SubscriptionPermissionUpdate.decode(reader, reader.uint32());
807
- break;
808
- case 16:
809
- message.refreshToken = reader.string();
810
- break;
811
- case 17:
812
- message.trackUnpublished = TrackUnpublishedResponse.decode(
813
- reader,
814
- reader.uint32()
815
- );
816
- break;
817
- default:
818
- reader.skipType(tag & 7);
819
- break;
820
- }
821
- }
822
- return message;
823
- },
824
-
825
- fromJSON(object: any): SignalResponse {
826
- return {
827
- join: isSet(object.join) ? JoinResponse.fromJSON(object.join) : undefined,
828
- answer: isSet(object.answer)
829
- ? SessionDescription.fromJSON(object.answer)
830
- : undefined,
831
- offer: isSet(object.offer)
832
- ? SessionDescription.fromJSON(object.offer)
833
- : undefined,
834
- trickle: isSet(object.trickle)
835
- ? TrickleRequest.fromJSON(object.trickle)
836
- : undefined,
837
- update: isSet(object.update)
838
- ? ParticipantUpdate.fromJSON(object.update)
839
- : undefined,
840
- trackPublished: isSet(object.trackPublished)
841
- ? TrackPublishedResponse.fromJSON(object.trackPublished)
842
- : undefined,
843
- leave: isSet(object.leave)
844
- ? LeaveRequest.fromJSON(object.leave)
845
- : undefined,
846
- mute: isSet(object.mute)
847
- ? MuteTrackRequest.fromJSON(object.mute)
848
- : undefined,
849
- speakersChanged: isSet(object.speakersChanged)
850
- ? SpeakersChanged.fromJSON(object.speakersChanged)
851
- : undefined,
852
- roomUpdate: isSet(object.roomUpdate)
853
- ? RoomUpdate.fromJSON(object.roomUpdate)
854
- : undefined,
855
- connectionQuality: isSet(object.connectionQuality)
856
- ? ConnectionQualityUpdate.fromJSON(object.connectionQuality)
857
- : undefined,
858
- streamStateUpdate: isSet(object.streamStateUpdate)
859
- ? StreamStateUpdate.fromJSON(object.streamStateUpdate)
860
- : undefined,
861
- subscribedQualityUpdate: isSet(object.subscribedQualityUpdate)
862
- ? SubscribedQualityUpdate.fromJSON(object.subscribedQualityUpdate)
863
- : undefined,
864
- subscriptionPermissionUpdate: isSet(object.subscriptionPermissionUpdate)
865
- ? SubscriptionPermissionUpdate.fromJSON(
866
- object.subscriptionPermissionUpdate
867
- )
868
- : undefined,
869
- refreshToken: isSet(object.refreshToken)
870
- ? String(object.refreshToken)
871
- : undefined,
872
- trackUnpublished: isSet(object.trackUnpublished)
873
- ? TrackUnpublishedResponse.fromJSON(object.trackUnpublished)
874
- : undefined,
875
- };
876
- },
877
-
878
- toJSON(message: SignalResponse): unknown {
879
- const obj: any = {};
880
- message.join !== undefined &&
881
- (obj.join = message.join ? JoinResponse.toJSON(message.join) : undefined);
882
- message.answer !== undefined &&
883
- (obj.answer = message.answer
884
- ? SessionDescription.toJSON(message.answer)
885
- : undefined);
886
- message.offer !== undefined &&
887
- (obj.offer = message.offer
888
- ? SessionDescription.toJSON(message.offer)
889
- : undefined);
890
- message.trickle !== undefined &&
891
- (obj.trickle = message.trickle
892
- ? TrickleRequest.toJSON(message.trickle)
893
- : undefined);
894
- message.update !== undefined &&
895
- (obj.update = message.update
896
- ? ParticipantUpdate.toJSON(message.update)
897
- : undefined);
898
- message.trackPublished !== undefined &&
899
- (obj.trackPublished = message.trackPublished
900
- ? TrackPublishedResponse.toJSON(message.trackPublished)
901
- : undefined);
902
- message.leave !== undefined &&
903
- (obj.leave = message.leave
904
- ? LeaveRequest.toJSON(message.leave)
905
- : undefined);
906
- message.mute !== undefined &&
907
- (obj.mute = message.mute
908
- ? MuteTrackRequest.toJSON(message.mute)
909
- : undefined);
910
- message.speakersChanged !== undefined &&
911
- (obj.speakersChanged = message.speakersChanged
912
- ? SpeakersChanged.toJSON(message.speakersChanged)
913
- : undefined);
914
- message.roomUpdate !== undefined &&
915
- (obj.roomUpdate = message.roomUpdate
916
- ? RoomUpdate.toJSON(message.roomUpdate)
917
- : undefined);
918
- message.connectionQuality !== undefined &&
919
- (obj.connectionQuality = message.connectionQuality
920
- ? ConnectionQualityUpdate.toJSON(message.connectionQuality)
921
- : undefined);
922
- message.streamStateUpdate !== undefined &&
923
- (obj.streamStateUpdate = message.streamStateUpdate
924
- ? StreamStateUpdate.toJSON(message.streamStateUpdate)
925
- : undefined);
926
- message.subscribedQualityUpdate !== undefined &&
927
- (obj.subscribedQualityUpdate = message.subscribedQualityUpdate
928
- ? SubscribedQualityUpdate.toJSON(message.subscribedQualityUpdate)
929
- : undefined);
930
- message.subscriptionPermissionUpdate !== undefined &&
931
- (obj.subscriptionPermissionUpdate = message.subscriptionPermissionUpdate
932
- ? SubscriptionPermissionUpdate.toJSON(
933
- message.subscriptionPermissionUpdate
934
- )
935
- : undefined);
936
- message.refreshToken !== undefined &&
937
- (obj.refreshToken = message.refreshToken);
938
- message.trackUnpublished !== undefined &&
939
- (obj.trackUnpublished = message.trackUnpublished
940
- ? TrackUnpublishedResponse.toJSON(message.trackUnpublished)
941
- : undefined);
942
- return obj;
943
- },
944
-
945
- fromPartial<I extends Exact<DeepPartial<SignalResponse>, I>>(
946
- object: I
947
- ): SignalResponse {
948
- const message = createBaseSignalResponse();
949
- message.join =
950
- object.join !== undefined && object.join !== null
951
- ? JoinResponse.fromPartial(object.join)
952
- : undefined;
953
- message.answer =
954
- object.answer !== undefined && object.answer !== null
955
- ? SessionDescription.fromPartial(object.answer)
956
- : undefined;
957
- message.offer =
958
- object.offer !== undefined && object.offer !== null
959
- ? SessionDescription.fromPartial(object.offer)
960
- : undefined;
961
- message.trickle =
962
- object.trickle !== undefined && object.trickle !== null
963
- ? TrickleRequest.fromPartial(object.trickle)
964
- : undefined;
965
- message.update =
966
- object.update !== undefined && object.update !== null
967
- ? ParticipantUpdate.fromPartial(object.update)
968
- : undefined;
969
- message.trackPublished =
970
- object.trackPublished !== undefined && object.trackPublished !== null
971
- ? TrackPublishedResponse.fromPartial(object.trackPublished)
972
- : undefined;
973
- message.leave =
974
- object.leave !== undefined && object.leave !== null
975
- ? LeaveRequest.fromPartial(object.leave)
976
- : undefined;
977
- message.mute =
978
- object.mute !== undefined && object.mute !== null
979
- ? MuteTrackRequest.fromPartial(object.mute)
980
- : undefined;
981
- message.speakersChanged =
982
- object.speakersChanged !== undefined && object.speakersChanged !== null
983
- ? SpeakersChanged.fromPartial(object.speakersChanged)
984
- : undefined;
985
- message.roomUpdate =
986
- object.roomUpdate !== undefined && object.roomUpdate !== null
987
- ? RoomUpdate.fromPartial(object.roomUpdate)
988
- : undefined;
989
- message.connectionQuality =
990
- object.connectionQuality !== undefined &&
991
- object.connectionQuality !== null
992
- ? ConnectionQualityUpdate.fromPartial(object.connectionQuality)
993
- : undefined;
994
- message.streamStateUpdate =
995
- object.streamStateUpdate !== undefined &&
996
- object.streamStateUpdate !== null
997
- ? StreamStateUpdate.fromPartial(object.streamStateUpdate)
998
- : undefined;
999
- message.subscribedQualityUpdate =
1000
- object.subscribedQualityUpdate !== undefined &&
1001
- object.subscribedQualityUpdate !== null
1002
- ? SubscribedQualityUpdate.fromPartial(object.subscribedQualityUpdate)
1003
- : undefined;
1004
- message.subscriptionPermissionUpdate =
1005
- object.subscriptionPermissionUpdate !== undefined &&
1006
- object.subscriptionPermissionUpdate !== null
1007
- ? SubscriptionPermissionUpdate.fromPartial(
1008
- object.subscriptionPermissionUpdate
1009
- )
1010
- : undefined;
1011
- message.refreshToken = object.refreshToken ?? undefined;
1012
- message.trackUnpublished =
1013
- object.trackUnpublished !== undefined && object.trackUnpublished !== null
1014
- ? TrackUnpublishedResponse.fromPartial(object.trackUnpublished)
1015
- : undefined;
1016
- return message;
1017
- },
1018
- };
1019
-
1020
- function createBaseAddTrackRequest(): AddTrackRequest {
1021
- return {
1022
- cid: "",
1023
- name: "",
1024
- type: 0,
1025
- width: 0,
1026
- height: 0,
1027
- muted: false,
1028
- disableDtx: false,
1029
- source: 0,
1030
- layers: [],
1031
- };
1032
- }
1033
-
1034
- export const AddTrackRequest = {
1035
- encode(
1036
- message: AddTrackRequest,
1037
- writer: _m0.Writer = _m0.Writer.create()
1038
- ): _m0.Writer {
1039
- if (message.cid !== "") {
1040
- writer.uint32(10).string(message.cid);
1041
- }
1042
- if (message.name !== "") {
1043
- writer.uint32(18).string(message.name);
1044
- }
1045
- if (message.type !== 0) {
1046
- writer.uint32(24).int32(message.type);
1047
- }
1048
- if (message.width !== 0) {
1049
- writer.uint32(32).uint32(message.width);
1050
- }
1051
- if (message.height !== 0) {
1052
- writer.uint32(40).uint32(message.height);
1053
- }
1054
- if (message.muted === true) {
1055
- writer.uint32(48).bool(message.muted);
1056
- }
1057
- if (message.disableDtx === true) {
1058
- writer.uint32(56).bool(message.disableDtx);
1059
- }
1060
- if (message.source !== 0) {
1061
- writer.uint32(64).int32(message.source);
1062
- }
1063
- for (const v of message.layers) {
1064
- VideoLayer.encode(v!, writer.uint32(74).fork()).ldelim();
1065
- }
1066
- return writer;
1067
- },
1068
-
1069
- decode(input: _m0.Reader | Uint8Array, length?: number): AddTrackRequest {
1070
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1071
- let end = length === undefined ? reader.len : reader.pos + length;
1072
- const message = createBaseAddTrackRequest();
1073
- while (reader.pos < end) {
1074
- const tag = reader.uint32();
1075
- switch (tag >>> 3) {
1076
- case 1:
1077
- message.cid = reader.string();
1078
- break;
1079
- case 2:
1080
- message.name = reader.string();
1081
- break;
1082
- case 3:
1083
- message.type = reader.int32() as any;
1084
- break;
1085
- case 4:
1086
- message.width = reader.uint32();
1087
- break;
1088
- case 5:
1089
- message.height = reader.uint32();
1090
- break;
1091
- case 6:
1092
- message.muted = reader.bool();
1093
- break;
1094
- case 7:
1095
- message.disableDtx = reader.bool();
1096
- break;
1097
- case 8:
1098
- message.source = reader.int32() as any;
1099
- break;
1100
- case 9:
1101
- message.layers.push(VideoLayer.decode(reader, reader.uint32()));
1102
- break;
1103
- default:
1104
- reader.skipType(tag & 7);
1105
- break;
1106
- }
1107
- }
1108
- return message;
1109
- },
1110
-
1111
- fromJSON(object: any): AddTrackRequest {
1112
- return {
1113
- cid: isSet(object.cid) ? String(object.cid) : "",
1114
- name: isSet(object.name) ? String(object.name) : "",
1115
- type: isSet(object.type) ? trackTypeFromJSON(object.type) : 0,
1116
- width: isSet(object.width) ? Number(object.width) : 0,
1117
- height: isSet(object.height) ? Number(object.height) : 0,
1118
- muted: isSet(object.muted) ? Boolean(object.muted) : false,
1119
- disableDtx: isSet(object.disableDtx) ? Boolean(object.disableDtx) : false,
1120
- source: isSet(object.source) ? trackSourceFromJSON(object.source) : 0,
1121
- layers: Array.isArray(object?.layers)
1122
- ? object.layers.map((e: any) => VideoLayer.fromJSON(e))
1123
- : [],
1124
- };
1125
- },
1126
-
1127
- toJSON(message: AddTrackRequest): unknown {
1128
- const obj: any = {};
1129
- message.cid !== undefined && (obj.cid = message.cid);
1130
- message.name !== undefined && (obj.name = message.name);
1131
- message.type !== undefined && (obj.type = trackTypeToJSON(message.type));
1132
- message.width !== undefined && (obj.width = Math.round(message.width));
1133
- message.height !== undefined && (obj.height = Math.round(message.height));
1134
- message.muted !== undefined && (obj.muted = message.muted);
1135
- message.disableDtx !== undefined && (obj.disableDtx = message.disableDtx);
1136
- message.source !== undefined &&
1137
- (obj.source = trackSourceToJSON(message.source));
1138
- if (message.layers) {
1139
- obj.layers = message.layers.map((e) =>
1140
- e ? VideoLayer.toJSON(e) : undefined
1141
- );
1142
- } else {
1143
- obj.layers = [];
1144
- }
1145
- return obj;
1146
- },
1147
-
1148
- fromPartial<I extends Exact<DeepPartial<AddTrackRequest>, I>>(
1149
- object: I
1150
- ): AddTrackRequest {
1151
- const message = createBaseAddTrackRequest();
1152
- message.cid = object.cid ?? "";
1153
- message.name = object.name ?? "";
1154
- message.type = object.type ?? 0;
1155
- message.width = object.width ?? 0;
1156
- message.height = object.height ?? 0;
1157
- message.muted = object.muted ?? false;
1158
- message.disableDtx = object.disableDtx ?? false;
1159
- message.source = object.source ?? 0;
1160
- message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
1161
- return message;
1162
- },
1163
- };
1164
-
1165
- function createBaseTrickleRequest(): TrickleRequest {
1166
- return { candidateInit: "", target: 0 };
1167
- }
1168
-
1169
- export const TrickleRequest = {
1170
- encode(
1171
- message: TrickleRequest,
1172
- writer: _m0.Writer = _m0.Writer.create()
1173
- ): _m0.Writer {
1174
- if (message.candidateInit !== "") {
1175
- writer.uint32(10).string(message.candidateInit);
1176
- }
1177
- if (message.target !== 0) {
1178
- writer.uint32(16).int32(message.target);
1179
- }
1180
- return writer;
1181
- },
1182
-
1183
- decode(input: _m0.Reader | Uint8Array, length?: number): TrickleRequest {
1184
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1185
- let end = length === undefined ? reader.len : reader.pos + length;
1186
- const message = createBaseTrickleRequest();
1187
- while (reader.pos < end) {
1188
- const tag = reader.uint32();
1189
- switch (tag >>> 3) {
1190
- case 1:
1191
- message.candidateInit = reader.string();
1192
- break;
1193
- case 2:
1194
- message.target = reader.int32() as any;
1195
- break;
1196
- default:
1197
- reader.skipType(tag & 7);
1198
- break;
1199
- }
1200
- }
1201
- return message;
1202
- },
1203
-
1204
- fromJSON(object: any): TrickleRequest {
1205
- return {
1206
- candidateInit: isSet(object.candidateInit)
1207
- ? String(object.candidateInit)
1208
- : "",
1209
- target: isSet(object.target) ? signalTargetFromJSON(object.target) : 0,
1210
- };
1211
- },
1212
-
1213
- toJSON(message: TrickleRequest): unknown {
1214
- const obj: any = {};
1215
- message.candidateInit !== undefined &&
1216
- (obj.candidateInit = message.candidateInit);
1217
- message.target !== undefined &&
1218
- (obj.target = signalTargetToJSON(message.target));
1219
- return obj;
1220
- },
1221
-
1222
- fromPartial<I extends Exact<DeepPartial<TrickleRequest>, I>>(
1223
- object: I
1224
- ): TrickleRequest {
1225
- const message = createBaseTrickleRequest();
1226
- message.candidateInit = object.candidateInit ?? "";
1227
- message.target = object.target ?? 0;
1228
- return message;
1229
- },
1230
- };
1231
-
1232
- function createBaseMuteTrackRequest(): MuteTrackRequest {
1233
- return { sid: "", muted: false };
1234
- }
1235
-
1236
- export const MuteTrackRequest = {
1237
- encode(
1238
- message: MuteTrackRequest,
1239
- writer: _m0.Writer = _m0.Writer.create()
1240
- ): _m0.Writer {
1241
- if (message.sid !== "") {
1242
- writer.uint32(10).string(message.sid);
1243
- }
1244
- if (message.muted === true) {
1245
- writer.uint32(16).bool(message.muted);
1246
- }
1247
- return writer;
1248
- },
1249
-
1250
- decode(input: _m0.Reader | Uint8Array, length?: number): MuteTrackRequest {
1251
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1252
- let end = length === undefined ? reader.len : reader.pos + length;
1253
- const message = createBaseMuteTrackRequest();
1254
- while (reader.pos < end) {
1255
- const tag = reader.uint32();
1256
- switch (tag >>> 3) {
1257
- case 1:
1258
- message.sid = reader.string();
1259
- break;
1260
- case 2:
1261
- message.muted = reader.bool();
1262
- break;
1263
- default:
1264
- reader.skipType(tag & 7);
1265
- break;
1266
- }
1267
- }
1268
- return message;
1269
- },
1270
-
1271
- fromJSON(object: any): MuteTrackRequest {
1272
- return {
1273
- sid: isSet(object.sid) ? String(object.sid) : "",
1274
- muted: isSet(object.muted) ? Boolean(object.muted) : false,
1275
- };
1276
- },
1277
-
1278
- toJSON(message: MuteTrackRequest): unknown {
1279
- const obj: any = {};
1280
- message.sid !== undefined && (obj.sid = message.sid);
1281
- message.muted !== undefined && (obj.muted = message.muted);
1282
- return obj;
1283
- },
1284
-
1285
- fromPartial<I extends Exact<DeepPartial<MuteTrackRequest>, I>>(
1286
- object: I
1287
- ): MuteTrackRequest {
1288
- const message = createBaseMuteTrackRequest();
1289
- message.sid = object.sid ?? "";
1290
- message.muted = object.muted ?? false;
1291
- return message;
1292
- },
1293
- };
1294
-
1295
- function createBaseJoinResponse(): JoinResponse {
1296
- return {
1297
- room: undefined,
1298
- participant: undefined,
1299
- otherParticipants: [],
1300
- serverVersion: "",
1301
- iceServers: [],
1302
- subscriberPrimary: false,
1303
- alternativeUrl: "",
1304
- clientConfiguration: undefined,
1305
- serverRegion: "",
1306
- };
1307
- }
1308
-
1309
- export const JoinResponse = {
1310
- encode(
1311
- message: JoinResponse,
1312
- writer: _m0.Writer = _m0.Writer.create()
1313
- ): _m0.Writer {
1314
- if (message.room !== undefined) {
1315
- Room.encode(message.room, writer.uint32(10).fork()).ldelim();
1316
- }
1317
- if (message.participant !== undefined) {
1318
- ParticipantInfo.encode(
1319
- message.participant,
1320
- writer.uint32(18).fork()
1321
- ).ldelim();
1322
- }
1323
- for (const v of message.otherParticipants) {
1324
- ParticipantInfo.encode(v!, writer.uint32(26).fork()).ldelim();
1325
- }
1326
- if (message.serverVersion !== "") {
1327
- writer.uint32(34).string(message.serverVersion);
1328
- }
1329
- for (const v of message.iceServers) {
1330
- ICEServer.encode(v!, writer.uint32(42).fork()).ldelim();
1331
- }
1332
- if (message.subscriberPrimary === true) {
1333
- writer.uint32(48).bool(message.subscriberPrimary);
1334
- }
1335
- if (message.alternativeUrl !== "") {
1336
- writer.uint32(58).string(message.alternativeUrl);
1337
- }
1338
- if (message.clientConfiguration !== undefined) {
1339
- ClientConfiguration.encode(
1340
- message.clientConfiguration,
1341
- writer.uint32(66).fork()
1342
- ).ldelim();
1343
- }
1344
- if (message.serverRegion !== "") {
1345
- writer.uint32(74).string(message.serverRegion);
1346
- }
1347
- return writer;
1348
- },
1349
-
1350
- decode(input: _m0.Reader | Uint8Array, length?: number): JoinResponse {
1351
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1352
- let end = length === undefined ? reader.len : reader.pos + length;
1353
- const message = createBaseJoinResponse();
1354
- while (reader.pos < end) {
1355
- const tag = reader.uint32();
1356
- switch (tag >>> 3) {
1357
- case 1:
1358
- message.room = Room.decode(reader, reader.uint32());
1359
- break;
1360
- case 2:
1361
- message.participant = ParticipantInfo.decode(reader, reader.uint32());
1362
- break;
1363
- case 3:
1364
- message.otherParticipants.push(
1365
- ParticipantInfo.decode(reader, reader.uint32())
1366
- );
1367
- break;
1368
- case 4:
1369
- message.serverVersion = reader.string();
1370
- break;
1371
- case 5:
1372
- message.iceServers.push(ICEServer.decode(reader, reader.uint32()));
1373
- break;
1374
- case 6:
1375
- message.subscriberPrimary = reader.bool();
1376
- break;
1377
- case 7:
1378
- message.alternativeUrl = reader.string();
1379
- break;
1380
- case 8:
1381
- message.clientConfiguration = ClientConfiguration.decode(
1382
- reader,
1383
- reader.uint32()
1384
- );
1385
- break;
1386
- case 9:
1387
- message.serverRegion = reader.string();
1388
- break;
1389
- default:
1390
- reader.skipType(tag & 7);
1391
- break;
1392
- }
1393
- }
1394
- return message;
1395
- },
1396
-
1397
- fromJSON(object: any): JoinResponse {
1398
- return {
1399
- room: isSet(object.room) ? Room.fromJSON(object.room) : undefined,
1400
- participant: isSet(object.participant)
1401
- ? ParticipantInfo.fromJSON(object.participant)
1402
- : undefined,
1403
- otherParticipants: Array.isArray(object?.otherParticipants)
1404
- ? object.otherParticipants.map((e: any) => ParticipantInfo.fromJSON(e))
1405
- : [],
1406
- serverVersion: isSet(object.serverVersion)
1407
- ? String(object.serverVersion)
1408
- : "",
1409
- iceServers: Array.isArray(object?.iceServers)
1410
- ? object.iceServers.map((e: any) => ICEServer.fromJSON(e))
1411
- : [],
1412
- subscriberPrimary: isSet(object.subscriberPrimary)
1413
- ? Boolean(object.subscriberPrimary)
1414
- : false,
1415
- alternativeUrl: isSet(object.alternativeUrl)
1416
- ? String(object.alternativeUrl)
1417
- : "",
1418
- clientConfiguration: isSet(object.clientConfiguration)
1419
- ? ClientConfiguration.fromJSON(object.clientConfiguration)
1420
- : undefined,
1421
- serverRegion: isSet(object.serverRegion)
1422
- ? String(object.serverRegion)
1423
- : "",
1424
- };
1425
- },
1426
-
1427
- toJSON(message: JoinResponse): unknown {
1428
- const obj: any = {};
1429
- message.room !== undefined &&
1430
- (obj.room = message.room ? Room.toJSON(message.room) : undefined);
1431
- message.participant !== undefined &&
1432
- (obj.participant = message.participant
1433
- ? ParticipantInfo.toJSON(message.participant)
1434
- : undefined);
1435
- if (message.otherParticipants) {
1436
- obj.otherParticipants = message.otherParticipants.map((e) =>
1437
- e ? ParticipantInfo.toJSON(e) : undefined
1438
- );
1439
- } else {
1440
- obj.otherParticipants = [];
1441
- }
1442
- message.serverVersion !== undefined &&
1443
- (obj.serverVersion = message.serverVersion);
1444
- if (message.iceServers) {
1445
- obj.iceServers = message.iceServers.map((e) =>
1446
- e ? ICEServer.toJSON(e) : undefined
1447
- );
1448
- } else {
1449
- obj.iceServers = [];
1450
- }
1451
- message.subscriberPrimary !== undefined &&
1452
- (obj.subscriberPrimary = message.subscriberPrimary);
1453
- message.alternativeUrl !== undefined &&
1454
- (obj.alternativeUrl = message.alternativeUrl);
1455
- message.clientConfiguration !== undefined &&
1456
- (obj.clientConfiguration = message.clientConfiguration
1457
- ? ClientConfiguration.toJSON(message.clientConfiguration)
1458
- : undefined);
1459
- message.serverRegion !== undefined &&
1460
- (obj.serverRegion = message.serverRegion);
1461
- return obj;
1462
- },
1463
-
1464
- fromPartial<I extends Exact<DeepPartial<JoinResponse>, I>>(
1465
- object: I
1466
- ): JoinResponse {
1467
- const message = createBaseJoinResponse();
1468
- message.room =
1469
- object.room !== undefined && object.room !== null
1470
- ? Room.fromPartial(object.room)
1471
- : undefined;
1472
- message.participant =
1473
- object.participant !== undefined && object.participant !== null
1474
- ? ParticipantInfo.fromPartial(object.participant)
1475
- : undefined;
1476
- message.otherParticipants =
1477
- object.otherParticipants?.map((e) => ParticipantInfo.fromPartial(e)) ||
1478
- [];
1479
- message.serverVersion = object.serverVersion ?? "";
1480
- message.iceServers =
1481
- object.iceServers?.map((e) => ICEServer.fromPartial(e)) || [];
1482
- message.subscriberPrimary = object.subscriberPrimary ?? false;
1483
- message.alternativeUrl = object.alternativeUrl ?? "";
1484
- message.clientConfiguration =
1485
- object.clientConfiguration !== undefined &&
1486
- object.clientConfiguration !== null
1487
- ? ClientConfiguration.fromPartial(object.clientConfiguration)
1488
- : undefined;
1489
- message.serverRegion = object.serverRegion ?? "";
1490
- return message;
1491
- },
1492
- };
1493
-
1494
- function createBaseTrackPublishedResponse(): TrackPublishedResponse {
1495
- return { cid: "", track: undefined };
1496
- }
1497
-
1498
- export const TrackPublishedResponse = {
1499
- encode(
1500
- message: TrackPublishedResponse,
1501
- writer: _m0.Writer = _m0.Writer.create()
1502
- ): _m0.Writer {
1503
- if (message.cid !== "") {
1504
- writer.uint32(10).string(message.cid);
1505
- }
1506
- if (message.track !== undefined) {
1507
- TrackInfo.encode(message.track, writer.uint32(18).fork()).ldelim();
1508
- }
1509
- return writer;
1510
- },
1511
-
1512
- decode(
1513
- input: _m0.Reader | Uint8Array,
1514
- length?: number
1515
- ): TrackPublishedResponse {
1516
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1517
- let end = length === undefined ? reader.len : reader.pos + length;
1518
- const message = createBaseTrackPublishedResponse();
1519
- while (reader.pos < end) {
1520
- const tag = reader.uint32();
1521
- switch (tag >>> 3) {
1522
- case 1:
1523
- message.cid = reader.string();
1524
- break;
1525
- case 2:
1526
- message.track = TrackInfo.decode(reader, reader.uint32());
1527
- break;
1528
- default:
1529
- reader.skipType(tag & 7);
1530
- break;
1531
- }
1532
- }
1533
- return message;
1534
- },
1535
-
1536
- fromJSON(object: any): TrackPublishedResponse {
1537
- return {
1538
- cid: isSet(object.cid) ? String(object.cid) : "",
1539
- track: isSet(object.track) ? TrackInfo.fromJSON(object.track) : undefined,
1540
- };
1541
- },
1542
-
1543
- toJSON(message: TrackPublishedResponse): unknown {
1544
- const obj: any = {};
1545
- message.cid !== undefined && (obj.cid = message.cid);
1546
- message.track !== undefined &&
1547
- (obj.track = message.track ? TrackInfo.toJSON(message.track) : undefined);
1548
- return obj;
1549
- },
1550
-
1551
- fromPartial<I extends Exact<DeepPartial<TrackPublishedResponse>, I>>(
1552
- object: I
1553
- ): TrackPublishedResponse {
1554
- const message = createBaseTrackPublishedResponse();
1555
- message.cid = object.cid ?? "";
1556
- message.track =
1557
- object.track !== undefined && object.track !== null
1558
- ? TrackInfo.fromPartial(object.track)
1559
- : undefined;
1560
- return message;
1561
- },
1562
- };
1563
-
1564
- function createBaseTrackUnpublishedResponse(): TrackUnpublishedResponse {
1565
- return { trackSid: "" };
1566
- }
1567
-
1568
- export const TrackUnpublishedResponse = {
1569
- encode(
1570
- message: TrackUnpublishedResponse,
1571
- writer: _m0.Writer = _m0.Writer.create()
1572
- ): _m0.Writer {
1573
- if (message.trackSid !== "") {
1574
- writer.uint32(10).string(message.trackSid);
1575
- }
1576
- return writer;
1577
- },
1578
-
1579
- decode(
1580
- input: _m0.Reader | Uint8Array,
1581
- length?: number
1582
- ): TrackUnpublishedResponse {
1583
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1584
- let end = length === undefined ? reader.len : reader.pos + length;
1585
- const message = createBaseTrackUnpublishedResponse();
1586
- while (reader.pos < end) {
1587
- const tag = reader.uint32();
1588
- switch (tag >>> 3) {
1589
- case 1:
1590
- message.trackSid = reader.string();
1591
- break;
1592
- default:
1593
- reader.skipType(tag & 7);
1594
- break;
1595
- }
1596
- }
1597
- return message;
1598
- },
1599
-
1600
- fromJSON(object: any): TrackUnpublishedResponse {
1601
- return {
1602
- trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
1603
- };
1604
- },
1605
-
1606
- toJSON(message: TrackUnpublishedResponse): unknown {
1607
- const obj: any = {};
1608
- message.trackSid !== undefined && (obj.trackSid = message.trackSid);
1609
- return obj;
1610
- },
1611
-
1612
- fromPartial<I extends Exact<DeepPartial<TrackUnpublishedResponse>, I>>(
1613
- object: I
1614
- ): TrackUnpublishedResponse {
1615
- const message = createBaseTrackUnpublishedResponse();
1616
- message.trackSid = object.trackSid ?? "";
1617
- return message;
1618
- },
1619
- };
1620
-
1621
- function createBaseSessionDescription(): SessionDescription {
1622
- return { type: "", sdp: "" };
1623
- }
1624
-
1625
- export const SessionDescription = {
1626
- encode(
1627
- message: SessionDescription,
1628
- writer: _m0.Writer = _m0.Writer.create()
1629
- ): _m0.Writer {
1630
- if (message.type !== "") {
1631
- writer.uint32(10).string(message.type);
1632
- }
1633
- if (message.sdp !== "") {
1634
- writer.uint32(18).string(message.sdp);
1635
- }
1636
- return writer;
1637
- },
1638
-
1639
- decode(input: _m0.Reader | Uint8Array, length?: number): SessionDescription {
1640
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1641
- let end = length === undefined ? reader.len : reader.pos + length;
1642
- const message = createBaseSessionDescription();
1643
- while (reader.pos < end) {
1644
- const tag = reader.uint32();
1645
- switch (tag >>> 3) {
1646
- case 1:
1647
- message.type = reader.string();
1648
- break;
1649
- case 2:
1650
- message.sdp = reader.string();
1651
- break;
1652
- default:
1653
- reader.skipType(tag & 7);
1654
- break;
1655
- }
1656
- }
1657
- return message;
1658
- },
1659
-
1660
- fromJSON(object: any): SessionDescription {
1661
- return {
1662
- type: isSet(object.type) ? String(object.type) : "",
1663
- sdp: isSet(object.sdp) ? String(object.sdp) : "",
1664
- };
1665
- },
1666
-
1667
- toJSON(message: SessionDescription): unknown {
1668
- const obj: any = {};
1669
- message.type !== undefined && (obj.type = message.type);
1670
- message.sdp !== undefined && (obj.sdp = message.sdp);
1671
- return obj;
1672
- },
1673
-
1674
- fromPartial<I extends Exact<DeepPartial<SessionDescription>, I>>(
1675
- object: I
1676
- ): SessionDescription {
1677
- const message = createBaseSessionDescription();
1678
- message.type = object.type ?? "";
1679
- message.sdp = object.sdp ?? "";
1680
- return message;
1681
- },
1682
- };
1683
-
1684
- function createBaseParticipantUpdate(): ParticipantUpdate {
1685
- return { participants: [] };
1686
- }
1687
-
1688
- export const ParticipantUpdate = {
1689
- encode(
1690
- message: ParticipantUpdate,
1691
- writer: _m0.Writer = _m0.Writer.create()
1692
- ): _m0.Writer {
1693
- for (const v of message.participants) {
1694
- ParticipantInfo.encode(v!, writer.uint32(10).fork()).ldelim();
1695
- }
1696
- return writer;
1697
- },
1698
-
1699
- decode(input: _m0.Reader | Uint8Array, length?: number): ParticipantUpdate {
1700
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1701
- let end = length === undefined ? reader.len : reader.pos + length;
1702
- const message = createBaseParticipantUpdate();
1703
- while (reader.pos < end) {
1704
- const tag = reader.uint32();
1705
- switch (tag >>> 3) {
1706
- case 1:
1707
- message.participants.push(
1708
- ParticipantInfo.decode(reader, reader.uint32())
1709
- );
1710
- break;
1711
- default:
1712
- reader.skipType(tag & 7);
1713
- break;
1714
- }
1715
- }
1716
- return message;
1717
- },
1718
-
1719
- fromJSON(object: any): ParticipantUpdate {
1720
- return {
1721
- participants: Array.isArray(object?.participants)
1722
- ? object.participants.map((e: any) => ParticipantInfo.fromJSON(e))
1723
- : [],
1724
- };
1725
- },
1726
-
1727
- toJSON(message: ParticipantUpdate): unknown {
1728
- const obj: any = {};
1729
- if (message.participants) {
1730
- obj.participants = message.participants.map((e) =>
1731
- e ? ParticipantInfo.toJSON(e) : undefined
1732
- );
1733
- } else {
1734
- obj.participants = [];
1735
- }
1736
- return obj;
1737
- },
1738
-
1739
- fromPartial<I extends Exact<DeepPartial<ParticipantUpdate>, I>>(
1740
- object: I
1741
- ): ParticipantUpdate {
1742
- const message = createBaseParticipantUpdate();
1743
- message.participants =
1744
- object.participants?.map((e) => ParticipantInfo.fromPartial(e)) || [];
1745
- return message;
1746
- },
1747
- };
1748
-
1749
- function createBaseUpdateSubscription(): UpdateSubscription {
1750
- return { trackSids: [], subscribe: false, participantTracks: [] };
1751
- }
1752
-
1753
- export const UpdateSubscription = {
1754
- encode(
1755
- message: UpdateSubscription,
1756
- writer: _m0.Writer = _m0.Writer.create()
1757
- ): _m0.Writer {
1758
- for (const v of message.trackSids) {
1759
- writer.uint32(10).string(v!);
1760
- }
1761
- if (message.subscribe === true) {
1762
- writer.uint32(16).bool(message.subscribe);
1763
- }
1764
- for (const v of message.participantTracks) {
1765
- ParticipantTracks.encode(v!, writer.uint32(26).fork()).ldelim();
1766
- }
1767
- return writer;
1768
- },
1769
-
1770
- decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSubscription {
1771
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1772
- let end = length === undefined ? reader.len : reader.pos + length;
1773
- const message = createBaseUpdateSubscription();
1774
- while (reader.pos < end) {
1775
- const tag = reader.uint32();
1776
- switch (tag >>> 3) {
1777
- case 1:
1778
- message.trackSids.push(reader.string());
1779
- break;
1780
- case 2:
1781
- message.subscribe = reader.bool();
1782
- break;
1783
- case 3:
1784
- message.participantTracks.push(
1785
- ParticipantTracks.decode(reader, reader.uint32())
1786
- );
1787
- break;
1788
- default:
1789
- reader.skipType(tag & 7);
1790
- break;
1791
- }
1792
- }
1793
- return message;
1794
- },
1795
-
1796
- fromJSON(object: any): UpdateSubscription {
1797
- return {
1798
- trackSids: Array.isArray(object?.trackSids)
1799
- ? object.trackSids.map((e: any) => String(e))
1800
- : [],
1801
- subscribe: isSet(object.subscribe) ? Boolean(object.subscribe) : false,
1802
- participantTracks: Array.isArray(object?.participantTracks)
1803
- ? object.participantTracks.map((e: any) =>
1804
- ParticipantTracks.fromJSON(e)
1805
- )
1806
- : [],
1807
- };
1808
- },
1809
-
1810
- toJSON(message: UpdateSubscription): unknown {
1811
- const obj: any = {};
1812
- if (message.trackSids) {
1813
- obj.trackSids = message.trackSids.map((e) => e);
1814
- } else {
1815
- obj.trackSids = [];
1816
- }
1817
- message.subscribe !== undefined && (obj.subscribe = message.subscribe);
1818
- if (message.participantTracks) {
1819
- obj.participantTracks = message.participantTracks.map((e) =>
1820
- e ? ParticipantTracks.toJSON(e) : undefined
1821
- );
1822
- } else {
1823
- obj.participantTracks = [];
1824
- }
1825
- return obj;
1826
- },
1827
-
1828
- fromPartial<I extends Exact<DeepPartial<UpdateSubscription>, I>>(
1829
- object: I
1830
- ): UpdateSubscription {
1831
- const message = createBaseUpdateSubscription();
1832
- message.trackSids = object.trackSids?.map((e) => e) || [];
1833
- message.subscribe = object.subscribe ?? false;
1834
- message.participantTracks =
1835
- object.participantTracks?.map((e) => ParticipantTracks.fromPartial(e)) ||
1836
- [];
1837
- return message;
1838
- },
1839
- };
1840
-
1841
- function createBaseUpdateTrackSettings(): UpdateTrackSettings {
1842
- return { trackSids: [], disabled: false, quality: 0, width: 0, height: 0 };
1843
- }
1844
-
1845
- export const UpdateTrackSettings = {
1846
- encode(
1847
- message: UpdateTrackSettings,
1848
- writer: _m0.Writer = _m0.Writer.create()
1849
- ): _m0.Writer {
1850
- for (const v of message.trackSids) {
1851
- writer.uint32(10).string(v!);
1852
- }
1853
- if (message.disabled === true) {
1854
- writer.uint32(24).bool(message.disabled);
1855
- }
1856
- if (message.quality !== 0) {
1857
- writer.uint32(32).int32(message.quality);
1858
- }
1859
- if (message.width !== 0) {
1860
- writer.uint32(40).uint32(message.width);
1861
- }
1862
- if (message.height !== 0) {
1863
- writer.uint32(48).uint32(message.height);
1864
- }
1865
- return writer;
1866
- },
1867
-
1868
- decode(input: _m0.Reader | Uint8Array, length?: number): UpdateTrackSettings {
1869
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1870
- let end = length === undefined ? reader.len : reader.pos + length;
1871
- const message = createBaseUpdateTrackSettings();
1872
- while (reader.pos < end) {
1873
- const tag = reader.uint32();
1874
- switch (tag >>> 3) {
1875
- case 1:
1876
- message.trackSids.push(reader.string());
1877
- break;
1878
- case 3:
1879
- message.disabled = reader.bool();
1880
- break;
1881
- case 4:
1882
- message.quality = reader.int32() as any;
1883
- break;
1884
- case 5:
1885
- message.width = reader.uint32();
1886
- break;
1887
- case 6:
1888
- message.height = reader.uint32();
1889
- break;
1890
- default:
1891
- reader.skipType(tag & 7);
1892
- break;
1893
- }
1894
- }
1895
- return message;
1896
- },
1897
-
1898
- fromJSON(object: any): UpdateTrackSettings {
1899
- return {
1900
- trackSids: Array.isArray(object?.trackSids)
1901
- ? object.trackSids.map((e: any) => String(e))
1902
- : [],
1903
- disabled: isSet(object.disabled) ? Boolean(object.disabled) : false,
1904
- quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
1905
- width: isSet(object.width) ? Number(object.width) : 0,
1906
- height: isSet(object.height) ? Number(object.height) : 0,
1907
- };
1908
- },
1909
-
1910
- toJSON(message: UpdateTrackSettings): unknown {
1911
- const obj: any = {};
1912
- if (message.trackSids) {
1913
- obj.trackSids = message.trackSids.map((e) => e);
1914
- } else {
1915
- obj.trackSids = [];
1916
- }
1917
- message.disabled !== undefined && (obj.disabled = message.disabled);
1918
- message.quality !== undefined &&
1919
- (obj.quality = videoQualityToJSON(message.quality));
1920
- message.width !== undefined && (obj.width = Math.round(message.width));
1921
- message.height !== undefined && (obj.height = Math.round(message.height));
1922
- return obj;
1923
- },
1924
-
1925
- fromPartial<I extends Exact<DeepPartial<UpdateTrackSettings>, I>>(
1926
- object: I
1927
- ): UpdateTrackSettings {
1928
- const message = createBaseUpdateTrackSettings();
1929
- message.trackSids = object.trackSids?.map((e) => e) || [];
1930
- message.disabled = object.disabled ?? false;
1931
- message.quality = object.quality ?? 0;
1932
- message.width = object.width ?? 0;
1933
- message.height = object.height ?? 0;
1934
- return message;
1935
- },
1936
- };
1937
-
1938
- function createBaseLeaveRequest(): LeaveRequest {
1939
- return { canReconnect: false };
1940
- }
1941
-
1942
- export const LeaveRequest = {
1943
- encode(
1944
- message: LeaveRequest,
1945
- writer: _m0.Writer = _m0.Writer.create()
1946
- ): _m0.Writer {
1947
- if (message.canReconnect === true) {
1948
- writer.uint32(8).bool(message.canReconnect);
1949
- }
1950
- return writer;
1951
- },
1952
-
1953
- decode(input: _m0.Reader | Uint8Array, length?: number): LeaveRequest {
1954
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1955
- let end = length === undefined ? reader.len : reader.pos + length;
1956
- const message = createBaseLeaveRequest();
1957
- while (reader.pos < end) {
1958
- const tag = reader.uint32();
1959
- switch (tag >>> 3) {
1960
- case 1:
1961
- message.canReconnect = reader.bool();
1962
- break;
1963
- default:
1964
- reader.skipType(tag & 7);
1965
- break;
1966
- }
1967
- }
1968
- return message;
1969
- },
1970
-
1971
- fromJSON(object: any): LeaveRequest {
1972
- return {
1973
- canReconnect: isSet(object.canReconnect)
1974
- ? Boolean(object.canReconnect)
1975
- : false,
1976
- };
1977
- },
1978
-
1979
- toJSON(message: LeaveRequest): unknown {
1980
- const obj: any = {};
1981
- message.canReconnect !== undefined &&
1982
- (obj.canReconnect = message.canReconnect);
1983
- return obj;
1984
- },
1985
-
1986
- fromPartial<I extends Exact<DeepPartial<LeaveRequest>, I>>(
1987
- object: I
1988
- ): LeaveRequest {
1989
- const message = createBaseLeaveRequest();
1990
- message.canReconnect = object.canReconnect ?? false;
1991
- return message;
1992
- },
1993
- };
1994
-
1995
- function createBaseUpdateVideoLayers(): UpdateVideoLayers {
1996
- return { trackSid: "", layers: [] };
1997
- }
1998
-
1999
- export const UpdateVideoLayers = {
2000
- encode(
2001
- message: UpdateVideoLayers,
2002
- writer: _m0.Writer = _m0.Writer.create()
2003
- ): _m0.Writer {
2004
- if (message.trackSid !== "") {
2005
- writer.uint32(10).string(message.trackSid);
2006
- }
2007
- for (const v of message.layers) {
2008
- VideoLayer.encode(v!, writer.uint32(18).fork()).ldelim();
2009
- }
2010
- return writer;
2011
- },
2012
-
2013
- decode(input: _m0.Reader | Uint8Array, length?: number): UpdateVideoLayers {
2014
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2015
- let end = length === undefined ? reader.len : reader.pos + length;
2016
- const message = createBaseUpdateVideoLayers();
2017
- while (reader.pos < end) {
2018
- const tag = reader.uint32();
2019
- switch (tag >>> 3) {
2020
- case 1:
2021
- message.trackSid = reader.string();
2022
- break;
2023
- case 2:
2024
- message.layers.push(VideoLayer.decode(reader, reader.uint32()));
2025
- break;
2026
- default:
2027
- reader.skipType(tag & 7);
2028
- break;
2029
- }
2030
- }
2031
- return message;
2032
- },
2033
-
2034
- fromJSON(object: any): UpdateVideoLayers {
2035
- return {
2036
- trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2037
- layers: Array.isArray(object?.layers)
2038
- ? object.layers.map((e: any) => VideoLayer.fromJSON(e))
2039
- : [],
2040
- };
2041
- },
2042
-
2043
- toJSON(message: UpdateVideoLayers): unknown {
2044
- const obj: any = {};
2045
- message.trackSid !== undefined && (obj.trackSid = message.trackSid);
2046
- if (message.layers) {
2047
- obj.layers = message.layers.map((e) =>
2048
- e ? VideoLayer.toJSON(e) : undefined
2049
- );
2050
- } else {
2051
- obj.layers = [];
2052
- }
2053
- return obj;
2054
- },
2055
-
2056
- fromPartial<I extends Exact<DeepPartial<UpdateVideoLayers>, I>>(
2057
- object: I
2058
- ): UpdateVideoLayers {
2059
- const message = createBaseUpdateVideoLayers();
2060
- message.trackSid = object.trackSid ?? "";
2061
- message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
2062
- return message;
2063
- },
2064
- };
2065
-
2066
- function createBaseICEServer(): ICEServer {
2067
- return { urls: [], username: "", credential: "" };
2068
- }
2069
-
2070
- export const ICEServer = {
2071
- encode(
2072
- message: ICEServer,
2073
- writer: _m0.Writer = _m0.Writer.create()
2074
- ): _m0.Writer {
2075
- for (const v of message.urls) {
2076
- writer.uint32(10).string(v!);
2077
- }
2078
- if (message.username !== "") {
2079
- writer.uint32(18).string(message.username);
2080
- }
2081
- if (message.credential !== "") {
2082
- writer.uint32(26).string(message.credential);
2083
- }
2084
- return writer;
2085
- },
2086
-
2087
- decode(input: _m0.Reader | Uint8Array, length?: number): ICEServer {
2088
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2089
- let end = length === undefined ? reader.len : reader.pos + length;
2090
- const message = createBaseICEServer();
2091
- while (reader.pos < end) {
2092
- const tag = reader.uint32();
2093
- switch (tag >>> 3) {
2094
- case 1:
2095
- message.urls.push(reader.string());
2096
- break;
2097
- case 2:
2098
- message.username = reader.string();
2099
- break;
2100
- case 3:
2101
- message.credential = reader.string();
2102
- break;
2103
- default:
2104
- reader.skipType(tag & 7);
2105
- break;
2106
- }
2107
- }
2108
- return message;
2109
- },
2110
-
2111
- fromJSON(object: any): ICEServer {
2112
- return {
2113
- urls: Array.isArray(object?.urls)
2114
- ? object.urls.map((e: any) => String(e))
2115
- : [],
2116
- username: isSet(object.username) ? String(object.username) : "",
2117
- credential: isSet(object.credential) ? String(object.credential) : "",
2118
- };
2119
- },
2120
-
2121
- toJSON(message: ICEServer): unknown {
2122
- const obj: any = {};
2123
- if (message.urls) {
2124
- obj.urls = message.urls.map((e) => e);
2125
- } else {
2126
- obj.urls = [];
2127
- }
2128
- message.username !== undefined && (obj.username = message.username);
2129
- message.credential !== undefined && (obj.credential = message.credential);
2130
- return obj;
2131
- },
2132
-
2133
- fromPartial<I extends Exact<DeepPartial<ICEServer>, I>>(
2134
- object: I
2135
- ): ICEServer {
2136
- const message = createBaseICEServer();
2137
- message.urls = object.urls?.map((e) => e) || [];
2138
- message.username = object.username ?? "";
2139
- message.credential = object.credential ?? "";
2140
- return message;
2141
- },
2142
- };
2143
-
2144
- function createBaseSpeakersChanged(): SpeakersChanged {
2145
- return { speakers: [] };
2146
- }
2147
-
2148
- export const SpeakersChanged = {
2149
- encode(
2150
- message: SpeakersChanged,
2151
- writer: _m0.Writer = _m0.Writer.create()
2152
- ): _m0.Writer {
2153
- for (const v of message.speakers) {
2154
- SpeakerInfo.encode(v!, writer.uint32(10).fork()).ldelim();
2155
- }
2156
- return writer;
2157
- },
2158
-
2159
- decode(input: _m0.Reader | Uint8Array, length?: number): SpeakersChanged {
2160
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2161
- let end = length === undefined ? reader.len : reader.pos + length;
2162
- const message = createBaseSpeakersChanged();
2163
- while (reader.pos < end) {
2164
- const tag = reader.uint32();
2165
- switch (tag >>> 3) {
2166
- case 1:
2167
- message.speakers.push(SpeakerInfo.decode(reader, reader.uint32()));
2168
- break;
2169
- default:
2170
- reader.skipType(tag & 7);
2171
- break;
2172
- }
2173
- }
2174
- return message;
2175
- },
2176
-
2177
- fromJSON(object: any): SpeakersChanged {
2178
- return {
2179
- speakers: Array.isArray(object?.speakers)
2180
- ? object.speakers.map((e: any) => SpeakerInfo.fromJSON(e))
2181
- : [],
2182
- };
2183
- },
2184
-
2185
- toJSON(message: SpeakersChanged): unknown {
2186
- const obj: any = {};
2187
- if (message.speakers) {
2188
- obj.speakers = message.speakers.map((e) =>
2189
- e ? SpeakerInfo.toJSON(e) : undefined
2190
- );
2191
- } else {
2192
- obj.speakers = [];
2193
- }
2194
- return obj;
2195
- },
2196
-
2197
- fromPartial<I extends Exact<DeepPartial<SpeakersChanged>, I>>(
2198
- object: I
2199
- ): SpeakersChanged {
2200
- const message = createBaseSpeakersChanged();
2201
- message.speakers =
2202
- object.speakers?.map((e) => SpeakerInfo.fromPartial(e)) || [];
2203
- return message;
2204
- },
2205
- };
2206
-
2207
- function createBaseRoomUpdate(): RoomUpdate {
2208
- return { room: undefined };
2209
- }
2210
-
2211
- export const RoomUpdate = {
2212
- encode(
2213
- message: RoomUpdate,
2214
- writer: _m0.Writer = _m0.Writer.create()
2215
- ): _m0.Writer {
2216
- if (message.room !== undefined) {
2217
- Room.encode(message.room, writer.uint32(10).fork()).ldelim();
2218
- }
2219
- return writer;
2220
- },
2221
-
2222
- decode(input: _m0.Reader | Uint8Array, length?: number): RoomUpdate {
2223
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2224
- let end = length === undefined ? reader.len : reader.pos + length;
2225
- const message = createBaseRoomUpdate();
2226
- while (reader.pos < end) {
2227
- const tag = reader.uint32();
2228
- switch (tag >>> 3) {
2229
- case 1:
2230
- message.room = Room.decode(reader, reader.uint32());
2231
- break;
2232
- default:
2233
- reader.skipType(tag & 7);
2234
- break;
2235
- }
2236
- }
2237
- return message;
2238
- },
2239
-
2240
- fromJSON(object: any): RoomUpdate {
2241
- return {
2242
- room: isSet(object.room) ? Room.fromJSON(object.room) : undefined,
2243
- };
2244
- },
2245
-
2246
- toJSON(message: RoomUpdate): unknown {
2247
- const obj: any = {};
2248
- message.room !== undefined &&
2249
- (obj.room = message.room ? Room.toJSON(message.room) : undefined);
2250
- return obj;
2251
- },
2252
-
2253
- fromPartial<I extends Exact<DeepPartial<RoomUpdate>, I>>(
2254
- object: I
2255
- ): RoomUpdate {
2256
- const message = createBaseRoomUpdate();
2257
- message.room =
2258
- object.room !== undefined && object.room !== null
2259
- ? Room.fromPartial(object.room)
2260
- : undefined;
2261
- return message;
2262
- },
2263
- };
2264
-
2265
- function createBaseConnectionQualityInfo(): ConnectionQualityInfo {
2266
- return { participantSid: "", quality: 0, score: 0 };
2267
- }
2268
-
2269
- export const ConnectionQualityInfo = {
2270
- encode(
2271
- message: ConnectionQualityInfo,
2272
- writer: _m0.Writer = _m0.Writer.create()
2273
- ): _m0.Writer {
2274
- if (message.participantSid !== "") {
2275
- writer.uint32(10).string(message.participantSid);
2276
- }
2277
- if (message.quality !== 0) {
2278
- writer.uint32(16).int32(message.quality);
2279
- }
2280
- if (message.score !== 0) {
2281
- writer.uint32(29).float(message.score);
2282
- }
2283
- return writer;
2284
- },
2285
-
2286
- decode(
2287
- input: _m0.Reader | Uint8Array,
2288
- length?: number
2289
- ): ConnectionQualityInfo {
2290
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2291
- let end = length === undefined ? reader.len : reader.pos + length;
2292
- const message = createBaseConnectionQualityInfo();
2293
- while (reader.pos < end) {
2294
- const tag = reader.uint32();
2295
- switch (tag >>> 3) {
2296
- case 1:
2297
- message.participantSid = reader.string();
2298
- break;
2299
- case 2:
2300
- message.quality = reader.int32() as any;
2301
- break;
2302
- case 3:
2303
- message.score = reader.float();
2304
- break;
2305
- default:
2306
- reader.skipType(tag & 7);
2307
- break;
2308
- }
2309
- }
2310
- return message;
2311
- },
2312
-
2313
- fromJSON(object: any): ConnectionQualityInfo {
2314
- return {
2315
- participantSid: isSet(object.participantSid)
2316
- ? String(object.participantSid)
2317
- : "",
2318
- quality: isSet(object.quality)
2319
- ? connectionQualityFromJSON(object.quality)
2320
- : 0,
2321
- score: isSet(object.score) ? Number(object.score) : 0,
2322
- };
2323
- },
2324
-
2325
- toJSON(message: ConnectionQualityInfo): unknown {
2326
- const obj: any = {};
2327
- message.participantSid !== undefined &&
2328
- (obj.participantSid = message.participantSid);
2329
- message.quality !== undefined &&
2330
- (obj.quality = connectionQualityToJSON(message.quality));
2331
- message.score !== undefined && (obj.score = message.score);
2332
- return obj;
2333
- },
2334
-
2335
- fromPartial<I extends Exact<DeepPartial<ConnectionQualityInfo>, I>>(
2336
- object: I
2337
- ): ConnectionQualityInfo {
2338
- const message = createBaseConnectionQualityInfo();
2339
- message.participantSid = object.participantSid ?? "";
2340
- message.quality = object.quality ?? 0;
2341
- message.score = object.score ?? 0;
2342
- return message;
2343
- },
2344
- };
2345
-
2346
- function createBaseConnectionQualityUpdate(): ConnectionQualityUpdate {
2347
- return { updates: [] };
2348
- }
2349
-
2350
- export const ConnectionQualityUpdate = {
2351
- encode(
2352
- message: ConnectionQualityUpdate,
2353
- writer: _m0.Writer = _m0.Writer.create()
2354
- ): _m0.Writer {
2355
- for (const v of message.updates) {
2356
- ConnectionQualityInfo.encode(v!, writer.uint32(10).fork()).ldelim();
2357
- }
2358
- return writer;
2359
- },
2360
-
2361
- decode(
2362
- input: _m0.Reader | Uint8Array,
2363
- length?: number
2364
- ): ConnectionQualityUpdate {
2365
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2366
- let end = length === undefined ? reader.len : reader.pos + length;
2367
- const message = createBaseConnectionQualityUpdate();
2368
- while (reader.pos < end) {
2369
- const tag = reader.uint32();
2370
- switch (tag >>> 3) {
2371
- case 1:
2372
- message.updates.push(
2373
- ConnectionQualityInfo.decode(reader, reader.uint32())
2374
- );
2375
- break;
2376
- default:
2377
- reader.skipType(tag & 7);
2378
- break;
2379
- }
2380
- }
2381
- return message;
2382
- },
2383
-
2384
- fromJSON(object: any): ConnectionQualityUpdate {
2385
- return {
2386
- updates: Array.isArray(object?.updates)
2387
- ? object.updates.map((e: any) => ConnectionQualityInfo.fromJSON(e))
2388
- : [],
2389
- };
2390
- },
2391
-
2392
- toJSON(message: ConnectionQualityUpdate): unknown {
2393
- const obj: any = {};
2394
- if (message.updates) {
2395
- obj.updates = message.updates.map((e) =>
2396
- e ? ConnectionQualityInfo.toJSON(e) : undefined
2397
- );
2398
- } else {
2399
- obj.updates = [];
2400
- }
2401
- return obj;
2402
- },
2403
-
2404
- fromPartial<I extends Exact<DeepPartial<ConnectionQualityUpdate>, I>>(
2405
- object: I
2406
- ): ConnectionQualityUpdate {
2407
- const message = createBaseConnectionQualityUpdate();
2408
- message.updates =
2409
- object.updates?.map((e) => ConnectionQualityInfo.fromPartial(e)) || [];
2410
- return message;
2411
- },
2412
- };
2413
-
2414
- function createBaseStreamStateInfo(): StreamStateInfo {
2415
- return { participantSid: "", trackSid: "", state: 0 };
2416
- }
2417
-
2418
- export const StreamStateInfo = {
2419
- encode(
2420
- message: StreamStateInfo,
2421
- writer: _m0.Writer = _m0.Writer.create()
2422
- ): _m0.Writer {
2423
- if (message.participantSid !== "") {
2424
- writer.uint32(10).string(message.participantSid);
2425
- }
2426
- if (message.trackSid !== "") {
2427
- writer.uint32(18).string(message.trackSid);
2428
- }
2429
- if (message.state !== 0) {
2430
- writer.uint32(24).int32(message.state);
2431
- }
2432
- return writer;
2433
- },
2434
-
2435
- decode(input: _m0.Reader | Uint8Array, length?: number): StreamStateInfo {
2436
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2437
- let end = length === undefined ? reader.len : reader.pos + length;
2438
- const message = createBaseStreamStateInfo();
2439
- while (reader.pos < end) {
2440
- const tag = reader.uint32();
2441
- switch (tag >>> 3) {
2442
- case 1:
2443
- message.participantSid = reader.string();
2444
- break;
2445
- case 2:
2446
- message.trackSid = reader.string();
2447
- break;
2448
- case 3:
2449
- message.state = reader.int32() as any;
2450
- break;
2451
- default:
2452
- reader.skipType(tag & 7);
2453
- break;
2454
- }
2455
- }
2456
- return message;
2457
- },
2458
-
2459
- fromJSON(object: any): StreamStateInfo {
2460
- return {
2461
- participantSid: isSet(object.participantSid)
2462
- ? String(object.participantSid)
2463
- : "",
2464
- trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2465
- state: isSet(object.state) ? streamStateFromJSON(object.state) : 0,
2466
- };
2467
- },
2468
-
2469
- toJSON(message: StreamStateInfo): unknown {
2470
- const obj: any = {};
2471
- message.participantSid !== undefined &&
2472
- (obj.participantSid = message.participantSid);
2473
- message.trackSid !== undefined && (obj.trackSid = message.trackSid);
2474
- message.state !== undefined &&
2475
- (obj.state = streamStateToJSON(message.state));
2476
- return obj;
2477
- },
2478
-
2479
- fromPartial<I extends Exact<DeepPartial<StreamStateInfo>, I>>(
2480
- object: I
2481
- ): StreamStateInfo {
2482
- const message = createBaseStreamStateInfo();
2483
- message.participantSid = object.participantSid ?? "";
2484
- message.trackSid = object.trackSid ?? "";
2485
- message.state = object.state ?? 0;
2486
- return message;
2487
- },
2488
- };
2489
-
2490
- function createBaseStreamStateUpdate(): StreamStateUpdate {
2491
- return { streamStates: [] };
2492
- }
2493
-
2494
- export const StreamStateUpdate = {
2495
- encode(
2496
- message: StreamStateUpdate,
2497
- writer: _m0.Writer = _m0.Writer.create()
2498
- ): _m0.Writer {
2499
- for (const v of message.streamStates) {
2500
- StreamStateInfo.encode(v!, writer.uint32(10).fork()).ldelim();
2501
- }
2502
- return writer;
2503
- },
2504
-
2505
- decode(input: _m0.Reader | Uint8Array, length?: number): StreamStateUpdate {
2506
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2507
- let end = length === undefined ? reader.len : reader.pos + length;
2508
- const message = createBaseStreamStateUpdate();
2509
- while (reader.pos < end) {
2510
- const tag = reader.uint32();
2511
- switch (tag >>> 3) {
2512
- case 1:
2513
- message.streamStates.push(
2514
- StreamStateInfo.decode(reader, reader.uint32())
2515
- );
2516
- break;
2517
- default:
2518
- reader.skipType(tag & 7);
2519
- break;
2520
- }
2521
- }
2522
- return message;
2523
- },
2524
-
2525
- fromJSON(object: any): StreamStateUpdate {
2526
- return {
2527
- streamStates: Array.isArray(object?.streamStates)
2528
- ? object.streamStates.map((e: any) => StreamStateInfo.fromJSON(e))
2529
- : [],
2530
- };
2531
- },
2532
-
2533
- toJSON(message: StreamStateUpdate): unknown {
2534
- const obj: any = {};
2535
- if (message.streamStates) {
2536
- obj.streamStates = message.streamStates.map((e) =>
2537
- e ? StreamStateInfo.toJSON(e) : undefined
2538
- );
2539
- } else {
2540
- obj.streamStates = [];
2541
- }
2542
- return obj;
2543
- },
2544
-
2545
- fromPartial<I extends Exact<DeepPartial<StreamStateUpdate>, I>>(
2546
- object: I
2547
- ): StreamStateUpdate {
2548
- const message = createBaseStreamStateUpdate();
2549
- message.streamStates =
2550
- object.streamStates?.map((e) => StreamStateInfo.fromPartial(e)) || [];
2551
- return message;
2552
- },
2553
- };
2554
-
2555
- function createBaseSubscribedQuality(): SubscribedQuality {
2556
- return { quality: 0, enabled: false };
2557
- }
2558
-
2559
- export const SubscribedQuality = {
2560
- encode(
2561
- message: SubscribedQuality,
2562
- writer: _m0.Writer = _m0.Writer.create()
2563
- ): _m0.Writer {
2564
- if (message.quality !== 0) {
2565
- writer.uint32(8).int32(message.quality);
2566
- }
2567
- if (message.enabled === true) {
2568
- writer.uint32(16).bool(message.enabled);
2569
- }
2570
- return writer;
2571
- },
2572
-
2573
- decode(input: _m0.Reader | Uint8Array, length?: number): SubscribedQuality {
2574
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2575
- let end = length === undefined ? reader.len : reader.pos + length;
2576
- const message = createBaseSubscribedQuality();
2577
- while (reader.pos < end) {
2578
- const tag = reader.uint32();
2579
- switch (tag >>> 3) {
2580
- case 1:
2581
- message.quality = reader.int32() as any;
2582
- break;
2583
- case 2:
2584
- message.enabled = reader.bool();
2585
- break;
2586
- default:
2587
- reader.skipType(tag & 7);
2588
- break;
2589
- }
2590
- }
2591
- return message;
2592
- },
2593
-
2594
- fromJSON(object: any): SubscribedQuality {
2595
- return {
2596
- quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
2597
- enabled: isSet(object.enabled) ? Boolean(object.enabled) : false,
2598
- };
2599
- },
2600
-
2601
- toJSON(message: SubscribedQuality): unknown {
2602
- const obj: any = {};
2603
- message.quality !== undefined &&
2604
- (obj.quality = videoQualityToJSON(message.quality));
2605
- message.enabled !== undefined && (obj.enabled = message.enabled);
2606
- return obj;
2607
- },
2608
-
2609
- fromPartial<I extends Exact<DeepPartial<SubscribedQuality>, I>>(
2610
- object: I
2611
- ): SubscribedQuality {
2612
- const message = createBaseSubscribedQuality();
2613
- message.quality = object.quality ?? 0;
2614
- message.enabled = object.enabled ?? false;
2615
- return message;
2616
- },
2617
- };
2618
-
2619
- function createBaseSubscribedQualityUpdate(): SubscribedQualityUpdate {
2620
- return { trackSid: "", subscribedQualities: [] };
2621
- }
2622
-
2623
- export const SubscribedQualityUpdate = {
2624
- encode(
2625
- message: SubscribedQualityUpdate,
2626
- writer: _m0.Writer = _m0.Writer.create()
2627
- ): _m0.Writer {
2628
- if (message.trackSid !== "") {
2629
- writer.uint32(10).string(message.trackSid);
2630
- }
2631
- for (const v of message.subscribedQualities) {
2632
- SubscribedQuality.encode(v!, writer.uint32(18).fork()).ldelim();
2633
- }
2634
- return writer;
2635
- },
2636
-
2637
- decode(
2638
- input: _m0.Reader | Uint8Array,
2639
- length?: number
2640
- ): SubscribedQualityUpdate {
2641
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2642
- let end = length === undefined ? reader.len : reader.pos + length;
2643
- const message = createBaseSubscribedQualityUpdate();
2644
- while (reader.pos < end) {
2645
- const tag = reader.uint32();
2646
- switch (tag >>> 3) {
2647
- case 1:
2648
- message.trackSid = reader.string();
2649
- break;
2650
- case 2:
2651
- message.subscribedQualities.push(
2652
- SubscribedQuality.decode(reader, reader.uint32())
2653
- );
2654
- break;
2655
- default:
2656
- reader.skipType(tag & 7);
2657
- break;
2658
- }
2659
- }
2660
- return message;
2661
- },
2662
-
2663
- fromJSON(object: any): SubscribedQualityUpdate {
2664
- return {
2665
- trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2666
- subscribedQualities: Array.isArray(object?.subscribedQualities)
2667
- ? object.subscribedQualities.map((e: any) =>
2668
- SubscribedQuality.fromJSON(e)
2669
- )
2670
- : [],
2671
- };
2672
- },
2673
-
2674
- toJSON(message: SubscribedQualityUpdate): unknown {
2675
- const obj: any = {};
2676
- message.trackSid !== undefined && (obj.trackSid = message.trackSid);
2677
- if (message.subscribedQualities) {
2678
- obj.subscribedQualities = message.subscribedQualities.map((e) =>
2679
- e ? SubscribedQuality.toJSON(e) : undefined
2680
- );
2681
- } else {
2682
- obj.subscribedQualities = [];
2683
- }
2684
- return obj;
2685
- },
2686
-
2687
- fromPartial<I extends Exact<DeepPartial<SubscribedQualityUpdate>, I>>(
2688
- object: I
2689
- ): SubscribedQualityUpdate {
2690
- const message = createBaseSubscribedQualityUpdate();
2691
- message.trackSid = object.trackSid ?? "";
2692
- message.subscribedQualities =
2693
- object.subscribedQualities?.map((e) =>
2694
- SubscribedQuality.fromPartial(e)
2695
- ) || [];
2696
- return message;
2697
- },
2698
- };
2699
-
2700
- function createBaseTrackPermission(): TrackPermission {
2701
- return { participantSid: "", allTracks: false, trackSids: [] };
2702
- }
2703
-
2704
- export const TrackPermission = {
2705
- encode(
2706
- message: TrackPermission,
2707
- writer: _m0.Writer = _m0.Writer.create()
2708
- ): _m0.Writer {
2709
- if (message.participantSid !== "") {
2710
- writer.uint32(10).string(message.participantSid);
2711
- }
2712
- if (message.allTracks === true) {
2713
- writer.uint32(16).bool(message.allTracks);
2714
- }
2715
- for (const v of message.trackSids) {
2716
- writer.uint32(26).string(v!);
2717
- }
2718
- return writer;
2719
- },
2720
-
2721
- decode(input: _m0.Reader | Uint8Array, length?: number): TrackPermission {
2722
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2723
- let end = length === undefined ? reader.len : reader.pos + length;
2724
- const message = createBaseTrackPermission();
2725
- while (reader.pos < end) {
2726
- const tag = reader.uint32();
2727
- switch (tag >>> 3) {
2728
- case 1:
2729
- message.participantSid = reader.string();
2730
- break;
2731
- case 2:
2732
- message.allTracks = reader.bool();
2733
- break;
2734
- case 3:
2735
- message.trackSids.push(reader.string());
2736
- break;
2737
- default:
2738
- reader.skipType(tag & 7);
2739
- break;
2740
- }
2741
- }
2742
- return message;
2743
- },
2744
-
2745
- fromJSON(object: any): TrackPermission {
2746
- return {
2747
- participantSid: isSet(object.participantSid)
2748
- ? String(object.participantSid)
2749
- : "",
2750
- allTracks: isSet(object.allTracks) ? Boolean(object.allTracks) : false,
2751
- trackSids: Array.isArray(object?.trackSids)
2752
- ? object.trackSids.map((e: any) => String(e))
2753
- : [],
2754
- };
2755
- },
2756
-
2757
- toJSON(message: TrackPermission): unknown {
2758
- const obj: any = {};
2759
- message.participantSid !== undefined &&
2760
- (obj.participantSid = message.participantSid);
2761
- message.allTracks !== undefined && (obj.allTracks = message.allTracks);
2762
- if (message.trackSids) {
2763
- obj.trackSids = message.trackSids.map((e) => e);
2764
- } else {
2765
- obj.trackSids = [];
2766
- }
2767
- return obj;
2768
- },
2769
-
2770
- fromPartial<I extends Exact<DeepPartial<TrackPermission>, I>>(
2771
- object: I
2772
- ): TrackPermission {
2773
- const message = createBaseTrackPermission();
2774
- message.participantSid = object.participantSid ?? "";
2775
- message.allTracks = object.allTracks ?? false;
2776
- message.trackSids = object.trackSids?.map((e) => e) || [];
2777
- return message;
2778
- },
2779
- };
2780
-
2781
- function createBaseSubscriptionPermission(): SubscriptionPermission {
2782
- return { allParticipants: false, trackPermissions: [] };
2783
- }
2784
-
2785
- export const SubscriptionPermission = {
2786
- encode(
2787
- message: SubscriptionPermission,
2788
- writer: _m0.Writer = _m0.Writer.create()
2789
- ): _m0.Writer {
2790
- if (message.allParticipants === true) {
2791
- writer.uint32(8).bool(message.allParticipants);
2792
- }
2793
- for (const v of message.trackPermissions) {
2794
- TrackPermission.encode(v!, writer.uint32(18).fork()).ldelim();
2795
- }
2796
- return writer;
2797
- },
2798
-
2799
- decode(
2800
- input: _m0.Reader | Uint8Array,
2801
- length?: number
2802
- ): SubscriptionPermission {
2803
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2804
- let end = length === undefined ? reader.len : reader.pos + length;
2805
- const message = createBaseSubscriptionPermission();
2806
- while (reader.pos < end) {
2807
- const tag = reader.uint32();
2808
- switch (tag >>> 3) {
2809
- case 1:
2810
- message.allParticipants = reader.bool();
2811
- break;
2812
- case 2:
2813
- message.trackPermissions.push(
2814
- TrackPermission.decode(reader, reader.uint32())
2815
- );
2816
- break;
2817
- default:
2818
- reader.skipType(tag & 7);
2819
- break;
2820
- }
2821
- }
2822
- return message;
2823
- },
2824
-
2825
- fromJSON(object: any): SubscriptionPermission {
2826
- return {
2827
- allParticipants: isSet(object.allParticipants)
2828
- ? Boolean(object.allParticipants)
2829
- : false,
2830
- trackPermissions: Array.isArray(object?.trackPermissions)
2831
- ? object.trackPermissions.map((e: any) => TrackPermission.fromJSON(e))
2832
- : [],
2833
- };
2834
- },
2835
-
2836
- toJSON(message: SubscriptionPermission): unknown {
2837
- const obj: any = {};
2838
- message.allParticipants !== undefined &&
2839
- (obj.allParticipants = message.allParticipants);
2840
- if (message.trackPermissions) {
2841
- obj.trackPermissions = message.trackPermissions.map((e) =>
2842
- e ? TrackPermission.toJSON(e) : undefined
2843
- );
2844
- } else {
2845
- obj.trackPermissions = [];
2846
- }
2847
- return obj;
2848
- },
2849
-
2850
- fromPartial<I extends Exact<DeepPartial<SubscriptionPermission>, I>>(
2851
- object: I
2852
- ): SubscriptionPermission {
2853
- const message = createBaseSubscriptionPermission();
2854
- message.allParticipants = object.allParticipants ?? false;
2855
- message.trackPermissions =
2856
- object.trackPermissions?.map((e) => TrackPermission.fromPartial(e)) || [];
2857
- return message;
2858
- },
2859
- };
2860
-
2861
- function createBaseSubscriptionPermissionUpdate(): SubscriptionPermissionUpdate {
2862
- return { participantSid: "", trackSid: "", allowed: false };
2863
- }
2864
-
2865
- export const SubscriptionPermissionUpdate = {
2866
- encode(
2867
- message: SubscriptionPermissionUpdate,
2868
- writer: _m0.Writer = _m0.Writer.create()
2869
- ): _m0.Writer {
2870
- if (message.participantSid !== "") {
2871
- writer.uint32(10).string(message.participantSid);
2872
- }
2873
- if (message.trackSid !== "") {
2874
- writer.uint32(18).string(message.trackSid);
2875
- }
2876
- if (message.allowed === true) {
2877
- writer.uint32(24).bool(message.allowed);
2878
- }
2879
- return writer;
2880
- },
2881
-
2882
- decode(
2883
- input: _m0.Reader | Uint8Array,
2884
- length?: number
2885
- ): SubscriptionPermissionUpdate {
2886
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2887
- let end = length === undefined ? reader.len : reader.pos + length;
2888
- const message = createBaseSubscriptionPermissionUpdate();
2889
- while (reader.pos < end) {
2890
- const tag = reader.uint32();
2891
- switch (tag >>> 3) {
2892
- case 1:
2893
- message.participantSid = reader.string();
2894
- break;
2895
- case 2:
2896
- message.trackSid = reader.string();
2897
- break;
2898
- case 3:
2899
- message.allowed = reader.bool();
2900
- break;
2901
- default:
2902
- reader.skipType(tag & 7);
2903
- break;
2904
- }
2905
- }
2906
- return message;
2907
- },
2908
-
2909
- fromJSON(object: any): SubscriptionPermissionUpdate {
2910
- return {
2911
- participantSid: isSet(object.participantSid)
2912
- ? String(object.participantSid)
2913
- : "",
2914
- trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2915
- allowed: isSet(object.allowed) ? Boolean(object.allowed) : false,
2916
- };
2917
- },
2918
-
2919
- toJSON(message: SubscriptionPermissionUpdate): unknown {
2920
- const obj: any = {};
2921
- message.participantSid !== undefined &&
2922
- (obj.participantSid = message.participantSid);
2923
- message.trackSid !== undefined && (obj.trackSid = message.trackSid);
2924
- message.allowed !== undefined && (obj.allowed = message.allowed);
2925
- return obj;
2926
- },
2927
-
2928
- fromPartial<I extends Exact<DeepPartial<SubscriptionPermissionUpdate>, I>>(
2929
- object: I
2930
- ): SubscriptionPermissionUpdate {
2931
- const message = createBaseSubscriptionPermissionUpdate();
2932
- message.participantSid = object.participantSid ?? "";
2933
- message.trackSid = object.trackSid ?? "";
2934
- message.allowed = object.allowed ?? false;
2935
- return message;
2936
- },
2937
- };
2938
-
2939
- function createBaseSyncState(): SyncState {
2940
- return {
2941
- answer: undefined,
2942
- subscription: undefined,
2943
- publishTracks: [],
2944
- dataChannels: [],
2945
- };
2946
- }
2947
-
2948
- export const SyncState = {
2949
- encode(
2950
- message: SyncState,
2951
- writer: _m0.Writer = _m0.Writer.create()
2952
- ): _m0.Writer {
2953
- if (message.answer !== undefined) {
2954
- SessionDescription.encode(
2955
- message.answer,
2956
- writer.uint32(10).fork()
2957
- ).ldelim();
2958
- }
2959
- if (message.subscription !== undefined) {
2960
- UpdateSubscription.encode(
2961
- message.subscription,
2962
- writer.uint32(18).fork()
2963
- ).ldelim();
2964
- }
2965
- for (const v of message.publishTracks) {
2966
- TrackPublishedResponse.encode(v!, writer.uint32(26).fork()).ldelim();
2967
- }
2968
- for (const v of message.dataChannels) {
2969
- DataChannelInfo.encode(v!, writer.uint32(34).fork()).ldelim();
2970
- }
2971
- return writer;
2972
- },
2973
-
2974
- decode(input: _m0.Reader | Uint8Array, length?: number): SyncState {
2975
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2976
- let end = length === undefined ? reader.len : reader.pos + length;
2977
- const message = createBaseSyncState();
2978
- while (reader.pos < end) {
2979
- const tag = reader.uint32();
2980
- switch (tag >>> 3) {
2981
- case 1:
2982
- message.answer = SessionDescription.decode(reader, reader.uint32());
2983
- break;
2984
- case 2:
2985
- message.subscription = UpdateSubscription.decode(
2986
- reader,
2987
- reader.uint32()
2988
- );
2989
- break;
2990
- case 3:
2991
- message.publishTracks.push(
2992
- TrackPublishedResponse.decode(reader, reader.uint32())
2993
- );
2994
- break;
2995
- case 4:
2996
- message.dataChannels.push(
2997
- DataChannelInfo.decode(reader, reader.uint32())
2998
- );
2999
- break;
3000
- default:
3001
- reader.skipType(tag & 7);
3002
- break;
3003
- }
3004
- }
3005
- return message;
3006
- },
3007
-
3008
- fromJSON(object: any): SyncState {
3009
- return {
3010
- answer: isSet(object.answer)
3011
- ? SessionDescription.fromJSON(object.answer)
3012
- : undefined,
3013
- subscription: isSet(object.subscription)
3014
- ? UpdateSubscription.fromJSON(object.subscription)
3015
- : undefined,
3016
- publishTracks: Array.isArray(object?.publishTracks)
3017
- ? object.publishTracks.map((e: any) =>
3018
- TrackPublishedResponse.fromJSON(e)
3019
- )
3020
- : [],
3021
- dataChannels: Array.isArray(object?.dataChannels)
3022
- ? object.dataChannels.map((e: any) => DataChannelInfo.fromJSON(e))
3023
- : [],
3024
- };
3025
- },
3026
-
3027
- toJSON(message: SyncState): unknown {
3028
- const obj: any = {};
3029
- message.answer !== undefined &&
3030
- (obj.answer = message.answer
3031
- ? SessionDescription.toJSON(message.answer)
3032
- : undefined);
3033
- message.subscription !== undefined &&
3034
- (obj.subscription = message.subscription
3035
- ? UpdateSubscription.toJSON(message.subscription)
3036
- : undefined);
3037
- if (message.publishTracks) {
3038
- obj.publishTracks = message.publishTracks.map((e) =>
3039
- e ? TrackPublishedResponse.toJSON(e) : undefined
3040
- );
3041
- } else {
3042
- obj.publishTracks = [];
3043
- }
3044
- if (message.dataChannels) {
3045
- obj.dataChannels = message.dataChannels.map((e) =>
3046
- e ? DataChannelInfo.toJSON(e) : undefined
3047
- );
3048
- } else {
3049
- obj.dataChannels = [];
3050
- }
3051
- return obj;
3052
- },
3053
-
3054
- fromPartial<I extends Exact<DeepPartial<SyncState>, I>>(
3055
- object: I
3056
- ): SyncState {
3057
- const message = createBaseSyncState();
3058
- message.answer =
3059
- object.answer !== undefined && object.answer !== null
3060
- ? SessionDescription.fromPartial(object.answer)
3061
- : undefined;
3062
- message.subscription =
3063
- object.subscription !== undefined && object.subscription !== null
3064
- ? UpdateSubscription.fromPartial(object.subscription)
3065
- : undefined;
3066
- message.publishTracks =
3067
- object.publishTracks?.map((e) => TrackPublishedResponse.fromPartial(e)) ||
3068
- [];
3069
- message.dataChannels =
3070
- object.dataChannels?.map((e) => DataChannelInfo.fromPartial(e)) || [];
3071
- return message;
3072
- },
3073
- };
3074
-
3075
- function createBaseDataChannelInfo(): DataChannelInfo {
3076
- return { label: "", id: 0 };
3077
- }
3078
-
3079
- export const DataChannelInfo = {
3080
- encode(
3081
- message: DataChannelInfo,
3082
- writer: _m0.Writer = _m0.Writer.create()
3083
- ): _m0.Writer {
3084
- if (message.label !== "") {
3085
- writer.uint32(10).string(message.label);
3086
- }
3087
- if (message.id !== 0) {
3088
- writer.uint32(16).uint32(message.id);
3089
- }
3090
- return writer;
3091
- },
3092
-
3093
- decode(input: _m0.Reader | Uint8Array, length?: number): DataChannelInfo {
3094
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3095
- let end = length === undefined ? reader.len : reader.pos + length;
3096
- const message = createBaseDataChannelInfo();
3097
- while (reader.pos < end) {
3098
- const tag = reader.uint32();
3099
- switch (tag >>> 3) {
3100
- case 1:
3101
- message.label = reader.string();
3102
- break;
3103
- case 2:
3104
- message.id = reader.uint32();
3105
- break;
3106
- default:
3107
- reader.skipType(tag & 7);
3108
- break;
3109
- }
3110
- }
3111
- return message;
3112
- },
3113
-
3114
- fromJSON(object: any): DataChannelInfo {
3115
- return {
3116
- label: isSet(object.label) ? String(object.label) : "",
3117
- id: isSet(object.id) ? Number(object.id) : 0,
3118
- };
3119
- },
3120
-
3121
- toJSON(message: DataChannelInfo): unknown {
3122
- const obj: any = {};
3123
- message.label !== undefined && (obj.label = message.label);
3124
- message.id !== undefined && (obj.id = Math.round(message.id));
3125
- return obj;
3126
- },
3127
-
3128
- fromPartial<I extends Exact<DeepPartial<DataChannelInfo>, I>>(
3129
- object: I
3130
- ): DataChannelInfo {
3131
- const message = createBaseDataChannelInfo();
3132
- message.label = object.label ?? "";
3133
- message.id = object.id ?? 0;
3134
- return message;
3135
- },
3136
- };
3137
-
3138
- function createBaseSimulateScenario(): SimulateScenario {
3139
- return {
3140
- speakerUpdate: undefined,
3141
- nodeFailure: undefined,
3142
- migration: undefined,
3143
- serverLeave: undefined,
3144
- };
3145
- }
3146
-
3147
- export const SimulateScenario = {
3148
- encode(
3149
- message: SimulateScenario,
3150
- writer: _m0.Writer = _m0.Writer.create()
3151
- ): _m0.Writer {
3152
- if (message.speakerUpdate !== undefined) {
3153
- writer.uint32(8).int32(message.speakerUpdate);
3154
- }
3155
- if (message.nodeFailure !== undefined) {
3156
- writer.uint32(16).bool(message.nodeFailure);
3157
- }
3158
- if (message.migration !== undefined) {
3159
- writer.uint32(24).bool(message.migration);
3160
- }
3161
- if (message.serverLeave !== undefined) {
3162
- writer.uint32(32).bool(message.serverLeave);
3163
- }
3164
- return writer;
3165
- },
3166
-
3167
- decode(input: _m0.Reader | Uint8Array, length?: number): SimulateScenario {
3168
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3169
- let end = length === undefined ? reader.len : reader.pos + length;
3170
- const message = createBaseSimulateScenario();
3171
- while (reader.pos < end) {
3172
- const tag = reader.uint32();
3173
- switch (tag >>> 3) {
3174
- case 1:
3175
- message.speakerUpdate = reader.int32();
3176
- break;
3177
- case 2:
3178
- message.nodeFailure = reader.bool();
3179
- break;
3180
- case 3:
3181
- message.migration = reader.bool();
3182
- break;
3183
- case 4:
3184
- message.serverLeave = reader.bool();
3185
- break;
3186
- default:
3187
- reader.skipType(tag & 7);
3188
- break;
3189
- }
3190
- }
3191
- return message;
3192
- },
3193
-
3194
- fromJSON(object: any): SimulateScenario {
3195
- return {
3196
- speakerUpdate: isSet(object.speakerUpdate)
3197
- ? Number(object.speakerUpdate)
3198
- : undefined,
3199
- nodeFailure: isSet(object.nodeFailure)
3200
- ? Boolean(object.nodeFailure)
3201
- : undefined,
3202
- migration: isSet(object.migration)
3203
- ? Boolean(object.migration)
3204
- : undefined,
3205
- serverLeave: isSet(object.serverLeave)
3206
- ? Boolean(object.serverLeave)
3207
- : undefined,
3208
- };
3209
- },
3210
-
3211
- toJSON(message: SimulateScenario): unknown {
3212
- const obj: any = {};
3213
- message.speakerUpdate !== undefined &&
3214
- (obj.speakerUpdate = Math.round(message.speakerUpdate));
3215
- message.nodeFailure !== undefined &&
3216
- (obj.nodeFailure = message.nodeFailure);
3217
- message.migration !== undefined && (obj.migration = message.migration);
3218
- message.serverLeave !== undefined &&
3219
- (obj.serverLeave = message.serverLeave);
3220
- return obj;
3221
- },
3222
-
3223
- fromPartial<I extends Exact<DeepPartial<SimulateScenario>, I>>(
3224
- object: I
3225
- ): SimulateScenario {
3226
- const message = createBaseSimulateScenario();
3227
- message.speakerUpdate = object.speakerUpdate ?? undefined;
3228
- message.nodeFailure = object.nodeFailure ?? undefined;
3229
- message.migration = object.migration ?? undefined;
3230
- message.serverLeave = object.serverLeave ?? undefined;
3231
- return message;
3232
- },
3233
- };
3234
-
3235
- type Builtin =
3236
- | Date
3237
- | Function
3238
- | Uint8Array
3239
- | string
3240
- | number
3241
- | boolean
3242
- | undefined;
3243
-
3244
- export type DeepPartial<T> = T extends Builtin
3245
- ? T
3246
- : T extends Array<infer U>
3247
- ? Array<DeepPartial<U>>
3248
- : T extends ReadonlyArray<infer U>
3249
- ? ReadonlyArray<DeepPartial<U>>
3250
- : T extends {}
3251
- ? { [K in keyof T]?: DeepPartial<T[K]> }
3252
- : Partial<T>;
3253
-
3254
- type KeysOfUnion<T> = T extends T ? keyof T : never;
3255
- export type Exact<P, I extends P> = P extends Builtin
3256
- ? P
3257
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
3258
- Exclude<keyof I, KeysOfUnion<P>>,
3259
- never
3260
- >;
3261
-
3262
- if (_m0.util.Long !== Long) {
3263
- _m0.util.Long = Long as any;
3264
- _m0.configure();
3265
- }
3266
-
3267
- function isSet(value: any): boolean {
3268
- return value !== null && value !== undefined;
3269
- }