@stream-io/video-client 1.4.8 → 1.5.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +231 -0
  2. package/dist/index.browser.es.js +1976 -1476
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +1974 -1473
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +1976 -1476
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/Call.d.ts +93 -9
  9. package/dist/src/StreamSfuClient.d.ts +72 -56
  10. package/dist/src/StreamVideoClient.d.ts +2 -2
  11. package/dist/src/coordinator/connection/client.d.ts +3 -4
  12. package/dist/src/coordinator/connection/types.d.ts +5 -1
  13. package/dist/src/devices/InputMediaDeviceManager.d.ts +4 -0
  14. package/dist/src/devices/MicrophoneManager.d.ts +1 -1
  15. package/dist/src/events/callEventHandlers.d.ts +1 -3
  16. package/dist/src/events/internal.d.ts +4 -0
  17. package/dist/src/gen/video/sfu/event/events.d.ts +106 -4
  18. package/dist/src/gen/video/sfu/models/models.d.ts +64 -65
  19. package/dist/src/helpers/ensureExhausted.d.ts +1 -0
  20. package/dist/src/helpers/withResolvers.d.ts +14 -0
  21. package/dist/src/logger.d.ts +1 -0
  22. package/dist/src/rpc/createClient.d.ts +2 -0
  23. package/dist/src/rpc/index.d.ts +1 -0
  24. package/dist/src/rpc/retryable.d.ts +23 -0
  25. package/dist/src/rtc/Dispatcher.d.ts +1 -1
  26. package/dist/src/rtc/IceTrickleBuffer.d.ts +0 -1
  27. package/dist/src/rtc/Publisher.d.ts +24 -25
  28. package/dist/src/rtc/Subscriber.d.ts +12 -11
  29. package/dist/src/rtc/helpers/rtcConfiguration.d.ts +2 -0
  30. package/dist/src/rtc/helpers/tracks.d.ts +3 -3
  31. package/dist/src/rtc/signal.d.ts +1 -1
  32. package/dist/src/store/CallState.d.ts +46 -2
  33. package/package.json +5 -5
  34. package/src/Call.ts +618 -563
  35. package/src/StreamSfuClient.ts +277 -246
  36. package/src/StreamVideoClient.ts +15 -16
  37. package/src/__tests__/Call.test.ts +145 -2
  38. package/src/__tests__/StreamVideoClient.api.test.ts +168 -0
  39. package/src/coordinator/connection/client.ts +25 -8
  40. package/src/coordinator/connection/connection.ts +2 -1
  41. package/src/coordinator/connection/types.ts +6 -0
  42. package/src/devices/BrowserPermission.ts +1 -1
  43. package/src/devices/CameraManager.ts +1 -1
  44. package/src/devices/InputMediaDeviceManager.ts +12 -3
  45. package/src/devices/MicrophoneManager.ts +3 -3
  46. package/src/devices/devices.ts +1 -1
  47. package/src/events/__tests__/mutes.test.ts +10 -13
  48. package/src/events/__tests__/participant.test.ts +75 -0
  49. package/src/events/callEventHandlers.ts +4 -7
  50. package/src/events/internal.ts +20 -3
  51. package/src/events/mutes.ts +5 -3
  52. package/src/events/participant.ts +48 -15
  53. package/src/gen/video/sfu/event/events.ts +451 -8
  54. package/src/gen/video/sfu/models/models.ts +211 -204
  55. package/src/helpers/ensureExhausted.ts +5 -0
  56. package/src/helpers/withResolvers.ts +43 -0
  57. package/src/logger.ts +3 -1
  58. package/src/rpc/__tests__/retryable.test.ts +72 -0
  59. package/src/rpc/createClient.ts +21 -0
  60. package/src/rpc/index.ts +1 -0
  61. package/src/rpc/retryable.ts +57 -0
  62. package/src/rtc/Dispatcher.ts +6 -2
  63. package/src/rtc/IceTrickleBuffer.ts +2 -2
  64. package/src/rtc/Publisher.ts +127 -163
  65. package/src/rtc/Subscriber.ts +94 -155
  66. package/src/rtc/__tests__/Publisher.test.ts +18 -95
  67. package/src/rtc/__tests__/Subscriber.test.ts +63 -99
  68. package/src/rtc/__tests__/videoLayers.test.ts +2 -2
  69. package/src/rtc/helpers/rtcConfiguration.ts +11 -0
  70. package/src/rtc/helpers/tracks.ts +27 -7
  71. package/src/rtc/signal.ts +3 -3
  72. package/src/rtc/videoLayers.ts +1 -10
  73. package/src/stats/SfuStatsReporter.ts +1 -0
  74. package/src/store/CallState.ts +109 -2
  75. package/src/store/__tests__/CallState.test.ts +48 -37
  76. package/dist/src/rtc/flows/join.d.ts +0 -20
  77. package/src/rtc/flows/join.ts +0 -65
