livekit-client 2.13.0 → 2.13.2

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 (66) hide show
  1. package/dist/livekit-client.e2ee.worker.js +1 -1
  2. package/dist/livekit-client.e2ee.worker.js.map +1 -1
  3. package/dist/livekit-client.e2ee.worker.mjs +1 -0
  4. package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
  5. package/dist/livekit-client.esm.mjs +383 -117
  6. package/dist/livekit-client.esm.mjs.map +1 -1
  7. package/dist/livekit-client.umd.js +1 -1
  8. package/dist/livekit-client.umd.js.map +1 -1
  9. package/dist/src/index.d.ts +1 -0
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/room/RTCEngine.d.ts +1 -1
  12. package/dist/src/room/RTCEngine.d.ts.map +1 -1
  13. package/dist/src/room/Room.d.ts +6 -2
  14. package/dist/src/room/Room.d.ts.map +1 -1
  15. package/dist/src/room/defaults.d.ts.map +1 -1
  16. package/dist/src/room/errors.d.ts +2 -1
  17. package/dist/src/room/errors.d.ts.map +1 -1
  18. package/dist/src/room/events.d.ts +5 -1
  19. package/dist/src/room/events.d.ts.map +1 -1
  20. package/dist/src/room/participant/LocalParticipant.d.ts +9 -0
  21. package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
  22. package/dist/src/room/participant/Participant.d.ts +1 -1
  23. package/dist/src/room/participant/Participant.d.ts.map +1 -1
  24. package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
  25. package/dist/src/room/track/LocalTrack.d.ts +10 -0
  26. package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
  27. package/dist/src/room/track/LocalVideoTrack.d.ts +1 -1
  28. package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
  29. package/dist/src/room/track/Track.d.ts +1 -0
  30. package/dist/src/room/track/Track.d.ts.map +1 -1
  31. package/dist/src/room/track/options.d.ts +8 -0
  32. package/dist/src/room/track/options.d.ts.map +1 -1
  33. package/dist/src/room/track/record.d.ts +6 -0
  34. package/dist/src/room/track/record.d.ts.map +1 -0
  35. package/dist/src/room/utils.d.ts +3 -0
  36. package/dist/src/room/utils.d.ts.map +1 -1
  37. package/dist/ts4.2/src/index.d.ts +1 -0
  38. package/dist/ts4.2/src/room/RTCEngine.d.ts +1 -1
  39. package/dist/ts4.2/src/room/Room.d.ts +5 -1
  40. package/dist/ts4.2/src/room/errors.d.ts +2 -1
  41. package/dist/ts4.2/src/room/events.d.ts +5 -1
  42. package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +9 -0
  43. package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
  44. package/dist/ts4.2/src/room/track/LocalTrack.d.ts +10 -0
  45. package/dist/ts4.2/src/room/track/LocalVideoTrack.d.ts +1 -1
  46. package/dist/ts4.2/src/room/track/Track.d.ts +1 -0
  47. package/dist/ts4.2/src/room/track/options.d.ts +8 -0
  48. package/dist/ts4.2/src/room/track/record.d.ts +6 -0
  49. package/dist/ts4.2/src/room/utils.d.ts +3 -0
  50. package/package.json +13 -12
  51. package/src/e2ee/worker/tsconfig.json +9 -1
  52. package/src/index.ts +2 -0
  53. package/src/room/RTCEngine.ts +7 -7
  54. package/src/room/Room.ts +23 -8
  55. package/src/room/defaults.ts +1 -0
  56. package/src/room/errors.ts +1 -0
  57. package/src/room/events.ts +5 -0
  58. package/src/room/participant/LocalParticipant.ts +215 -34
  59. package/src/room/participant/Participant.ts +1 -1
  60. package/src/room/participant/publishUtils.ts +4 -0
  61. package/src/room/track/LocalTrack.ts +47 -2
  62. package/src/room/track/LocalVideoTrack.ts +14 -5
  63. package/src/room/track/Track.ts +1 -0
  64. package/src/room/track/options.ts +9 -0
  65. package/src/room/track/record.ts +51 -0
  66. package/src/room/utils.ts +14 -1
