livekit-client 1.15.10 → 2.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 (76) hide show
  1. package/README.md +21 -17
  2. package/dist/livekit-client.esm.mjs +1603 -1493
  3. package/dist/livekit-client.esm.mjs.map +1 -1
  4. package/dist/livekit-client.umd.js +1 -1
  5. package/dist/livekit-client.umd.js.map +1 -1
  6. package/dist/src/api/SignalClient.d.ts +1 -3
  7. package/dist/src/api/SignalClient.d.ts.map +1 -1
  8. package/dist/src/index.d.ts +3 -3
  9. package/dist/src/index.d.ts.map +1 -1
  10. package/dist/src/options.d.ts +3 -9
  11. package/dist/src/options.d.ts.map +1 -1
  12. package/dist/src/proto/livekit_models_pb.d.ts +47 -0
  13. package/dist/src/proto/livekit_models_pb.d.ts.map +1 -1
  14. package/dist/src/room/RTCEngine.d.ts +1 -0
  15. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  16. package/dist/src/room/Room.d.ts +14 -16
  17. package/dist/src/room/Room.d.ts.map +1 -1
  18. package/dist/src/room/defaults.d.ts.map +1 -1
  19. package/dist/src/room/events.d.ts +0 -4
  20. package/dist/src/room/events.d.ts.map +1 -1
  21. package/dist/src/room/participant/LocalParticipant.d.ts +8 -25
  22. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  23. package/dist/src/room/participant/Participant.d.ts +6 -10
  24. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  25. package/dist/src/room/participant/RemoteParticipant.d.ts +9 -6
  26. package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
  27. package/dist/src/room/timers.d.ts +4 -5
  28. package/dist/src/room/timers.d.ts.map +1 -1
  29. package/dist/src/room/track/LocalVideoTrack.d.ts +3 -3
  30. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  31. package/dist/src/room/track/RemoteTrackPublication.d.ts +2 -2
  32. package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
  33. package/dist/src/room/track/Track.d.ts +5 -0
  34. package/dist/src/room/track/Track.d.ts.map +1 -1
  35. package/dist/src/room/track/options.d.ts +0 -5
  36. package/dist/src/room/track/options.d.ts.map +1 -1
  37. package/dist/src/room/types.d.ts +11 -3
  38. package/dist/src/room/types.d.ts.map +1 -1
  39. package/dist/src/version.d.ts +1 -1
  40. package/dist/ts4.2/src/api/SignalClient.d.ts +1 -3
  41. package/dist/ts4.2/src/index.d.ts +3 -3
  42. package/dist/ts4.2/src/options.d.ts +3 -9
  43. package/dist/ts4.2/src/proto/livekit_models_pb.d.ts +47 -0
  44. package/dist/ts4.2/src/room/RTCEngine.d.ts +1 -0
  45. package/dist/ts4.2/src/room/Room.d.ts +14 -16
  46. package/dist/ts4.2/src/room/events.d.ts +0 -4
  47. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +8 -25
  48. package/dist/ts4.2/src/room/participant/Participant.d.ts +6 -10
  49. package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +9 -6
  50. package/dist/ts4.2/src/room/timers.d.ts +4 -5
  51. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +3 -3
  52. package/dist/ts4.2/src/room/track/RemoteTrackPublication.d.ts +2 -2
  53. package/dist/ts4.2/src/room/track/Track.d.ts +5 -0
  54. package/dist/ts4.2/src/room/track/options.d.ts +0 -5
  55. package/dist/ts4.2/src/room/types.d.ts +11 -3
  56. package/dist/ts4.2/src/version.d.ts +1 -1
  57. package/package.json +8 -7
  58. package/src/api/SignalClient.ts +10 -10
  59. package/src/e2ee/E2eeManager.ts +2 -2
  60. package/src/index.ts +2 -4
  61. package/src/options.ts +3 -10
  62. package/src/proto/livekit_models_pb.ts +66 -0
  63. package/src/room/RTCEngine.ts +6 -1
  64. package/src/room/Room.ts +169 -129
  65. package/src/room/defaults.ts +1 -5
  66. package/src/room/events.ts +0 -5
  67. package/src/room/participant/LocalParticipant.ts +36 -77
  68. package/src/room/participant/Participant.ts +23 -24
  69. package/src/room/participant/RemoteParticipant.ts +27 -24
  70. package/src/room/track/LocalVideoTrack.test.ts +1 -1
  71. package/src/room/track/LocalVideoTrack.ts +11 -7
  72. package/src/room/track/RemoteTrackPublication.ts +2 -7
  73. package/src/room/track/Track.ts +10 -1
  74. package/src/room/track/options.ts +0 -6
  75. package/src/room/types.ts +11 -4
  76. package/src/version.ts +1 -1