@@ -248,10 +248,23 @@ export interface SfuEvent {
248
248
  */
249
249
  participantUpdated: ParticipantUpdated;
250
250
  }
251
+ | {
252
+ oneofKind: 'participantMigrationComplete';
253
+ /**
254
+ * ParticipantMigrationComplete is sent when the participant migration is complete
255
+ *
256
+ * @generated from protobuf field: stream.video.sfu.event.ParticipantMigrationComplete participant_migration_complete = 25;
257
+ */
258
+ participantMigrationComplete: ParticipantMigrationComplete;
259
+ }
251
260
  | {
252
261
  oneofKind: undefined;
253
262
  };
254
263
  }
264
+ /**
265
+ * @generated from protobuf message stream.video.sfu.event.ParticipantMigrationComplete
266
+ */
267
+ export interface ParticipantMigrationComplete {}
255
268
  /**
256
269
  * @generated from protobuf message stream.video.sfu.event.PinsChanged
257
270
  */
@@ -325,10 +338,30 @@ export interface SfuRequest {
325
338
  */
326
339
  healthCheckRequest: HealthCheckRequest;
327
340
  }
341
+ | {
342
+ oneofKind: 'leaveCallRequest';
343
+ /**
344
+ * @generated from protobuf field: stream.video.sfu.event.LeaveCallRequest leave_call_request = 3;
345
+ */
346
+ leaveCallRequest: LeaveCallRequest;
347
+ }
328
348
  | {
329
349
  oneofKind: undefined;
330
350
  };
331
351
  }
352
+ /**
353
+ * @generated from protobuf message stream.video.sfu.event.LeaveCallRequest
354
+ */
355
+ export interface LeaveCallRequest {
356
+ /**
357
+ * @generated from protobuf field: string session_id = 1;
358
+ */
359
+ sessionId: string;
360
+ /**
361
+ * @generated from protobuf field: string reason = 2;
362
+ */
363
+ reason: string;
364
+ }
332
365
  /**
333
366
  * @generated from protobuf message stream.video.sfu.event.HealthCheckRequest
334
367
  */
@@ -423,10 +456,10 @@ export interface JoinRequest {
423
456
  */
424
457
  clientDetails?: ClientDetails;
425
458
  /**
426
- * TODO: we should know if this is going to be
427
- * - publishing and subscribing, or just subscribing for future routing
459
+ * Deprecated: use ReconnectDetails instead
428
460
  *
429
- * @generated from protobuf field: stream.video.sfu.event.Migration migration = 5;
461
+ * @deprecated
462
+ * @generated from protobuf field: stream.video.sfu.event.Migration migration = 5 [deprecated = true];
430
463
  */
431
464
  migration?: Migration;
432
465
  /**
@@ -440,9 +473,45 @@ export interface JoinRequest {
440
473
  * cached, the client state is not in sync and hence it must be cleaned up before
441
474
  * proceeding further.
442
475
  *
443
- * @generated from protobuf field: bool fast_reconnect = 6;
476
+ * @deprecated
477
+ * @generated from protobuf field: bool fast_reconnect = 6 [deprecated = true];
444
478
  */
445
479
  fastReconnect: boolean;
480
+ /**
481
+ * @generated from protobuf field: stream.video.sfu.event.ReconnectDetails reconnect_details = 7;
482
+ */
483
+ reconnectDetails?: ReconnectDetails;
484
+ }
485
+ /**
486
+ * @generated from protobuf message stream.video.sfu.event.ReconnectDetails
487
+ */
488
+ export interface ReconnectDetails {
489
+ /**
490
+ * @generated from protobuf field: stream.video.sfu.models.WebsocketReconnectStrategy strategy = 1;
491
+ */
492
+ strategy: WebsocketReconnectStrategy;
493
+ /**
494
+ * @generated from protobuf field: repeated stream.video.sfu.models.TrackInfo announced_tracks = 3;
495
+ */
496
+ announcedTracks: TrackInfo[];
497
+ /**
498
+ * @generated from protobuf field: repeated stream.video.sfu.signal.TrackSubscriptionDetails subscriptions = 4;
499
+ */
500
+ subscriptions: TrackSubscriptionDetails[];
501
+ /**
502
+ * @generated from protobuf field: uint32 reconnect_attempt = 5;
503
+ */
504
+ reconnectAttempt: number;
505
+ /**
506
+ * @generated from protobuf field: string from_sfu_id = 6;
507
+ */
508
+ fromSfuId: string;
509
+ /**
510
+ * only set in case of rejoin
511
+ *
512
+ * @generated from protobuf field: string previous_session_id = 7;
513
+ */
514
+ previousSessionId: string;
446
515
  }
