livekit-client 1.2.9 → 1.2.10

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 (31) hide show
  1. package/dist/livekit-client.esm.mjs +1065 -454
  2. package/dist/livekit-client.esm.mjs.map +1 -1
  3. package/dist/livekit-client.umd.js +1 -1
  4. package/dist/livekit-client.umd.js.map +1 -1
  5. package/dist/src/api/SignalClient.d.ts +11 -1
  6. package/dist/src/api/SignalClient.d.ts.map +1 -1
  7. package/dist/src/proto/google/protobuf/timestamp.d.ts +8 -2
  8. package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -1
  9. package/dist/src/proto/livekit_models.d.ts +106 -47
  10. package/dist/src/proto/livekit_models.d.ts.map +1 -1
  11. package/dist/src/proto/livekit_rtc.d.ts +3012 -2132
  12. package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
  13. package/dist/src/room/Room.d.ts.map +1 -1
  14. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  15. package/dist/src/room/participant/Participant.d.ts +1 -1
  16. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  17. package/dist/src/room/participant/RemoteParticipant.d.ts +1 -1
  18. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  19. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  20. package/package.json +3 -3
  21. package/src/api/SignalClient.ts +148 -41
  22. package/src/proto/google/protobuf/timestamp.ts +3 -1
  23. package/src/proto/livekit_models.ts +132 -36
  24. package/src/proto/livekit_rtc.ts +822 -459
  25. package/src/room/RTCEngine.ts +5 -5
  26. package/src/room/Room.ts +22 -6
  27. package/src/room/participant/LocalParticipant.ts +7 -4
  28. package/src/room/participant/Participant.ts +2 -1
  29. package/src/room/participant/RemoteParticipant.ts +3 -3
  30. package/src/room/participant/publishUtils.test.ts +12 -0
  31. package/src/room/participant/publishUtils.ts +21 -19
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable */
2
- import Long from 'long';
3
- import * as _m0 from 'protobufjs/minimal';
4
2
  import { Timestamp } from './google/protobuf/timestamp';
3
+ import Long from 'long';
4
+ import _m0 from 'protobufjs/minimal';
5
5
 
6
6
  export const protobufPackage = 'livekit';
7
7
 
@@ -38,8 +38,9 @@ export function trackTypeToJSON(object: TrackType): string {
38
38
  return 'VIDEO';
39
39
  case TrackType.DATA:
40
40
  return 'DATA';
41
+ case TrackType.UNRECOGNIZED:
41
42
  default:
42
- return 'UNKNOWN';
43
+ return 'UNRECOGNIZED';
43
44
  }
44
45
  }
45
46
 
@@ -88,8 +89,9 @@ export function trackSourceToJSON(object: TrackSource): string {
88
89
  return 'SCREEN_SHARE';
89
90
  case TrackSource.SCREEN_SHARE_AUDIO:
90
91
  return 'SCREEN_SHARE_AUDIO';
92
+ case TrackSource.UNRECOGNIZED:
91
93
  default:
92
- return 'UNKNOWN';
94
+ return 'UNRECOGNIZED';
93
95
  }
94
96
  }
95
97
 
@@ -132,8 +134,9 @@ export function videoQualityToJSON(object: VideoQuality): string {
132
134
  return 'HIGH';
133
135
  case VideoQuality.OFF:
134
136
  return 'OFF';
137
+ case VideoQuality.UNRECOGNIZED:
135
138
  default:
136
- return 'UNKNOWN';
139
+ return 'UNRECOGNIZED';
137
140
  }
138
141
  }
139
142
 
@@ -170,8 +173,9 @@ export function connectionQualityToJSON(object: ConnectionQuality): string {
170
173
  return 'GOOD';
171
174
  case ConnectionQuality.EXCELLENT:
172
175
  return 'EXCELLENT';
176
+ case ConnectionQuality.UNRECOGNIZED:
173
177
  default:
174
- return 'UNKNOWN';
178
+ return 'UNRECOGNIZED';
175
179
  }
176
180
  }
177
181
 
@@ -208,8 +212,9 @@ export function clientConfigSettingToJSON(object: ClientConfigSetting): string {
208
212
  return 'DISABLED';
209
213
  case ClientConfigSetting.ENABLED:
210
214
  return 'ENABLED';
215
+ case ClientConfigSetting.UNRECOGNIZED:
211
216
  default:
212
- return 'UNKNOWN';
217
+ return 'UNRECOGNIZED';
213
218
  }