@@ -10,6 +10,7 @@ import type { AudioCaptureOptions, BackupVideoCodec, CreateLocalTracksOptions, S
10
10
  import type { ChatMessage, DataPublishOptions, SendTextOptions, StreamTextOptions, TextStreamInfo } from '../types';
11
11
  import Participant from './Participant';
12
12
  import type { ParticipantTrackPermission } from './ParticipantTrackPermission';
13
+ import type RemoteParticipant from './RemoteParticipant';
13
14
  export default class LocalParticipant extends Participant {
14
15
  audioTrackPublications: Map<string, LocalTrackPublication>;
15
16
  videoTrackPublications: Map<string, LocalTrackPublication>;
@@ -29,6 +30,9 @@ export default class LocalParticipant extends Participant {
29
30
  private roomOptions;
30
31
  private encryptionType;
31
32
  private reconnectFuture?;
33
+ private signalConnectedFuture?;
34
+ private activeAgentFuture?;
35
+ private firstActiveAgent?;
32
36
  private rpcHandlers;
33
37
  private pendingSignalRequests;
34
38
  private enabledPublishVideoCodecs;
@@ -48,6 +52,7 @@ export default class LocalParticipant extends Participant {
48
52
  private handleReconnecting;
49
53
  private handleReconnected;
50
54
  private handleDisconnected;
55
+ private handleSignalConnected;
51
56
  private handleSignalRequestResponse;
52
57
  private handleDataPacket;
53
58
  /**
@@ -125,6 +130,7 @@ export default class LocalParticipant extends Participant {
125
130
  */
126
131
  publishTrack(track: LocalTrack | MediaStreamTrack, options?: TrackPublishOptions): Promise<LocalTrackPublication>;
127
132
  private publishOrRepublishTrack;
133
+ private waitUntilEngineConnected;
128
134
  private hasPermissionsToPublish;
129
135
  private publish;
130
136
  get isLocal(): boolean;
@@ -227,6 +233,9 @@ export default class LocalParticipant extends Participant {
227
233
  updateInfo(info: ParticipantInfo): boolean;
228
234
  private updateTrackSubscriptionPermissions;
229
235
  /** @internal */
236
+ setActiveAgent(agent: RemoteParticipant | undefined): void;
237
+ private waitUntilActiveAgentPresent;
238
+ /** @internal */
230
239
  private onTrackUnmuted;
231
240
  /** @internal */
232
241
  private onTrackMuted;
@@ -128,7 +128,7 @@ export type ParticipantEventCallbacks = {
128
128
  connectionQualityChanged: (connectionQuality: ConnectionQuality) => void;
129
129
  trackStreamStateChanged: (publication: RemoteTrackPublication, streamState: Track.StreamState) => void;
130
130
  trackSubscriptionPermissionChanged: (publication: RemoteTrackPublication, status: TrackPublication.PermissionStatus) => void;
131
- mediaDevicesError: (error: Error) => void;
131
+ mediaDevicesError: (error: Error, kind?: MediaDeviceKind) => void;
132
132
  audioStreamAcquired: () => void;
133
133
  participantPermissionsChanged: (prevPermissions?: ParticipantPermission) => void;
134
134
  trackSubscriptionStatusChanged: (publication: RemoteTrackPublication, status: TrackPublication.SubscriptionStatus) => void;
@@ -3,9 +3,11 @@ import type { LoggerOptions } from '../types';
3
3
  import { Track } from './Track';
4
4
  import type { VideoCodec } from './options';
5
5
  import type { TrackProcessor } from './processor/types';
6
+ import { LocalTrackRecorder } from './record';
6
7
  import type { ReplaceTrackOptions } from './types';
7
8
  export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Kind> extends Track<TrackKind> {
8
9
  protected _sender?: RTCRtpSender;
10
+ private autoStopPreConnectBuffer;
9
11
  /** @internal */
10
12
  get sender(): RTCRtpSender | undefined;
11
13
  /** @internal */
@@ -13,6 +15,7 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
13
15
  /** @internal */
14
16
  codec?: VideoCodec;
15
17
  get constraints(): MediaTrackConstraints;
18
+ get hasPreConnectBuffer(): boolean;
16
19
  protected _constraints: MediaTrackConstraints;
17
20
  protected reacquireTrack: boolean;
18
21
  protected providedByUser: boolean;
@@ -23,6 +26,7 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
23
26
  protected processorLock: Mutex;
24
27
  protected audioContext?: AudioContext;
25
28
  protected manuallyStopped: boolean;
29
+ protected localTrackRecorder: LocalTrackRecorder<typeof this> | undefined;
26
30
  private restartLock;
27
31
  /**
28
32
  *
@@ -100,6 +104,12 @@ export default abstract class LocalTrack<TrackKind extends Track.Kind = Track.Ki
100
104
  * @returns
101
105
  */
102
106
  stopProcessor(keepElement?: boolean): Promise<void>;
107
+ /** @internal */
108
+ startPreConnectBuffer(timeslice?: number): void;
109
+ /** @internal */
110
+ stopPreConnectBuffer(): void;
111
+ /** @internal */
112
+ getPreConnectBuffer(): ReadableStream<Uint8Array<ArrayBufferLike>> | undefined;
103
113
  protected abstract monitorSender(): void;
104
114
  }
105
115
  //# sourceMappingURL=LocalTrack.d.ts.map
@@ -55,7 +55,7 @@ export default class LocalVideoTrack extends LocalTrack<Track.Kind.Video> {
55
55
  * @internal
56
56
  * Sets layers that should be publishing
57
57
  */
58
- setPublishingLayers(qualities: SubscribedQuality[]): Promise<void>;
58
+ setPublishingLayers(isSvc: boolean, qualities: SubscribedQuality[]): Promise<void>;
59
59
  protected monitorSender: () => Promise<void>;
60
60
  protected handleAppVisibilityChanged(): Promise<void>;
61
61
  }
@@ -145,6 +145,7 @@ export type TrackEventCallbacks = {
145
145
  timestamp: number;
146
146
  rtpTimestamp: number;
147
147
  }) => void;
148
+ preConnectBufferFlushed: (buffer: Uint8Array[]) => void;
148
149
  };
149
150
  export {};
150
151
  //# sourceMappingURL=Track.d.ts.map
@@ -103,6 +103,14 @@ export interface TrackPublishDefaults {
103
103
  * defaults to false
104
104
  */
105
105
  stopMicTrackOnMute?: boolean;
106
+ /**
107
+ * Enables preconnect buffer for a user's microphone track.
108
+ * This is useful for reducing perceived latency when the user starts to speak before the connection is established.
109
+ * Only works for agent use cases.
110
+ *
111
+ * Defaults to false.
112
+ */
113
+ preConnectBuffer?: boolean;
106
114
  }
107
115
  /**
108
116
  * Options when publishing tracks
@@ -0,0 +1,6 @@
1
+ import type LocalTrack from './LocalTrack';
2
+ export declare class LocalTrackRecorder<T extends LocalTrack> extends MediaRecorder {
3
+ byteStream: ReadableStream<Uint8Array>;
4
+ constructor(track: T, options?: MediaRecorderOptions);
5
+ }
6
+ //# sourceMappingURL=record.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { ChatMessage as ChatMessageModel, ClientInfo, DisconnectReason, Transcription as TranscriptionModel } from '@livekit/protocol';
2
+ import type { BrowserDetails } from '../utils/browserParser';
2
3
  import type { ConnectionError } from './errors';
3
4
  import type LocalParticipant from './participant/LocalParticipant';
4
5
  import type Participant from './participant/Participant';
@@ -32,7 +33,9 @@ export declare function isBrowserSupported(): boolean;
32
33
  export declare function isFireFox(): boolean;
33
34
  export declare function isChromiumBased(): boolean;
34
35
  export declare function isSafari(): boolean;
36
+ export declare function isSafariBased(): boolean;
35
37
  export declare function isSafari17(): boolean;
38
+ export declare function isSafariSvcApi(browser?: BrowserDetails): boolean;
36
39
  export declare function isMobile(): boolean;
37
40
  export declare function isE2EESimulcastSupported(): boolean | undefined;
38
41
  export declare function isWeb(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livekit-client",
3
- "version": "2.13.0",
3
+ "version": "2.13.2",
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",
@@ -47,18 +47,18 @@
47
47
  "webrtc-adapter": "^9.0.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/core": "7.26.10",
51
- "@babel/preset-env": "7.26.9",
50
+ "@babel/core": "7.27.1",
51
+ "@babel/preset-env": "7.27.2",
52
52
  "@bufbuild/protoc-gen-es": "^1.10.0",
53
- "@changesets/cli": "2.28.1",
53
+ "@changesets/cli": "2.29.4",
54
54
  "@livekit/changesets-changelog-github": "^0.0.4",
55
55
  "@rollup/plugin-babel": "6.0.4",
56
56
  "@rollup/plugin-commonjs": "28.0.3",
57
57
  "@rollup/plugin-json": "6.1.0",
58
58
  "@rollup/plugin-node-resolve": "16.0.1",
59
59
  "@rollup/plugin-terser": "^0.4.4",
60
- "@size-limit/file": "^8.2.6",
61
- "@size-limit/webpack": "^8.2.6",
60
+ "@size-limit/file": "^11.2.0",
61
+ "@size-limit/webpack": "^11.2.0",
62
62
  "@trivago/prettier-plugin-sort-imports": "^5.0.0",
63
63
  "@types/events": "^3.0.3",
64
64
  "@types/sdp-transform": "2.4.9",
@@ -72,16 +72,17 @@
72
72
  "eslint-plugin-ecmascript-compat": "^3.2.1",
73
73
  "eslint-plugin-import": "2.31.0",
74
74
  "gh-pages": "6.3.0",
75
- "happy-dom": "^15.10.2",
75
+ "happy-dom": "^17.2.0",
76
+ "jsdom": "^26.1.0",
76
77
  "prettier": "^3.4.2",
77
- "rollup": "4.39.0",
78
+ "rollup": "4.41.0",
78
79
  "rollup-plugin-delete": "^2.1.0",
79
80
  "rollup-plugin-typescript2": "0.36.0",
80
- "size-limit": "^8.2.6",
81
- "typedoc": "0.28.2",
82
- "typedoc-plugin-no-inherit": "1.5.0",
81
+ "size-limit": "^11.2.0",
82
+ "typedoc": "0.28.4",
83
+ "typedoc-plugin-no-inherit": "1.6.1",
83
84
  "typescript": "5.8.3",
84
- "vite": "5.4.17",
85
+ "vite": "5.4.19",
85
86
  "vitest": "^1.6.0"
86
87
  },
87
88
  "scripts": {
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "extends": "../../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "lib": ["DOM", "DOM.Iterable", "ES2017", "ES2018.Promise", "WebWorker", "ES2021.WeakRef"]
4
+ "lib": [
5
+ "DOM",
6
+ "DOM.Iterable",
7
+ "ES2017",
8
+ "ES2018.Promise",
9
+ "WebWorker",
10
+ "ES2021.WeakRef",
11
+ "DOM.AsyncIterable"
12
+ ]
5
13
  }
6
14
  }
package/src/index.ts CHANGED
@@ -129,3 +129,5 @@ export type {
129
129
  ReconnectContext,
130
130
  ReconnectPolicy,
131
131
  };
132
+
133
+ export { LocalTrackRecorder } from './room/track/record';
@@ -216,7 +216,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
216
216
  room: this.latestJoinResponse?.room?.name,
217
217
  roomID: this.latestJoinResponse?.room?.sid,
218
218
  participant: this.latestJoinResponse?.participant?.identity,
219
- pID: this.latestJoinResponse?.participant?.sid,
219
+ pID: this.participantSid,
220
220
  };
221
221
  }
222
222
 
@@ -249,10 +249,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
249
249
  }
250
250
 
251
251
  this.clientConfiguration = joinResponse.clientConfiguration;
252
- // emit signal connected event after a short delay to allow for join response to be processed on room
253
- setTimeout(() => {
254
- this.emit(EngineEvent.SignalConnected);
255
- }, 10);
252
+ this.emit(EngineEvent.SignalConnected, joinResponse);
256
253
  return joinResponse;
257
254
  } catch (e) {
258
255
  if (e instanceof ConnectionError) {
@@ -330,7 +327,7 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
330
327
  reject(
331
328
  new ConnectionError(
332
329
  'publication of local track timed out, no response from server',
333
- ConnectionErrorReason.InternalError,
330
+ ConnectionErrorReason.Timeout,
334
331
  ),
335
332
  );
336
333
  }, 10_000);
@@ -532,6 +529,9 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
532
529
 
533
530
  this.client.onRoomMoved = (res: RoomMovedResponse) => {
534
531
  this.participantSid = res.participant?.sid;
532
+ if (this.latestJoinResponse) {
533
+ this.latestJoinResponse.room = res.room;
534
+ }
535
535
  this.emit(EngineEvent.RoomMoved, res);
536
536
  };
537
537
 
@@ -1510,7 +1510,7 @@ export type EngineEventCallbacks = {
1510
1510
  remoteMute: (trackSid: string, muted: boolean) => void;
1511
1511
  offline: () => void;
1512
1512
  signalRequestResponse: (response: RequestResponse) => void;
1513
- signalConnected: () => void;
1513
+ signalConnected: (joinResp: JoinResponse) => void;
1514
1514
  };
1515
1515
 
1516
1516
  function supportOptionalDatachannel(protocol: number | undefined): boolean {
package/src/room/Room.ts CHANGED
@@ -65,7 +65,7 @@ import { ConnectionError, ConnectionErrorReason, UnsupportedServer } from './err
65
65
  import { EngineEvent, ParticipantEvent, RoomEvent, TrackEvent } from './events';
66
66
  import LocalParticipant from './participant/LocalParticipant';
67
67
  import type Participant from './participant/Participant';
68
- import type { ConnectionQuality } from './participant/Participant';
68
+ import { type ConnectionQuality, ParticipantKind } from './participant/Participant';
69
69
  import RemoteParticipant from './participant/RemoteParticipant';
70
70
  import { MAX_PAYLOAD_BYTES, RpcError, type RpcInvocationData, byteLength } from './rpc';
71
71
  import CriticalTimers from './timers';
@@ -103,7 +103,7 @@ import {
103
103
  isLocalParticipant,
104
104
  isReactNative,
105
105
  isRemotePub,
106
- isSafari,
106
+ isSafariBased,
107
107
  isWeb,
108
108
  numberToBigInt,
109
109
  sleep,
@@ -1356,6 +1356,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
1356
1356
  // @ts-expect-error setSinkId is not yet in the typescript type of AudioContext
1357
1357
  this.audioContext?.setSinkId(deviceId);
1358
1358
  }
1359
+
1359
1360
  // also set audio output on all audio elements, even if webAudioMix is enabled in order to workaround echo cancellation not working on chrome with non-default output devices
1360
1361
  // see https://issues.chromium.org/issues/40252911#comment7
1361
1362
  await Promise.all(
@@ -1991,7 +1992,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
1991
1992
  }
1992
1993
  };
1993
1994
 
1994
- private handleDeviceChange = async () => {
1995
+ /**
1996
+ * attempt to select the default devices if the previously selected devices are no longer available after a device change event
1997
+ */
1998
+ private async selectDefaultDevices() {
1995
1999
  const previousDevices = DeviceManager.getInstance().previousDevices;
1996
2000
  // check for available devices, but don't request permissions in order to avoid prompts for kinds that haven't been used before
1997
2001
  const availableDevices = await DeviceManager.getInstance().getDevices(undefined, false);
@@ -2040,19 +2044,27 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
2040
2044
  }
2041
2045
  }
2042
2046
 
2043
- if ((kind === 'audioinput' && !isSafari()) || kind === 'videoinput') {
2047
+ if ((kind === 'audioinput' && !isSafariBased()) || kind === 'videoinput') {
2044
2048
  // airpods on Safari need special handling for audioinput as the track doesn't end as soon as you take them out
2045
2049
  continue;
2046
2050
  }
2047
2051
  // switch to first available device if previously active device is not available any more
2048
2052
  if (
2049
2053
  devicesOfKind.length > 0 &&
2050
- !devicesOfKind.find((deviceInfo) => deviceInfo.deviceId === this.getActiveDevice(kind))
2054
+ !devicesOfKind.find((deviceInfo) => deviceInfo.deviceId === this.getActiveDevice(kind)) &&
2055
+ // avoid switching audio output on safari without explicit user action as it leads to slowed down audio playback
2056
+ (kind !== 'audiooutput' || !isSafariBased())
2051
2057
  ) {
2052
2058
  await this.switchActiveDevice(kind, devicesOfKind[0].deviceId);
2053
2059
  }
2054
2060
  }
2061
+ }
2055
2062
 
2063
+ private handleDeviceChange = async () => {
2064
+ if (getBrowser()?.os !== 'iOS') {
2065
+ // default devices are non deterministic on iOS, so we don't attempt to select them here
2066
+ await this.selectDefaultDevices();
2067
+ }
2056
2068
  this.emit(RoomEvent.MediaDevicesChanged);
2057
2069
  };
2058
2070
 
@@ -2244,6 +2256,9 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
2244
2256
  })