447
516
  /**
448
517
  * @generated from protobuf message stream.video.sfu.event.Migration
@@ -473,6 +542,10 @@ export interface JoinResponse {
473
542
  * @generated from protobuf field: bool reconnected = 2;
474
543
  */
475
544
  reconnected: boolean;
545
+ /**
546
+ * @generated from protobuf field: int32 fast_reconnect_deadline_seconds = 3;
547
+ */
548
+ fastReconnectDeadlineSeconds: number;
476
549
  }
477
550
  /**
478
551
  * ParticipantJoined is fired when a user joins a call
@@ -948,6 +1021,13 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
948
1021
  oneof: 'eventPayload',
949
1022
  T: () => ParticipantUpdated,
950
1023
  },
1024
+ {
1025
+ no: 25,
1026
+ name: 'participant_migration_complete',
1027
+ kind: 'message',
1028
+ oneof: 'eventPayload',
1029
+ T: () => ParticipantMigrationComplete,
1030
+ },
951
1031
  ]);
952
1032
  }
953
1033
  create(value?: PartialMessage<SfuEvent>): SfuEvent {
@@ -1189,6 +1269,18 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
1189
1269
  ),
1190
1270
  };
1191
1271
  break;
1272
+ case /* stream.video.sfu.event.ParticipantMigrationComplete participant_migration_complete */ 25:
1273
+ message.eventPayload = {
1274
+ oneofKind: 'participantMigrationComplete',
1275
+ participantMigrationComplete:
1276
+ ParticipantMigrationComplete.internalBinaryRead(
1277
+ reader,
1278
+ reader.uint32(),
1279
+ options,
1280
+ (message.eventPayload as any).participantMigrationComplete,
1281
+ ),
1282
+ };
1283
+ break;
1192
1284
  default:
1193
1285
  let u = options.readUnknownField;
1194
1286
  if (u === 'throw')
@@ -1353,6 +1445,13 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
1353
1445
  writer.tag(24, WireType.LengthDelimited).fork(),
1354
1446
  options,
1355
1447
  ).join();
1448
+ /* stream.video.sfu.event.ParticipantMigrationComplete participant_migration_complete = 25; */
1449
+ if (message.eventPayload.oneofKind === 'participantMigrationComplete')
1450
+ ParticipantMigrationComplete.internalBinaryWrite(
1451
+ message.eventPayload.participantMigrationComplete,
1452
+ writer.tag(25, WireType.LengthDelimited).fork(),
1453
+ options,
1454
+ ).join();
1356
1455
  let u = options.writeUnknownFields;
1357
1456
  if (u !== false)