214
219
  }
215
220
 
@@ -221,6 +226,7 @@ export enum DisconnectReason {
221
226
  PARTICIPANT_REMOVED = 4,
222
227
  ROOM_DELETED = 5,
223
228
  STATE_MISMATCH = 6,
229
+ JOIN_FAILURE = 7,
224
230
  UNRECOGNIZED = -1,
225
231
  }
226
232
 
@@ -247,6 +253,9 @@ export function disconnectReasonFromJSON(object: any): DisconnectReason {
247
253
  case 6:
248
254
  case 'STATE_MISMATCH':
249
255
  return DisconnectReason.STATE_MISMATCH;
256
+ case 7:
257
+ case 'JOIN_FAILURE':
258
+ return DisconnectReason.JOIN_FAILURE;
250
259
  case -1:
251
260
  case 'UNRECOGNIZED':
252
261
  default:
@@ -270,8 +279,11 @@ export function disconnectReasonToJSON(object: DisconnectReason): string {
270
279
  return 'ROOM_DELETED';
271
280
  case DisconnectReason.STATE_MISMATCH:
272
281
  return 'STATE_MISMATCH';
282
+ case DisconnectReason.JOIN_FAILURE:
283
+ return 'JOIN_FAILURE';
284
+ case DisconnectReason.UNRECOGNIZED:
273
285
  default:
274
- return 'UNKNOWN';
286
+ return 'UNRECOGNIZED';
275
287
  }
276
288
  }
277
289
 
@@ -368,8 +380,9 @@ export function participantInfo_StateToJSON(object: ParticipantInfo_State): stri
368
380
  return 'ACTIVE';
369
381
  case ParticipantInfo_State.DISCONNECTED:
370
382
  return 'DISCONNECTED';
383
+ case ParticipantInfo_State.UNRECOGNIZED:
371
384
  default:
372
- return 'UNKNOWN';
385
+ return 'UNRECOGNIZED';
373
386
  }
374
387
  }
375
388
 
@@ -419,8 +432,7 @@ export interface VideoLayer {
419
432
  /** new DataPacket API */
420
433
  export interface DataPacket {
421
434
  kind: DataPacket_Kind;
422
- user?: UserPacket | undefined;
423
- speaker?: ActiveSpeakerUpdate | undefined;
435
+ value?: { $case: 'user'; user: UserPacket } | { $case: 'speaker'; speaker: ActiveSpeakerUpdate };
424
436
  }
425
437
 
426
438
  export enum DataPacket_Kind {
@@ -450,8 +462,9 @@ export function dataPacket_KindToJSON(object: DataPacket_Kind): string {
450
462
  return 'RELIABLE';
451
463
  case DataPacket_Kind.LOSSY:
452
464
  return 'LOSSY';
465
+ case DataPacket_Kind.UNRECOGNIZED:
453
466
  default:
454
- return 'UNKNOWN';
467
+ return 'UNRECOGNIZED';
455
468
  }
456
469
  }
457
470
 
@@ -552,8 +565,9 @@ export function clientInfo_SDKToJSON(object: ClientInfo_SDK): string {
552
565
  return 'GO';
553
566
  case ClientInfo_SDK.UNITY:
554
567
  return 'UNITY';
568
+ case ClientInfo_SDK.UNRECOGNIZED:
555
569
  default:
556
- return 'UNKNOWN';
570
+ return 'UNRECOGNIZED';
557
571
  }
558
572
  }
559
573
 
@@ -619,6 +633,11 @@ export interface RTPStats_GapHistogramEntry {
619
633
  value: number;
620
634
  }
621
635
 