2245
2257
  .on(ParticipantEvent.Active, () => {
2246
2258
  this.emitWhenConnected(RoomEvent.ParticipantActive, participant);
2259
+ if (participant.kind === ParticipantKind.AGENT) {
2260
+ this.localParticipant.setActiveAgent(participant);
2261
+ }
2247
2262
  });
2248
2263
 
2249
2264
  // update info at the end after callbacks have been set up
@@ -2436,8 +2451,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
2436
2451
  this.emit(RoomEvent.ConnectionQualityChanged, quality, this.localParticipant);
2437
2452
  };
2438
2453
 
2439
- private onMediaDevicesError = (e: Error) => {
2440
- this.emit(RoomEvent.MediaDevicesError, e);
2454
+ private onMediaDevicesError = (e: Error, kind?: MediaDeviceKind) => {
2455
+ this.emit(RoomEvent.MediaDevicesError, e, kind);
2441
2456
  };
2442
2457
 
2443
2458
  private onLocalParticipantPermissionsChanged = (prevPermissions?: ParticipantPermission) => {
@@ -2691,7 +2706,7 @@ export type RoomEventCallbacks = {
2691
2706
  publication?: TrackPublication,
2692
2707
  ) => void;
2693
2708
  connectionQualityChanged: (quality: ConnectionQuality, participant: Participant) => void;
2694
- mediaDevicesError: (error: Error) => void;
2709
+ mediaDevicesError: (error: Error, kind?: MediaDeviceKind) => void;
2695
2710
  trackStreamStateChanged: (
2696
2711
  publication: RemoteTrackPublication,
2697
2712
  streamState: Track.StreamState,
@@ -19,6 +19,7 @@ export const publishDefaults: TrackPublishDefaults = {
19
19
  stopMicTrackOnMute: false,
20
20
  videoCodec: defaultVideoCodec,
21
21
  backupCodec: true,
22
+ preConnectBuffer: false,
22
23
  } as const;
23
24
 
24
25
  export const audioDefaults: AudioCaptureOptions = {
@@ -16,6 +16,7 @@ export enum ConnectionErrorReason {
16
16
  InternalError,
17
17
  Cancelled,
18
18
  LeaveRequest,
19
+ Timeout,
19
20
  }
20
21
 
21
22
  export class ConnectionError extends LivekitError {
@@ -666,4 +666,9 @@ export enum TrackEvent {
666
666
  * @experimental
667
667
  */
668
668
  TimeSyncUpdate = 'timeSyncUpdate',
669
+
670
+ /**
671
+ * @internal
672
+ */
673
+ PreConnectBufferFlushed = 'preConnectBufferFlushed',
669
674
  }