@@ -8,9 +8,9 @@ import type { LoggerOptions } from '../types';
8
8
  import Participant from './Participant';
9
9
  import type { ParticipantEventCallbacks } from './Participant';
10
10
  export default class RemoteParticipant extends Participant {
11
- audioTracks: Map<string, RemoteTrackPublication>;
12
- videoTracks: Map<string, RemoteTrackPublication>;
13
- tracks: Map<string, RemoteTrackPublication>;
11
+ audioTrackPublications: Map<string, RemoteTrackPublication>;
12
+ videoTrackPublications: Map<string, RemoteTrackPublication>;
13
+ trackPublications: Map<string, RemoteTrackPublication>;
14
14
  signalClient: SignalClient;
15
15
  private volumeMap;
16
16
  private audioOutput?;
@@ -19,8 +19,8 @@ export default class RemoteParticipant extends Participant {
19
19
  /** @internal */
20
20
  constructor(signalClient: SignalClient, sid: string, identity?: string, name?: string, metadata?: string, loggerOptions?: LoggerOptions);
21
21
  protected addTrackPublication(publication: RemoteTrackPublication): void;
22
- getTrack(source: Track.Source): RemoteTrackPublication | undefined;
23
- getTrackByName(name: string): RemoteTrackPublication | undefined;
22
+ getTrackPublication(source: Track.Source): RemoteTrackPublication | undefined;
23
+ getTrackPublicationByName(name: string): RemoteTrackPublication | undefined;
24
24
  /**
25
25
  * sets the volume on the participant's audio track
26
26
  * by default, this affects the microphone publication
@@ -36,7 +36,10 @@ export default class RemoteParticipant extends Participant {
36
36
  addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
37
37
  /** @internal */
38
38
  get hasMetadata(): boolean;
39
- getTrackPublication(sid: Track.SID): RemoteTrackPublication | undefined;
39
+ /**
40
+ * @internal
41
+ */
42
+ getTrackPublicationBySid(sid: Track.SID): RemoteTrackPublication | undefined;
40
43
  /** @internal */
41
44
  updateInfo(info: ParticipantInfo): boolean;
42
45
  /** @internal */
@@ -1,13 +1,12 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Timers that can be overridden with platform specific implementations
4
3
  * that ensure that they are fired. These should be used when it is critical
5
4
  * that the timer fires on time.
6
5
  */
7
6
  export default class CriticalTimers {
8
- static setTimeout: (callback: (args: void) => void, ms?: number | undefined) => NodeJS.Timeout;
9
- static setInterval: (callback: (args: void) => void, ms?: number | undefined) => NodeJS.Timeout;
10
- static clearTimeout: (timeoutId: string | number | NodeJS.Timeout | undefined) => void;
11
- static clearInterval: (intervalId: string | number | NodeJS.Timeout | undefined) => void;
7
+ static setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...arguments: any[]) => number;
8
+ static setInterval: (handler: TimerHandler, timeout?: number | undefined, ...arguments: any[]) => number;
9
+ static clearTimeout: (id: number | undefined) => void;
10
+ static clearInterval: (id: number | undefined) => void;
12
11
  }
13
12
  //# sourceMappingURL=timers.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import type { SignalClient } from '../../api/SignalClient';
2
- import { VideoLayer, VideoQuality } from '../../proto/livekit_models_pb';
2
+ import { VideoLayer } from '../../proto/livekit_models_pb';
3
3
  import { SubscribedCodec, SubscribedQuality } from '../../proto/livekit_rtc_pb';
4
4
  import type { VideoSenderStats } from '../stats';
5
5
  import type { LoggerOptions } from '../types';
6
6
  import LocalTrack from './LocalTrack';
7
- import { Track } from './Track';
7
+ import { Track, VideoQuality } from './Track';
8
8
  import type { VideoCaptureOptions, VideoCodec } from './options';
9
9
  import type { TrackProcessor } from './processor/types';
10
10
  export declare class SimulcastTrackInfo {
@@ -41,7 +41,7 @@ export default class LocalVideoTrack extends LocalTrack {
41
41
  setDeviceId(deviceId: ConstrainDOMString): Promise<boolean>;
42
42
  restartTrack(options?: VideoCaptureOptions): Promise<void>;
43
43
  setProcessor(processor: TrackProcessor<Track.Kind>, showProcessedStreamLocally?: boolean): Promise<void>;
44
- addSimulcastTrack(codec: VideoCodec, encodings?: RTCRtpEncodingParameters[]): SimulcastTrackInfo;
44
+ addSimulcastTrack(codec: VideoCodec, encodings?: RTCRtpEncodingParameters[]): SimulcastTrackInfo | undefined;
45
45
  setSimulcastTrackSender(codec: VideoCodec, sender: RTCRtpSender): void;
46
46
  /**
47
47
  * @internal
@@ -1,7 +1,7 @@
1
- import { SubscriptionError, TrackInfo, VideoQuality } from '../../proto/livekit_models_pb';
1
+ import { SubscriptionError, TrackInfo } from '../../proto/livekit_models_pb';
2
2
  import type { LoggerOptions } from '../types';
3
3
  import type RemoteTrack from './RemoteTrack';
4
- import { Track } from './Track';
4
+ import { Track, VideoQuality } from './Track';
5
5
  import { TrackPublication } from './TrackPublication';
6
6
  export default class RemoteTrackPublication extends TrackPublication {
7
7
  track?: RemoteTrack;
@@ -4,6 +4,11 @@ import { StructuredLogger } from '../../logger';
4
4
  import { TrackSource, TrackType } from '../../proto/livekit_models_pb';
5
5
  import { StreamState as ProtoStreamState } from '../../proto/livekit_rtc_pb';
6
6
  import type { LoggerOptions } from '../types';
7
+ export declare enum VideoQuality {
8
+ LOW = 0,
9
+ MEDIUM = 1,
10
+ HIGH = 2
11
+ }
7
12
  declare const Track_base: new () => TypedEventEmitter<TrackEventCallbacks>;
8
13
  export declare abstract class Track extends Track_base {
9
14
  kind: Track.Kind;
@@ -28,11 +28,6 @@ export interface TrackPublishDefaults {
28
28
  * as backup. (TBD)
29
29
  */
30
30
  videoCodec?: VideoCodec;
31
- /**
32
- * max audio bitrate, defaults to [[AudioPresets.music]]
33
- * @deprecated use `audioPreset` instead
34
- */
35
- audioBitrate?: number;
36
31
  /**
37
32
  * which audio preset should be used for publishing (audio) tracks
38
33
  * defaults to [[AudioPresets.music]]
@@ -1,4 +1,3 @@
1
- import type RemoteParticipant from './participant/RemoteParticipant';
2
1
  export type SimulationOptions = {
3
2
  publish?: {
4
3
  audio?: boolean;
@@ -13,8 +12,17 @@ export type SimulationOptions = {
13
12
  };
14
13
  };
15
14
  export type DataPublishOptions = {
16
- /** the participants who will receive the message, will be sent to every one if empty */
17
- destination?: RemoteParticipant[] | string[];
15
+ /**
16
+ * whether to send this as reliable or lossy.
17
+ * For data that you need delivery guarantee (such as chat messages), use Reliable.
18
+ * For data that should arrive as quickly as possible, but you are ok with dropped
19
+ * packets, use Lossy.
20
+ */
21
+ reliable?: boolean;
22
+ /**
23
+ * the identities of participants who will receive the message, will be sent to every one if empty
24
+ */
25
+ destinationIdentities?: string[];
18
26
  /** the topic under which the message gets published */
19
27
  topic?: string;
20
28
  };
@@ -1,3 +1,3 @@
1
1
  export declare const version: string;
2
- export declare const protocolVersion = 11;
2
+ export declare const protocolVersion = 12;
3
3
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livekit-client",
3
- "version": "1.15.10",
3
+ "version": "2.0.0",
4
4
  "description": "JavaScript/TypeScript client SDK for LiveKit",
5
5
  "main": "./dist/livekit-client.umd.js",
6
6
  "unpkg": "./dist/livekit-client.umd.js",
@@ -46,8 +46,8 @@
46
46
  "webrtc-adapter": "^8.1.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/core": "7.23.7",
50
- "@babel/preset-env": "7.23.7",
49
+ "@babel/core": "7.23.9",
50
+ "@babel/preset-env": "7.23.9",
51
51
  "@bufbuild/protoc-gen-es": "^1.3.0",
52
52
  "@changesets/cli": "2.27.1",
53
53
  "@livekit/changesets-changelog-github": "^0.0.4",
@@ -73,20 +73,21 @@
73
73
  "gh-pages": "6.1.1",
74
74
  "jsdom": "^23.0.0",
75
75
  "prettier": "^3.0.0",
76
- "rollup": "4.9.2",
76
+ "rollup": "4.9.6",
77
77
  "rollup-plugin-delete": "^2.0.0",
78
78
  "rollup-plugin-re": "1.0.7",
79
79
  "rollup-plugin-typescript2": "0.36.0",
80
80
  "size-limit": "^8.2.4",
81
- "typedoc": "0.25.6",
81
+ "typedoc": "0.25.7",
82
82
  "typedoc-plugin-no-inherit": "1.4.0",
83
83
  "typescript": "5.3.3",
84
- "vite": "5.0.10",
84
+ "vite": "5.0.12",
85
85
  "vitest": "^1.0.0"
86
86
  },
87
87
  "scripts": {
88
88
  "build": "rollup --config --bundleConfigAsCjs && rollup --config rollup.config.worker.js --bundleConfigAsCjs && pnpm downlevel-dts",
89
- "build:watch": "rollup --watch --config rollup.config.js",
89
+ "build:watch": "rollup --watch --config --bundleConfigAsCjs",
90
+ "build:worker:watch": "rollup --watch --config rollup.config.worker.js --bundleConfigAsCjs",
90
91
  "build-docs": "typedoc",
91
92
  "proto": "protoc --es_out src/proto --es_opt target=ts -I./protocol ./protocol/livekit_rtc.proto ./protocol/livekit_models.proto",
92
93
  "sample": "vite example -c vite.config.mjs",
@@ -56,8 +56,6 @@ interface ConnectOpts extends SignalOptions {
56
56
  // public options
57
57
  export interface SignalOptions {
58
58
  autoSubscribe: boolean;
59
- /** @deprecated */
60
- publishOnly?: string;
61
59
  adaptiveStream?: boolean;
62
60
  maxRetries: number;
63
61
  e2eeEnabled: boolean;
@@ -274,7 +272,7 @@ export class SignalClient {
274
272
  abortSignal?.addEventListener('abort', abortHandler);
275
273
  this.log.debug(`connecting to ${url + params}`, this.logContext);
276
274
  if (this.ws) {
277
- await this.close();
275
+ await this.close(false);
278
276
  }
279
277
  this.ws = new WebSocket(url + params);
280
278
  this.ws.binaryType = 'arraybuffer';
@@ -396,6 +394,8 @@ export class SignalClient {
396
394
  this.log.warn(`websocket closed`, {
397
395
  ...this.logContext,
398
396
  reason: ev.reason,
397
+ code: ev.code,
398
+ wasClean: ev.wasClean,
399
399
  state: this.state,
400
400
  });
401
401
  this.handleOnClose(ev.reason);
@@ -421,10 +421,12 @@ export class SignalClient {
421
421
  this.onClose = undefined;
422
422
  };
423
423
 
424
- async close() {
424
+ async close(updateState: boolean = true) {
425
425
  const unlock = await this.closingLock.lock();
426
426
  try {
427
- this.state = SignalConnectionState.DISCONNECTING;
427
+ if (updateState) {
428
+ this.state = SignalConnectionState.DISCONNECTING;
429
+ }
428
430
  if (this.ws) {
429
431
  this.ws.onmessage = null;
430
432
  this.ws.onopen = null;
@@ -449,7 +451,9 @@ export class SignalClient {
449
451
  this.ws = undefined;
450
452
  }
451
453
  } finally {
452
- this.state = SignalConnectionState.DISCONNECTED;
454
+ if (updateState) {
455
+ this.state = SignalConnectionState.DISCONNECTED;
456
+ }
453
457
  this.clearPingInterval();
454
458
  unlock();
455
459
  }
@@ -849,10 +853,6 @@ function createConnectionParams(token: string, info: ClientInfo, opts: ConnectOp
849
853
  params.set('browser_version', info.browserVersion);
850
854
  }
851
855
 
852
- if (opts.publishOnly !== undefined) {
853
- params.set('publish', opts.publishOnly);
854
- }
855
-
856
856
  if (opts.adaptiveStream) {
857
857
  params.set('adaptive_stream', '1');
858
858
  }
@@ -168,8 +168,8 @@ export class E2EEManager extends (EventEmitter as new () => TypedEventEmitter<E2
168
168
  room
169
169
  .on(RoomEvent.ConnectionStateChanged, (state) => {
170
170
  if (state === ConnectionState.Connected) {
171
- room.participants.forEach((participant) => {
172
- participant.tracks.forEach((pub) => {
171
+ room.remoteParticipants.forEach((participant) => {
172
+ participant.trackPublications.forEach((pub) => {
173
173
  this.setParticipantCryptorEnabled(
174
174
  pub.trackInfo!.encryption !== Encryption_Type.NONE,
175
175
  participant.identity,
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { LogLevel, getLogger, setLogExtension, setLogLevel } from './logger';
2
- import { DataPacket_Kind, DisconnectReason, VideoQuality } from './proto/livekit_models_pb';
2
+ import { DataPacket_Kind, DisconnectReason } from './proto/livekit_models_pb';
3
3
  import DefaultReconnectPolicy from './room/DefaultReconnectPolicy';
4
- import Room, { ConnectionState, RoomState } from './room/Room';
4
+ import Room, { ConnectionState } from './room/Room';
5
5
  import LocalParticipant from './room/participant/LocalParticipant';
6
6
  import Participant, { ConnectionQuality } from './room/participant/Participant';
7
7
  import type { ParticipantTrackPermission } from './room/participant/ParticipantTrackPermission';
@@ -58,7 +58,6 @@ export {
58
58
  getLogger,
59
59
  Room,
60
60
  ConnectionState,
61
- RoomState,
62
61
  DataPacket_Kind,
63
62
  DisconnectReason,
64
63
  Participant,
@@ -73,7 +72,6 @@ export {
73
72
  RemoteVideoTrack,
74
73
  RemoteTrackPublication,
75
74
  TrackPublication,
76
- VideoQuality,
77
75
  ConnectionQuality,
78
76
  DefaultReconnectPolicy,
79
77
  CriticalTimers,
package/src/options.ts CHANGED
@@ -81,12 +81,11 @@ export interface InternalRoomOptions {
81
81
  expSignalLatency?: number;
82
82
 
83
83
  /**
84
- * @internal
85
- * @experimental
86
- * experimental flag, mix all audio tracks in web audio
84
+ * mix all audio tracks in web audio, helps to tackle some audio auto playback issues
85
+ * allows for passing in your own AudioContext instance, too
87
86
  */
88
87
 
89
- expWebAudioMix: boolean | WebAudioSettings;
88
+ webAudioMix: boolean | WebAudioSettings;
90
89
 
91
90
  /**
92
91
  * @experimental
@@ -116,12 +115,6 @@ export interface InternalRoomConnectOptions {
116
115
  */
117
116
  rtcConfig?: RTCConfiguration;
118
117
 
119
- /**
120
- * @deprecated
121
- * publish only mode
122
- */
123
- publishOnly?: string;
124
-
125
118
  /** specifies how often an initial join connection is allowed to retry (only applicable if server is not reachable) */
126
119
  maxRetries: number;
127
120
 
@@ -437,6 +437,11 @@ export class Room extends Message<Room> {
437
437
  */
438
438
  activeRecording = false;
439
439
 
440
+ /**
441
+ * @generated from field: livekit.TimedVersion version = 13;
442
+ */
443
+ version?: TimedVersion;
444
+
440
445
  constructor(data?: PartialMessage<Room>) {
441
446
  super();
442
447
  proto3.util.initPartial(data, this);
@@ -456,6 +461,7 @@ export class Room extends Message<Room> {
456
461
  { no: 9, name: "num_participants", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
457
462
  { no: 11, name: "num_publishers", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
458
463
  { no: 10, name: "active_recording", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
464
+ { no: 13, name: "version", kind: "message", T: TimedVersion },
459
465
  ]);
460
466
 
461
467
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Room {
@@ -726,6 +732,11 @@ export class ParticipantInfo extends Message<ParticipantInfo> {
726
732
  */
727
733
  isPublisher = false;
728
734
 
735
+ /**
736
+ * @generated from field: livekit.ParticipantInfo.Kind kind = 14;
737
+ */
738
+ kind = ParticipantInfo_Kind.STANDARD;
739
+
729
740
  constructor(data?: PartialMessage<ParticipantInfo>) {
730
741
  super();
731
742
  proto3.util.initPartial(data, this);
@@ -745,6 +756,7 @@ export class ParticipantInfo extends Message<ParticipantInfo> {
745
756
  { no: 11, name: "permission", kind: "message", T: ParticipantPermission },
746
757
  { no: 12, name: "region", kind: "scalar", T: 9 /* ScalarType.STRING */ },
747
758
  { no: 13, name: "is_publisher", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
759
+ { no: 14, name: "kind", kind: "enum", T: proto3.getEnumType(ParticipantInfo_Kind) },
748
760
  ]);
749
761
 
750
762
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ParticipantInfo {
@@ -804,6 +816,54 @@ proto3.util.setEnumType(ParticipantInfo_State, "livekit.ParticipantInfo.State",
804
816
  { no: 3, name: "DISCONNECTED" },
805
817
  ]);
806
818
 
819
+ /**
820
+ * @generated from enum livekit.ParticipantInfo.Kind
821
+ */
822
+ export enum ParticipantInfo_Kind {
823
+ /**
824
+ * standard participants, e.g. web clients
825
+ *
826
+ * @generated from enum value: STANDARD = 0;
827
+ */
828
+ STANDARD = 0,
829
+
830
+ /**
831
+ * only ingests streams
832
+ *
833
+ * @generated from enum value: INGRESS = 1;
834
+ */
835
+ INGRESS = 1,
836
+
837
+ /**
838
+ * only consumes streams
839
+ *
840
+ * @generated from enum value: EGRESS = 2;
841
+ */
842
+ EGRESS = 2,
843
+
844
+ /**
845
+ * SIP participants
846
+ *
847
+ * @generated from enum value: SIP = 3;
848
+ */
849
+ SIP = 3,
850
+
851
+ /**
852
+ * LiveKit agents
853
+ *
854
+ * @generated from enum value: AGENT = 4;
855
+ */
856
+ AGENT = 4,
857
+ }
858
+ // Retrieve enum metadata with: proto3.getEnumType(ParticipantInfo_Kind)
859
+ proto3.util.setEnumType(ParticipantInfo_Kind, "livekit.ParticipantInfo.Kind", [
860
+ { no: 0, name: "STANDARD" },
861
+ { no: 1, name: "INGRESS" },
862
+ { no: 2, name: "EGRESS" },
863
+ { no: 3, name: "SIP" },
864
+ { no: 4, name: "AGENT" },
865
+ ]);
866
+
807
867
  /**
808
868
  * @generated from message livekit.Encryption
809
869
  */
@@ -1020,6 +1080,11 @@ export class TrackInfo extends Message<TrackInfo> {
1020
1080
  */
1021
1081
  stream = "";
1022
1082
 
1083
+ /**
1084
+ * @generated from field: livekit.TimedVersion version = 18;
1085
+ */
1086
+ version?: TimedVersion;
1087
+
1023
1088
  constructor(data?: PartialMessage<TrackInfo>) {
1024
1089
  super();
1025
1090
  proto3.util.initPartial(data, this);
@@ -1045,6 +1110,7 @@ export class TrackInfo extends Message<TrackInfo> {
1045
1110
  { no: 15, name: "disable_red", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
1046
1111
  { no: 16, name: "encryption", kind: "enum", T: proto3.getEnumType(Encryption_Type) },
1047
1112
  { no: 17, name: "stream", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1113
+ { no: 18, name: "version", kind: "message", T: TimedVersion },
1048
1114
  ]);
1049
1115
 
1050
1116
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TrackInfo {
@@ -106,6 +106,10 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
106
106
  return this._isClosed;
107
107
  }
108
108
 
109
+ get pendingReconnect() {
110
+ return !!this.reconnectTimeout;
111
+ }
112
+
109
113
  private lossyDC?: RTCDataChannel;
110
114
 
111
115
  // @ts-ignore noUnusedLocals
@@ -838,7 +842,8 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
838
842
  this.regionUrlProvider.updateToken(this.token);
839
843
  }
840
844
  this.reconnectTimeout = CriticalTimers.setTimeout(
841
- () => this.attemptReconnect(disconnectReason),
845
+ () =>
846
+ this.attemptReconnect(disconnectReason).finally(() => (this.reconnectTimeout = undefined)),
842
847
  delay,
843
848
  );
844
849
  };