1358
1457
  (u == true ? UnknownFieldHandler.onWrite : u)(
@@ -1368,6 +1467,51 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
1368
1467
  */
1369
1468
  export const SfuEvent = new SfuEvent$Type();
1370
1469
  // @generated message type with reflection information, may provide speed optimized methods
1470
+ class ParticipantMigrationComplete$Type extends MessageType<ParticipantMigrationComplete> {
1471
+ constructor() {
1472
+ super('stream.video.sfu.event.ParticipantMigrationComplete', []);
1473
+ }
1474
+ create(
1475
+ value?: PartialMessage<ParticipantMigrationComplete>,
1476
+ ): ParticipantMigrationComplete {
1477
+ const message = globalThis.Object.create(this.messagePrototype!);
1478
+ if (value !== undefined)
1479
+ reflectionMergePartial<ParticipantMigrationComplete>(
1480
+ this,
1481
+ message,
1482
+ value,
1483
+ );
1484
+ return message;
1485
+ }
1486
+ internalBinaryRead(
1487
+ reader: IBinaryReader,
1488
+ length: number,
1489
+ options: BinaryReadOptions,
1490
+ target?: ParticipantMigrationComplete,
1491
+ ): ParticipantMigrationComplete {
1492
+ return target ?? this.create();
1493
+ }
1494
+ internalBinaryWrite(
1495
+ message: ParticipantMigrationComplete,
1496
+ writer: IBinaryWriter,
1497
+ options: BinaryWriteOptions,
1498
+ ): IBinaryWriter {
1499
+ let u = options.writeUnknownFields;
1500
+ if (u !== false)
1501
+ (u == true ? UnknownFieldHandler.onWrite : u)(
1502
+ this.typeName,
1503
+ message,
1504
+ writer,
1505
+ );
1506
+ return writer;
1507
+ }
1508
+ }
1509
+ /**
1510
+ * @generated MessageType for protobuf message stream.video.sfu.event.ParticipantMigrationComplete
1511
+ */
1512
+ export const ParticipantMigrationComplete =
1513
+ new ParticipantMigrationComplete$Type();
1514
+ // @generated message type with reflection information, may provide speed optimized methods
1371
1515
  class PinsChanged$Type extends MessageType<PinsChanged> {
1372
1516
  constructor() {
1373
1517
  super('stream.video.sfu.event.PinsChanged', [
@@ -1721,6 +1865,13 @@ class SfuRequest$Type extends MessageType<SfuRequest> {
1721
1865
  oneof: 'requestPayload',
1722
1866
  T: () => HealthCheckRequest,
1723
1867
  },
1868
+ {
1869
+ no: 3,
1870
+ name: 'leave_call_request',
1871
+ kind: 'message',
1872
+ oneof: 'requestPayload',
1873
+ T: () => LeaveCallRequest,
1874
+ },
1724
1875
  ]);
1725
1876
  }
1726
1877
  create(value?: PartialMessage<SfuRequest>): SfuRequest {
@@ -1763,6 +1914,17 @@ class SfuRequest$Type extends MessageType<SfuRequest> {
1763
1914
  ),
1764
1915
  };
1765
1916
  break;
1917
+ case /* stream.video.sfu.event.LeaveCallRequest leave_call_request */ 3:
1918
+ message.requestPayload = {
1919
+ oneofKind: 'leaveCallRequest',
1920
+ leaveCallRequest: LeaveCallRequest.internalBinaryRead(
1921
+ reader,
1922
+ reader.uint32(),
1923
+ options,
1924
+ (message.requestPayload as any).leaveCallRequest,
1925
+ ),
1926
+ };
1927
+ break;
1766
1928
  default:
1767
1929
  let u = options.readUnknownField;
1768
1930
  if (u === 'throw')
@@ -1801,6 +1963,13 @@ class SfuRequest$Type extends MessageType<SfuRequest> {
1801
1963
  writer.tag(2, WireType.LengthDelimited).fork(),
1802
1964
  options,
1803
1965
  ).join();
1966
+ /* stream.video.sfu.event.LeaveCallRequest leave_call_request = 3; */
1967
+ if (message.requestPayload.oneofKind === 'leaveCallRequest')
1968
+ LeaveCallRequest.internalBinaryWrite(
1969
+ message.requestPayload.leaveCallRequest,
1970
+ writer.tag(3, WireType.LengthDelimited).fork(),
1971
+ options,
1972
+ ).join();
1804
1973
  let u = options.writeUnknownFields;
1805
1974
  if (u !== false)
1806
1975
  (u == true ? UnknownFieldHandler.onWrite : u)(
@@ -1816,6 +1985,83 @@ class SfuRequest$Type extends MessageType<SfuRequest> {
1816
1985
  */
1817
1986
  export const SfuRequest = new SfuRequest$Type();
1818
1987
  // @generated message type with reflection information, may provide speed optimized methods
1988
+ class LeaveCallRequest$Type extends MessageType<LeaveCallRequest> {
1989
+ constructor() {
1990
+ super('stream.video.sfu.event.LeaveCallRequest', [
1991
+ { no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
1992
+ { no: 2, name: 'reason', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
1993
+ ]);
1994
+ }
1995
+ create(value?: PartialMessage<LeaveCallRequest>): LeaveCallRequest {
1996
+ const message = globalThis.Object.create(this.messagePrototype!);
1997
+ message.sessionId = '';
1998
+ message.reason = '';
1999
+ if (value !== undefined)
2000
+ reflectionMergePartial<LeaveCallRequest>(this, message, value);
2001
+ return message;
2002
+ }
2003
+ internalBinaryRead(
2004
+ reader: IBinaryReader,
2005
+ length: number,
2006
+ options: BinaryReadOptions,
2007
+ target?: LeaveCallRequest,
2008
+ ): LeaveCallRequest {
2009
+ let message = target ?? this.create(),
2010
+ end = reader.pos + length;
2011
+ while (reader.pos < end) {
2012
+ let [fieldNo, wireType] = reader.tag();
2013
+ switch (fieldNo) {
2014
+ case /* string session_id */ 1:
2015
+ message.sessionId = reader.string();
2016
+ break;
2017
+ case /* string reason */ 2:
2018
+ message.reason = reader.string();
2019
+ break;
2020
+ default:
2021
+ let u = options.readUnknownField;
2022
+ if (u === 'throw')
2023
+ throw new globalThis.Error(
2024
+ `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`,
2025
+ );
2026
+ let d = reader.skip(wireType);
2027
+ if (u !== false)
2028
+ (u === true ? UnknownFieldHandler.onRead : u)(
2029
+ this.typeName,
2030
+ message,
2031
+ fieldNo,
2032
+ wireType,
2033
+ d,
2034
+ );
2035
+ }
2036
+ }
2037
+ return message;
2038
+ }
2039
+ internalBinaryWrite(
2040
+ message: LeaveCallRequest,
2041
+ writer: IBinaryWriter,
2042
+ options: BinaryWriteOptions,
2043
+ ): IBinaryWriter {
2044
+ /* string session_id = 1; */
2045
+ if (message.sessionId !== '')
2046
+ writer.tag(1, WireType.LengthDelimited).string(message.sessionId);
2047
+ /* string reason = 2; */
2048
+ if (message.reason !== '')
2049
+ writer.tag(2, WireType.LengthDelimited).string(message.reason);
2050
+ let u = options.writeUnknownFields;
2051
+ if (u !== false)
2052
+ (u == true ? UnknownFieldHandler.onWrite : u)(
2053
+ this.typeName,
2054
+ message,
2055
+ writer,
2056
+ );
2057
+ return writer;
2058
+ }
2059
+ }
2060
+ /**
2061
+ * @generated MessageType for protobuf message stream.video.sfu.event.LeaveCallRequest
2062
+ */
2063
+ export const LeaveCallRequest = new LeaveCallRequest$Type();
2064
+ // @generated message type with reflection information, may provide speed optimized methods
1819
2065
  class HealthCheckRequest$Type extends MessageType<HealthCheckRequest> {
1820
2066
  constructor() {
1821
2067
  super('stream.video.sfu.event.HealthCheckRequest', []);
@@ -2195,6 +2441,12 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
2195
2441
  kind: 'scalar',
2196
2442
  T: 8 /*ScalarType.BOOL*/,
2197
2443
  },
2444
+ {
2445
+ no: 7,
2446
+ name: 'reconnect_details',
2447
+ kind: 'message',
2448
+ T: () => ReconnectDetails,
2449
+ },
2198
2450
  ]);
2199
2451
  }
2200
2452
  create(value?: PartialMessage<JoinRequest>): JoinRequest {
@@ -2235,7 +2487,7 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
2235
2487
  message.clientDetails,
2236
2488
  );
2237
2489
  break;
2238
- case /* stream.video.sfu.event.Migration migration */ 5:
2490
+ case /* stream.video.sfu.event.Migration migration = 5 [deprecated = true];*/ 5:
2239
2491
  message.migration = Migration.internalBinaryRead(
2240
2492
  reader,
2241
2493
  reader.uint32(),
@@ -2243,9 +2495,17 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
2243
2495
  message.migration,
2244
2496
  );
2245
2497
  break;
2246
- case /* bool fast_reconnect */ 6:
2498
+ case /* bool fast_reconnect = 6 [deprecated = true];*/ 6:
2247
2499
  message.fastReconnect = reader.bool();
2248
2500
  break;
2501
+ case /* stream.video.sfu.event.ReconnectDetails reconnect_details */ 7:
2502
+ message.reconnectDetails = ReconnectDetails.internalBinaryRead(
2503
+ reader,
2504
+ reader.uint32(),
2505
+ options,
2506
+ message.reconnectDetails,
2507
+ );
2508
+ break;
2249
2509
  default:
2250
2510
  let u = options.readUnknownField;
2251
2511
  if (u === 'throw')
@@ -2286,16 +2546,23 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
2286
2546
  writer.tag(4, WireType.LengthDelimited).fork(),
2287
2547
  options,
2288
2548
  ).join();
2289
- /* stream.video.sfu.event.Migration migration = 5; */
2549
+ /* stream.video.sfu.event.Migration migration = 5 [deprecated = true]; */
2290
2550
  if (message.migration)
2291
2551
  Migration.internalBinaryWrite(
2292
2552
  message.migration,
2293
2553
  writer.tag(5, WireType.LengthDelimited).fork(),
2294
2554
  options,
2295
2555
  ).join();
2296
- /* bool fast_reconnect = 6; */
2556
+ /* bool fast_reconnect = 6 [deprecated = true]; */
2297
2557
  if (message.fastReconnect !== false)
2298
2558
  writer.tag(6, WireType.Varint).bool(message.fastReconnect);
2559
+ /* stream.video.sfu.event.ReconnectDetails reconnect_details = 7; */
2560
+ if (message.reconnectDetails)
2561
+ ReconnectDetails.internalBinaryWrite(
2562
+ message.reconnectDetails,
2563
+ writer.tag(7, WireType.LengthDelimited).fork(),
2564
+ options,
2565
+ ).join();
2299
2566
  let u = options.writeUnknownFields;
2300
2567
  if (u !== false)
2301
2568
  (u == true ? UnknownFieldHandler.onWrite : u)(
@@ -2311,6 +2578,167 @@ class JoinRequest$Type extends MessageType<JoinRequest> {
2311
2578
  */
2312
2579
  export const JoinRequest = new JoinRequest$Type();
2313
2580
  // @generated message type with reflection information, may provide speed optimized methods
2581
+ class ReconnectDetails$Type extends MessageType<ReconnectDetails> {
2582
+ constructor() {
2583
+ super('stream.video.sfu.event.ReconnectDetails', [
2584
+ {
2585
+ no: 1,
2586
+ name: 'strategy',
2587
+ kind: 'enum',
2588
+ T: () => [
2589
+ 'stream.video.sfu.models.WebsocketReconnectStrategy',
2590
+ WebsocketReconnectStrategy,
2591
+ 'WEBSOCKET_RECONNECT_STRATEGY_',
2592
+ ],
2593
+ },
2594
+ {
2595
+ no: 3,
2596
+ name: 'announced_tracks',
2597
+ kind: 'message',
2598
+ repeat: 1 /*RepeatType.PACKED*/,
2599
+ T: () => TrackInfo,
2600
+ },
2601
+ {
2602
+ no: 4,
2603
+ name: 'subscriptions',
2604
+ kind: 'message',
2605
+ repeat: 1 /*RepeatType.PACKED*/,
2606
+ T: () => TrackSubscriptionDetails,
2607
+ },
2608
+ {
2609
+ no: 5,
2610
+ name: 'reconnect_attempt',
2611
+ kind: 'scalar',
2612
+ T: 13 /*ScalarType.UINT32*/,
2613
+ },
2614
+ {
2615
+ no: 6,
2616
+ name: 'from_sfu_id',
2617
+ kind: 'scalar',
2618
+ T: 9 /*ScalarType.STRING*/,
2619
+ },
2620
+ {
2621
+ no: 7,
2622
+ name: 'previous_session_id',
2623
+ kind: 'scalar',
2624
+ T: 9 /*ScalarType.STRING*/,
2625
+ },
2626
+ ]);
2627
+ }
2628
+ create(value?: PartialMessage<ReconnectDetails>): ReconnectDetails {
2629
+ const message = globalThis.Object.create(this.messagePrototype!);
2630
+ message.strategy = 0;
2631
+ message.announcedTracks = [];
2632
+ message.subscriptions = [];
2633
+ message.reconnectAttempt = 0;
2634
+ message.fromSfuId = '';
2635
+ message.previousSessionId = '';
2636
+ if (value !== undefined)
2637
+ reflectionMergePartial<ReconnectDetails>(this, message, value);
2638
+ return message;
2639
+ }
2640
+ internalBinaryRead(
2641
+ reader: IBinaryReader,
2642
+ length: number,
2643
+ options: BinaryReadOptions,
2644
+ target?: ReconnectDetails,
2645
+ ): ReconnectDetails {
2646
+ let message = target ?? this.create(),
2647
+ end = reader.pos + length;
2648
+ while (reader.pos < end) {
2649
+ let [fieldNo, wireType] = reader.tag();
2650
+ switch (fieldNo) {
2651
+ case /* stream.video.sfu.models.WebsocketReconnectStrategy strategy */ 1:
2652
+ message.strategy = reader.int32();
2653
+ break;
2654
+ case /* repeated stream.video.sfu.models.TrackInfo announced_tracks */ 3:
2655
+ message.announcedTracks.push(
2656
+ TrackInfo.internalBinaryRead(reader, reader.uint32(), options),
2657
+ );
2658
+ break;
2659
+ case /* repeated stream.video.sfu.signal.TrackSubscriptionDetails subscriptions */ 4:
2660
+ message.subscriptions.push(
2661
+ TrackSubscriptionDetails.internalBinaryRead(
2662
+ reader,
2663
+ reader.uint32(),
2664
+ options,
2665
+ ),
2666
+ );
2667
+ break;
2668
+ case /* uint32 reconnect_attempt */ 5:
2669
+ message.reconnectAttempt = reader.uint32();
2670
+ break;
2671
+ case /* string from_sfu_id */ 6:
2672
+ message.fromSfuId = reader.string();
2673
+ break;
2674
+ case /* string previous_session_id */ 7:
2675
+ message.previousSessionId = reader.string();
2676
+ break;
2677
+ default:
2678
+ let u = options.readUnknownField;
2679
+ if (u === 'throw')
2680
+ throw new globalThis.Error(
2681
+ `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`,
2682
+ );
2683
+ let d = reader.skip(wireType);
2684
+ if (u !== false)
2685
+ (u === true ? UnknownFieldHandler.onRead : u)(
2686
+ this.typeName,
2687
+ message,
2688
+ fieldNo,
2689
+ wireType,
2690
+ d,
2691
+ );
2692
+ }
2693
+ }
2694
+ return message;
2695
+ }
2696
+ internalBinaryWrite(
2697
+ message: ReconnectDetails,
2698
+ writer: IBinaryWriter,
2699
+ options: BinaryWriteOptions,
2700
+ ): IBinaryWriter {
2701
+ /* stream.video.sfu.models.WebsocketReconnectStrategy strategy = 1; */
2702
+ if (message.strategy !== 0)
2703
+ writer.tag(1, WireType.Varint).int32(message.strategy);
2704
+ /* repeated stream.video.sfu.models.TrackInfo announced_tracks = 3; */
2705
+ for (let i = 0; i < message.announcedTracks.length; i++)
2706
+ TrackInfo.internalBinaryWrite(
2707
+ message.announcedTracks[i],
2708
+ writer.tag(3, WireType.LengthDelimited).fork(),
2709
+ options,
2710
+ ).join();
2711
+ /* repeated stream.video.sfu.signal.TrackSubscriptionDetails subscriptions = 4; */
2712
+ for (let i = 0; i < message.subscriptions.length; i++)
2713
+ TrackSubscriptionDetails.internalBinaryWrite(
2714
+ message.subscriptions[i],
2715
+ writer.tag(4, WireType.LengthDelimited).fork(),
2716
+ options,
2717
+ ).join();
2718
+ /* uint32 reconnect_attempt = 5; */
2719
+ if (message.reconnectAttempt !== 0)
2720
+ writer.tag(5, WireType.Varint).uint32(message.reconnectAttempt);
2721
+ /* string from_sfu_id = 6; */
2722
+ if (message.fromSfuId !== '')
2723
+ writer.tag(6, WireType.LengthDelimited).string(message.fromSfuId);
2724
+ /* string previous_session_id = 7; */
2725
+ if (message.previousSessionId !== '')
2726
+ writer.tag(7, WireType.LengthDelimited).string(message.previousSessionId);
2727
+ let u = options.writeUnknownFields;
2728
+ if (u !== false)
2729
+ (u == true ? UnknownFieldHandler.onWrite : u)(
2730
+ this.typeName,
2731
+ message,
2732
+ writer,
2733
+ );
2734
+ return writer;
2735
+ }
2736
+ }
2737
+ /**
2738
+ * @generated MessageType for protobuf message stream.video.sfu.event.ReconnectDetails
2739
+ */
2740
+ export const ReconnectDetails = new ReconnectDetails$Type();
2741
+ // @generated message type with reflection information, may provide speed optimized methods
2314
2742
  class Migration$Type extends MessageType<Migration> {
2315
2743
  constructor() {
2316
2744
  super('stream.video.sfu.event.Migration', [
@@ -2434,11 +2862,18 @@ class JoinResponse$Type extends MessageType<JoinResponse> {
2434
2862
  super('stream.video.sfu.event.JoinResponse', [
2435
2863
  { no: 1, name: 'call_state', kind: 'message', T: () => CallState },
2436
2864
  { no: 2, name: 'reconnected', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
2865
+ {
2866
+ no: 3,
2867
+ name: 'fast_reconnect_deadline_seconds',
2868
+ kind: 'scalar',
2869
+ T: 5 /*ScalarType.INT32*/,
2870
+ },
2437
2871
  ]);
2438
2872
  }
2439
2873
  create(value?: PartialMessage<JoinResponse>): JoinResponse {
2440
2874
  const message = globalThis.Object.create(this.messagePrototype!);
2441
2875
  message.reconnected = false;
2876
+ message.fastReconnectDeadlineSeconds = 0;
2442
2877
  if (value !== undefined)
2443
2878
  reflectionMergePartial<JoinResponse>(this, message, value);
2444
2879
  return message;
@@ -2465,6 +2900,9 @@ class JoinResponse$Type extends MessageType<JoinResponse> {
2465
2900
  case /* bool reconnected */ 2:
2466
2901
  message.reconnected = reader.bool();
2467
2902
  break;
2903
+ case /* int32 fast_reconnect_deadline_seconds */ 3:
2904
+ message.fastReconnectDeadlineSeconds = reader.int32();
2905
+ break;
2468
2906
  default:
2469
2907
  let u = options.readUnknownField;
2470
2908
  if (u === 'throw')
@@ -2499,6 +2937,11 @@ class JoinResponse$Type extends MessageType<JoinResponse> {
2499
2937
  /* bool reconnected = 2; */
2500
2938
  if (message.reconnected !== false)
2501
2939
  writer.tag(2, WireType.Varint).bool(message.reconnected);
2940
+ /* int32 fast_reconnect_deadline_seconds = 3; */
2941
+ if (message.fastReconnectDeadlineSeconds !== 0)
2942
+ writer
2943
+ .tag(3, WireType.Varint)
2944
+ .int32(message.fastReconnectDeadlineSeconds);
2502
2945
  let u = options.writeUnknownFields;
2503
2946
  if (u !== false)
2504
2947
  (u == true ? UnknownFieldHandler.onWrite : u)(