636
+ export interface TimedVersion {
637
+ unixMicro: number;
638
+ ticks: number;
639
+ }
640
+
622
641
  function createBaseRoom(): Room {
623
642
  return {
624
643
  sid: '',
@@ -1435,7 +1454,7 @@ export const VideoLayer = {
1435
1454
  };
1436
1455
 
1437
1456
  function createBaseDataPacket(): DataPacket {
1438
- return { kind: 0, user: undefined, speaker: undefined };
1457
+ return { kind: 0, value: undefined };
1439
1458
  }
1440
1459
 
1441
1460
  export const DataPacket = {
@@ -1443,11 +1462,11 @@ export const DataPacket = {
1443
1462
  if (message.kind !== 0) {
1444
1463
  writer.uint32(8).int32(message.kind);
1445
1464
  }
1446
- if (message.user !== undefined) {
1447
- UserPacket.encode(message.user, writer.uint32(18).fork()).ldelim();
1465
+ if (message.value?.$case === 'user') {
1466
+ UserPacket.encode(message.value.user, writer.uint32(18).fork()).ldelim();
1448
1467
  }
1449
- if (message.speaker !== undefined) {
1450
- ActiveSpeakerUpdate.encode(message.speaker, writer.uint32(26).fork()).ldelim();
1468
+ if (message.value?.$case === 'speaker') {
1469
+ ActiveSpeakerUpdate.encode(message.value.speaker, writer.uint32(26).fork()).ldelim();
1451
1470
  }
1452
1471
  return writer;
1453
1472
  },
@@ -1463,10 +1482,13 @@ export const DataPacket = {
1463
1482
  message.kind = reader.int32() as any;
1464
1483
  break;
1465
1484
  case 2:
1466
- message.user = UserPacket.decode(reader, reader.uint32());
1485
+ message.value = { $case: 'user', user: UserPacket.decode(reader, reader.uint32()) };
1467
1486
  break;
1468
1487
  case 3:
1469
- message.speaker = ActiveSpeakerUpdate.decode(reader, reader.uint32());
1488
+ message.value = {
1489
+ $case: 'speaker',
1490
+ speaker: ActiveSpeakerUpdate.decode(reader, reader.uint32()),
1491
+ };
1470
1492
  break;
1471
1493
  default:
1472
1494
  reader.skipType(tag & 7);
@@ -1479,32 +1501,46 @@ export const DataPacket = {
1479
1501
  fromJSON(object: any): DataPacket {
1480
1502
  return {
1481
1503
  kind: isSet(object.kind) ? dataPacket_KindFromJSON(object.kind) : 0,
1482
- user: isSet(object.user) ? UserPacket.fromJSON(object.user) : undefined,
1483
- speaker: isSet(object.speaker) ? ActiveSpeakerUpdate.fromJSON(object.speaker) : undefined,
1504
+ value: isSet(object.user)
1505
+ ? { $case: 'user', user: UserPacket.fromJSON(object.user) }
1506
+ : isSet(object.speaker)
1507
+ ? { $case: 'speaker', speaker: ActiveSpeakerUpdate.fromJSON(object.speaker) }
1508
+ : undefined,
1484
1509
  };
1485
1510
  },
1486
1511
 
1487
1512
  toJSON(message: DataPacket): unknown {
1488
1513
  const obj: any = {};
1489
1514
  message.kind !== undefined && (obj.kind = dataPacket_KindToJSON(message.kind));
1490
- message.user !== undefined &&
1491
- (obj.user = message.user ? UserPacket.toJSON(message.user) : undefined);
1492
- message.speaker !== undefined &&
1493
- (obj.speaker = message.speaker ? ActiveSpeakerUpdate.toJSON(message.speaker) : undefined);
1515
+ message.value?.$case === 'user' &&
1516
+ (obj.user = message.value?.user ? UserPacket.toJSON(message.value?.user) : undefined);
1517
+ message.value?.$case === 'speaker' &&
1518
+ (obj.speaker = message.value?.speaker
1519
+ ? ActiveSpeakerUpdate.toJSON(message.value?.speaker)
1520
+ : undefined);
1494
1521
  return obj;
1495
1522
  },
1496
1523
 
1497
1524
  fromPartial<I extends Exact<DeepPartial<DataPacket>, I>>(object: I): DataPacket {
1498
1525
  const message = createBaseDataPacket();
1499
1526
  message.kind = object.kind ?? 0;
1500
- message.user =
1501
- object.user !== undefined && object.user !== null
1502
- ? UserPacket.fromPartial(object.user)
1503
- : undefined;
1504
- message.speaker =
1505
- object.speaker !== undefined && object.speaker !== null
1506
- ? ActiveSpeakerUpdate.fromPartial(object.speaker)
1507
- : undefined;
1527
+ if (
1528
+ object.value?.$case === 'user' &&
1529
+ object.value?.user !== undefined &&
1530
+ object.value?.user !== null
1531
+ ) {
1532
+ message.value = { $case: 'user', user: UserPacket.fromPartial(object.value.user) };
1533
+ }
1534
+ if (
1535
+ object.value?.$case === 'speaker' &&
1536
+ object.value?.speaker !== undefined &&
1537
+ object.value?.speaker !== null
1538
+ ) {
1539
+ message.value = {
1540
+ $case: 'speaker',
1541
+ speaker: ActiveSpeakerUpdate.fromPartial(object.value.speaker),
1542
+ };
1543
+ }
1508
1544
  return message;
1509
1545
  },
1510
1546
  };
@@ -2629,6 +2665,64 @@ export const RTPStats_GapHistogramEntry = {
2629
2665
  },
2630
2666
  };
2631
2667
 
2668
+ function createBaseTimedVersion(): TimedVersion {
2669
+ return { unixMicro: 0, ticks: 0 };
2670
+ }
2671
+
2672
+ export const TimedVersion = {
2673
+ encode(message: TimedVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
2674
+ if (message.unixMicro !== 0) {
2675
+ writer.uint32(8).int64(message.unixMicro);
2676
+ }
2677
+ if (message.ticks !== 0) {
2678
+ writer.uint32(16).int32(message.ticks);
2679
+ }
2680
+ return writer;
2681
+ },
2682
+
2683
+ decode(input: _m0.Reader | Uint8Array, length?: number): TimedVersion {
2684
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2685
+ let end = length === undefined ? reader.len : reader.pos + length;
2686
+ const message = createBaseTimedVersion();
2687
+ while (reader.pos < end) {
2688
+ const tag = reader.uint32();
2689
+ switch (tag >>> 3) {
2690
+ case 1:
2691
+ message.unixMicro = longToNumber(reader.int64() as Long);
2692
+ break;
2693
+ case 2:
2694
+ message.ticks = reader.int32();
2695
+ break;
2696
+ default:
2697
+ reader.skipType(tag & 7);
2698
+ break;
2699
+ }
2700
+ }
2701
+ return message;
2702
+ },
2703
+
2704
+ fromJSON(object: any): TimedVersion {
2705
+ return {
2706
+ unixMicro: isSet(object.unixMicro) ? Number(object.unixMicro) : 0,
2707
+ ticks: isSet(object.ticks) ? Number(object.ticks) : 0,
2708
+ };
2709
+ },
2710
+
2711
+ toJSON(message: TimedVersion): unknown {
2712
+ const obj: any = {};
2713
+ message.unixMicro !== undefined && (obj.unixMicro = Math.round(message.unixMicro));
2714
+ message.ticks !== undefined && (obj.ticks = Math.round(message.ticks));
2715
+ return obj;
2716
+ },
2717
+
2718
+ fromPartial<I extends Exact<DeepPartial<TimedVersion>, I>>(object: I): TimedVersion {
2719
+ const message = createBaseTimedVersion();
2720
+ message.unixMicro = object.unixMicro ?? 0;
2721
+ message.ticks = object.ticks ?? 0;
2722
+ return message;
2723
+ },
2724
+ };
2725
+
2632
2726
  declare var self: any | undefined;
2633
2727
  declare var window: any | undefined;
2634
2728
  declare var global: any | undefined;
@@ -2655,9 +2749,9 @@ const btoa: (bin: string) => string =
2655
2749
  globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
2656
2750
  function base64FromBytes(arr: Uint8Array): string {
2657
2751
  const bin: string[] = [];
2658
- for (const byte of arr) {
2752
+ arr.forEach((byte) => {
2659
2753
  bin.push(String.fromCharCode(byte));
2660
- }
2754
+ });
2661
2755
  return btoa(bin.join(''));
2662
2756
  }
2663
2757
 
@@ -2669,6 +2763,8 @@ export type DeepPartial<T> = T extends Builtin
2669
2763
  ? Array<DeepPartial<U>>
2670
2764
  : T extends ReadonlyArray<infer U>
2671
2765
  ? ReadonlyArray<DeepPartial<U>>
2766
+ : T extends { $case: string }
2767
+ ? { [K in keyof Omit<T, '$case'>]?: DeepPartial<T[K]> } & { $case: T['$case'] }
2672
2768
  : T extends {}
2673
2769
  ? { [K in keyof T]?: DeepPartial<T[K]> }
2674
2770
  : Partial<T>;