@livekit/rtc-node 0.13.32 → 0.13.33

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 (110) hide show
  1. package/dist/async_queue.d.ts +2 -3
  2. package/dist/audio_filter.d.ts +2 -3
  3. package/dist/audio_frame.d.ts +5 -6
  4. package/dist/audio_mixer.d.ts +3 -6
  5. package/dist/audio_resampler.d.ts +3 -6
  6. package/dist/audio_source.d.ts +5 -6
  7. package/dist/{audio_stream-4M8XlO4-.d.cts → audio_stream-CnODFAmo.d.cts} +1 -0
  8. package/dist/audio_stream.d.cts +1 -1
  9. package/dist/audio_stream.d.ts +61 -18
  10. package/dist/data_streams/index.d.ts +4 -3
  11. package/dist/data_streams/stream_reader.d.ts +48 -2
  12. package/dist/data_streams/stream_writer.d.ts +5 -7
  13. package/dist/data_streams/types.d.ts +41 -2
  14. package/dist/e2ee.d.ts +8 -10
  15. package/dist/ffi_client.d.ts +8 -10
  16. package/dist/frame_processor.d.ts +8 -11
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +22 -17
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -107
  22. package/dist/log.d.ts +5 -7
  23. package/dist/participant.cjs +7 -2
  24. package/dist/participant.cjs.map +1 -1
  25. package/dist/participant.d.cts +1 -1
  26. package/dist/participant.d.ts +152 -18
  27. package/dist/participant.d.ts.map +1 -1
  28. package/dist/room.cjs +6 -0
  29. package/dist/room.cjs.map +1 -1
  30. package/dist/room.d.cts +2 -2
  31. package/dist/room.d.ts +220 -18
  32. package/dist/room.d.ts.map +1 -1
  33. package/dist/rpc.d.ts +7 -9
  34. package/dist/track.d.cts +1 -1
  35. package/dist/track.d.ts +67 -18
  36. package/dist/track_publication.d.cts +1 -1
  37. package/dist/track_publication.d.ts +45 -18
  38. package/dist/transcription.d.ts +3 -4
  39. package/dist/types.d.ts +2 -3
  40. package/dist/utils.d.ts +4 -5
  41. package/dist/version.cjs +1 -1
  42. package/dist/version.cjs.map +1 -1
  43. package/dist/version.d.cts +1 -1
  44. package/dist/version.d.ts +2 -3
  45. package/dist/video_frame.d.ts +4 -5
  46. package/dist/video_source.d.ts +6 -8
  47. package/dist/video_stream.d.cts +1 -1
  48. package/dist/video_stream.d.ts +5 -22
  49. package/package.json +5 -6
  50. package/src/index.ts +8 -1
  51. package/src/participant.ts +7 -1
  52. package/src/room.ts +10 -0
  53. package/src/version.ts +1 -1
  54. package/dist/async_queue.js +0 -56
  55. package/dist/async_queue.js.map +0 -1
  56. package/dist/audio_filter.js +0 -24
  57. package/dist/audio_filter.js.map +0 -1
  58. package/dist/audio_frame.js +0 -78
  59. package/dist/audio_frame.js.map +0 -1
  60. package/dist/audio_mixer.js +0 -269
  61. package/dist/audio_mixer.js.map +0 -1
  62. package/dist/audio_resampler.js +0 -154
  63. package/dist/audio_resampler.js.map +0 -1
  64. package/dist/audio_source.js +0 -134
  65. package/dist/audio_source.js.map +0 -1
  66. package/dist/audio_stream-CTyN1Ldy.d.ts +0 -523
  67. package/dist/audio_stream.js +0 -122
  68. package/dist/audio_stream.js.map +0 -1
  69. package/dist/data_streams/index.js +0 -3
  70. package/dist/data_streams/index.js.map +0 -1
  71. package/dist/data_streams/stream_reader.js +0 -124
  72. package/dist/data_streams/stream_reader.js.map +0 -1
  73. package/dist/data_streams/stream_writer.js +0 -26
  74. package/dist/data_streams/stream_writer.js.map +0 -1
  75. package/dist/data_streams/types.js +0 -1
  76. package/dist/data_streams/types.js.map +0 -1
  77. package/dist/e2ee.js +0 -251
  78. package/dist/e2ee.js.map +0 -1
  79. package/dist/ffi_client.js +0 -89
  80. package/dist/ffi_client.js.map +0 -1
  81. package/dist/frame_processor.js +0 -29
  82. package/dist/frame_processor.js.map +0 -1
  83. package/dist/index.js.map +0 -1
  84. package/dist/log.js +0 -9
  85. package/dist/log.js.map +0 -1
  86. package/dist/participant.js +0 -715
  87. package/dist/participant.js.map +0 -1
  88. package/dist/room.js +0 -900
  89. package/dist/room.js.map +0 -1
  90. package/dist/rpc.js +0 -65
  91. package/dist/rpc.js.map +0 -1
  92. package/dist/track.js +0 -234
  93. package/dist/track.js.map +0 -1
  94. package/dist/track_publication.js +0 -100
  95. package/dist/track_publication.js.map +0 -1
  96. package/dist/transcription.js +0 -1
  97. package/dist/transcription.js.map +0 -1
  98. package/dist/types-_PdPVish.d.ts +0 -87
  99. package/dist/types.js +0 -1
  100. package/dist/types.js.map +0 -1
  101. package/dist/utils.js +0 -35
  102. package/dist/utils.js.map +0 -1
  103. package/dist/version.js +0 -5
  104. package/dist/version.js.map +0 -1
  105. package/dist/video_frame.js +0 -207
  106. package/dist/video_frame.js.map +0 -1
  107. package/dist/video_source.js +0 -53
  108. package/dist/video_source.js.map +0 -1
  109. package/dist/video_stream.js +0 -70
  110. package/dist/video_stream.js.map +0 -1
package/dist/rpc.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { RpcError as RpcError$1 } from '@livekit/rtc-ffi-bindings';
2
-
1
+ import type { RpcError as RpcError_Proto } from '@livekit/rtc-ffi-bindings';
3
2
  /** Parameters for initiating an RPC call */
4
- interface PerformRpcParams {
3
+ export interface PerformRpcParams {
5
4
  /** The `identity` of the destination participant */
6
5
  destinationIdentity: string;
7
6
  /** The method name to call */
@@ -14,7 +13,7 @@ interface PerformRpcParams {
14
13
  /**
15
14
  * Data passed to method handler for incoming RPC invocations
16
15
  */
17
- interface RpcInvocationData {
16
+ export interface RpcInvocationData {
18
17
  /**
19
18
  * The unique request ID. Will match at both sides of the call, useful for debugging or logging.
20
19
  */
@@ -40,7 +39,7 @@ interface RpcInvocationData {
40
39
  *
41
40
  * Built-in types are included but developers may use any string, with a max length of 256 bytes.
42
41
  */
43
- declare class RpcError extends Error {
42
+ export declare class RpcError extends Error {
44
43
  code: typeof RpcError.ErrorCode | number;
45
44
  data?: string;
46
45
  /**
@@ -51,8 +50,8 @@ declare class RpcError extends Error {
51
50
  * Error codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).
52
51
  */
53
52
  constructor(code: number, message: string, data?: string);
54
- static fromProto(proto: RpcError$1): RpcError;
55
- toProto(): RpcError$1;
53
+ static fromProto(proto: RpcError_Proto): RpcError;
54
+ toProto(): RpcError_Proto;
56
55
  static ErrorCode: {
57
56
  readonly APPLICATION_ERROR: 1500;
58
57
  readonly CONNECTION_TIMEOUT: 1501;
@@ -76,5 +75,4 @@ declare class RpcError extends Error {
76
75
  */
77
76
  static builtIn(key: keyof typeof RpcError.ErrorCode, data?: string): RpcError;
78
77
  }
79
-
80
- export { type PerformRpcParams, RpcError, type RpcInvocationData };
78
+ //# sourceMappingURL=rpc.d.ts.map
package/dist/track.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import '@livekit/rtc-ffi-bindings';
2
2
  import './audio_source.cjs';
3
- export { a as AudioTrack, L as LocalAudioTrack, c as LocalTrack, e as LocalVideoTrack, R as RemoteAudioTrack, g as RemoteTrack, i as RemoteVideoTrack, T as Track, V as VideoTrack } from './audio_stream-4M8XlO4-.cjs';
3
+ export { a as AudioTrack, L as LocalAudioTrack, c as LocalTrack, e as LocalVideoTrack, R as RemoteAudioTrack, g as RemoteTrack, i as RemoteVideoTrack, T as Track, V as VideoTrack } from './audio_stream-CnODFAmo.cjs';
4
4
  import './ffi_client.cjs';
5
5
  import './video_source.cjs';
6
6
  import './audio_frame.cjs';
package/dist/track.d.ts CHANGED
@@ -1,18 +1,67 @@
1
- import '@livekit/rtc-ffi-bindings';
2
- import './audio_source.js';
3
- export { a as AudioTrack, L as LocalAudioTrack, c as LocalTrack, e as LocalVideoTrack, R as RemoteAudioTrack, g as RemoteTrack, i as RemoteVideoTrack, T as Track, V as VideoTrack } from './audio_stream-CTyN1Ldy.js';
4
- import './ffi_client.js';
5
- import './video_source.js';
6
- import './audio_frame.js';
7
- import 'node:stream/web';
8
- import './frame_processor.js';
9
- import './video_frame.js';
10
- import '@livekit/typed-emitter';
11
- import './types-_PdPVish.js';
12
- import './e2ee.js';
13
- import '@livekit/mutex';
14
- import 'node:fs';
15
- import './data_streams/stream_writer.js';
16
- import './rpc.js';
17
- import './transcription.js';
18
- import './types.js';
1
+ import type { OwnedTrack, StreamState, TrackInfo, TrackKind } from '@livekit/rtc-ffi-bindings';
2
+ import type { AudioSource } from './audio_source.js';
3
+ import type { AudioStreamSource } from './audio_stream.js';
4
+ import { FfiHandle } from './ffi_client.js';
5
+ import type { Room } from './room.js';
6
+ import type { VideoSource } from './video_source.js';
7
+ export declare abstract class Track {
8
+ /** @internal */
9
+ info?: TrackInfo;
10
+ /** @internal */
11
+ ffi_handle: FfiHandle;
12
+ private roomRef;
13
+ private audioStreams;
14
+ private streamFinalizationRegistry;
15
+ private onRoomTokenRefreshed;
16
+ constructor(owned: OwnedTrack);
17
+ /** @internal */
18
+ resolveRoom(): Room | null;
19
+ /** @internal */
20
+ setRoom(room: Room | null): void;
21
+ /** @internal */
22
+ registerAudioStream(stream: AudioStreamSource): void;
23
+ /** @internal */
24
+ unregisterAudioStream(stream: AudioStreamSource): void;
25
+ /**
26
+ * End every {@link AudioStream} attached to this track.
27
+ *
28
+ * @remarks
29
+ * The FFI keeps feeding an audio stream until the stream's own handle is
30
+ * dropped, so streams on a track that is no longer subscribed would otherwise
31
+ * go on delivering audio for the lifetime of the process.
32
+ *
33
+ * @internal
34
+ */
35
+ closeAudioStreams(): void;
36
+ private iterateStreams;
37
+ private pushProcessorMetadataToStream;
38
+ get sid(): string | undefined;
39
+ get name(): string | undefined;
40
+ get kind(): TrackKind | undefined;
41
+ get stream_state(): StreamState | undefined;
42
+ get muted(): boolean | undefined;
43
+ close(): Promise<void>;
44
+ }
45
+ export declare class LocalAudioTrack extends Track {
46
+ private source?;
47
+ constructor(owned: OwnedTrack, source?: AudioSource);
48
+ static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack;
49
+ close(closeSource?: boolean): Promise<void>;
50
+ }
51
+ export declare class LocalVideoTrack extends Track {
52
+ private source?;
53
+ constructor(owned: OwnedTrack, source?: VideoSource);
54
+ static createVideoTrack(name: string, source: VideoSource): LocalVideoTrack;
55
+ close(closeSource?: boolean): Promise<void>;
56
+ }
57
+ export declare class RemoteVideoTrack extends Track {
58
+ constructor(owned: OwnedTrack);
59
+ }
60
+ export declare class RemoteAudioTrack extends Track {
61
+ constructor(owned: OwnedTrack);
62
+ }
63
+ export type LocalTrack = LocalVideoTrack | LocalAudioTrack;
64
+ export type RemoteTrack = RemoteVideoTrack | RemoteAudioTrack;
65
+ export type AudioTrack = LocalAudioTrack | RemoteAudioTrack;
66
+ export type VideoTrack = LocalVideoTrack | RemoteVideoTrack;
67
+ //# sourceMappingURL=track.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import '@livekit/rtc-ffi-bindings';
2
- export { d as LocalTrackPublication, h as RemoteTrackPublication, n as TrackPublication } from './audio_stream-4M8XlO4-.cjs';
2
+ export { d as LocalTrackPublication, h as RemoteTrackPublication, n as TrackPublication } from './audio_stream-CnODFAmo.cjs';
3
3
  import 'node:stream/web';
4
4
  import './audio_frame.cjs';
5
5
  import './frame_processor.cjs';
@@ -1,18 +1,45 @@
1
- import '@livekit/rtc-ffi-bindings';
2
- export { d as LocalTrackPublication, h as RemoteTrackPublication, n as TrackPublication } from './audio_stream-CTyN1Ldy.js';
3
- import 'node:stream/web';
4
- import './audio_frame.js';
5
- import './frame_processor.js';
6
- import './video_frame.js';
7
- import './audio_source.js';
8
- import './ffi_client.js';
9
- import '@livekit/typed-emitter';
10
- import './types-_PdPVish.js';
11
- import './e2ee.js';
12
- import '@livekit/mutex';
13
- import 'node:fs';
14
- import './data_streams/stream_writer.js';
15
- import './rpc.js';
16
- import './transcription.js';
17
- import './types.js';
18
- import './video_source.js';
1
+ import type { EncryptionType } from '@livekit/rtc-ffi-bindings';
2
+ import type { OwnedTrackPublication, TrackKind, TrackPublicationInfo, TrackSource } from '@livekit/rtc-ffi-bindings';
3
+ import { FfiHandle } from '@livekit/rtc-ffi-bindings';
4
+ import type { Track } from './track.js';
5
+ export declare abstract class TrackPublication {
6
+ /** @internal */
7
+ ffiHandle: FfiHandle;
8
+ /** @internal */
9
+ info?: TrackPublicationInfo;
10
+ track?: Track;
11
+ constructor(ownedInfo: OwnedTrackPublication);
12
+ get sid(): string | undefined;
13
+ get name(): string | undefined;
14
+ get kind(): TrackKind | undefined;
15
+ get source(): TrackSource | undefined;
16
+ get simulcasted(): boolean | undefined;
17
+ get width(): number | undefined;
18
+ get height(): number | undefined;
19
+ get mimeType(): string | undefined;
20
+ get muted(): boolean | undefined;
21
+ get encryptionType(): EncryptionType | undefined;
22
+ /**
23
+ * Update the publication's info in place. Used by the SDK when the
24
+ * server re-issues IDs / metadata for an existing publication (e.g.
25
+ * after a full reconnect). Application code holding a cached
26
+ * publication reference continues to read fresh values via the
27
+ * unchanged object identity.
28
+ * @internal
29
+ */
30
+ updateInfo(info: TrackPublicationInfo): void;
31
+ }
32
+ export declare class LocalTrackPublication extends TrackPublication {
33
+ private firstSubscription;
34
+ private firstSubscriptionResolver;
35
+ constructor(ownedInfo: OwnedTrackPublication);
36
+ waitForSubscription(): Promise<void>;
37
+ /** @internal */
38
+ resolveFirstSubscription(): void;
39
+ }
40
+ export declare class RemoteTrackPublication extends TrackPublication {
41
+ subscribed: boolean;
42
+ constructor(ownedInfo: OwnedTrackPublication);
43
+ setSubscribed(subscribed: boolean): void;
44
+ }
45
+ //# sourceMappingURL=track_publication.d.ts.map
@@ -1,4 +1,4 @@
1
- interface TranscriptionSegment {
1
+ export interface TranscriptionSegment {
2
2
  id: string;
3
3
  text: string;
4
4
  startTime: bigint;
@@ -6,10 +6,9 @@ interface TranscriptionSegment {
6
6
  language: string;
7
7
  final: boolean;
8
8
  }
9
- interface Transcription {
9
+ export interface Transcription {
10
10
  participantIdentity: string;
11
11
  trackSid: string;
12
12
  segments: TranscriptionSegment[];
13
13
  }
14
-
15
- export type { Transcription, TranscriptionSegment };
14
+ //# sourceMappingURL=transcription.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- interface ChatMessage {
1
+ export interface ChatMessage {
2
2
  id: string;
3
3
  timestamp: number;
4
4
  message: string;
5
5
  editTimestamp?: number;
6
6
  generated?: boolean;
7
7
  }
8
-
9
- export type { ChatMessage };
8
+ //# sourceMappingURL=types.d.ts.map
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /** convert bigints to numbers preserving undefined values */
2
- declare function bigIntToNumber<T extends bigint | undefined>(value: T): T extends bigint ? number : undefined;
2
+ export declare function bigIntToNumber<T extends bigint | undefined>(value: T): T extends bigint ? number : undefined;
3
3
  /** convert numbers to bigints preserving undefined values */
4
- declare function numberToBigInt<T extends number | undefined>(value: T): T extends number ? bigint : undefined;
5
- declare function splitUtf8(s: string, n: number): Uint8Array[];
6
-
7
- export { bigIntToNumber, numberToBigInt, splitUtf8 };
4
+ export declare function numberToBigInt<T extends number | undefined>(value: T): T extends number ? bigint : undefined;
5
+ export declare function splitUtf8(s: string, n: number): Uint8Array[];
6
+ //# sourceMappingURL=utils.d.ts.map
package/dist/version.cjs CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  SDK_VERSION: () => SDK_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const SDK_VERSION = "0.13.32";
24
+ const SDK_VERSION = "0.13.33";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  SDK_VERSION
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.32\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.33\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;","names":[]}
@@ -1,3 +1,3 @@
1
- declare const SDK_VERSION = "0.13.32";
1
+ declare const SDK_VERSION = "0.13.33";
2
2
 
3
3
  export { SDK_VERSION };
package/dist/version.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- declare const SDK_VERSION = "0.13.32";
2
-
3
- export { SDK_VERSION };
1
+ export declare const SDK_VERSION = "0.13.33";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -1,6 +1,6 @@
1
- import { VideoBufferType, VideoBufferInfo, OwnedVideoBuffer } from '@livekit/rtc-ffi-bindings';
2
-
3
- declare class VideoFrame {
1
+ import type { OwnedVideoBuffer } from '@livekit/rtc-ffi-bindings';
2
+ import { VideoBufferInfo, VideoBufferType } from '@livekit/rtc-ffi-bindings';
3
+ export declare class VideoFrame {
4
4
  data: Uint8Array;
5
5
  width: number;
6
6
  height: number;
@@ -15,5 +15,4 @@ declare class VideoFrame {
15
15
  getPlane(planeNth: number): Uint8Array | void;
16
16
  convert(dstType: VideoBufferType, flipY?: boolean): VideoFrame;
17
17
  }
18
-
19
- export { VideoFrame };
18
+ //# sourceMappingURL=video_frame.d.ts.map
@@ -1,9 +1,8 @@
1
- import { VideoSourceInfo, FfiHandle, VideoRotation } from '@livekit/rtc-ffi-bindings';
2
- import './ffi_client.js';
3
- import { VideoFrame } from './video_frame.js';
4
- import '@livekit/typed-emitter';
5
-
6
- declare class VideoSource {
1
+ import type { VideoSourceInfo } from '@livekit/rtc-ffi-bindings';
2
+ import { VideoRotation } from '@livekit/rtc-ffi-bindings';
3
+ import { FfiHandle } from './ffi_client.js';
4
+ import type { VideoFrame } from './video_frame.js';
5
+ export declare class VideoSource {
7
6
  /** @internal */
8
7
  info?: VideoSourceInfo;
9
8
  /** @internal */
@@ -16,5 +15,4 @@ declare class VideoSource {
16
15
  captureFrame(frame: VideoFrame, timestampUs?: bigint, rotation?: VideoRotation): void;
17
16
  close(): Promise<void>;
18
17
  }
19
-
20
- export { VideoSource };
18
+ //# sourceMappingURL=video_source.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { VideoRotation } from '@livekit/rtc-ffi-bindings';
2
- import { T as Track } from './audio_stream-4M8XlO4-.cjs';
2
+ import { T as Track } from './audio_stream-CnODFAmo.cjs';
3
3
  import { VideoFrame } from './video_frame.cjs';
4
4
  import 'node:stream/web';
5
5
  import './audio_frame.cjs';
@@ -1,29 +1,12 @@
1
- import { VideoRotation } from '@livekit/rtc-ffi-bindings';
2
- import { T as Track } from './audio_stream-CTyN1Ldy.js';
1
+ import type { VideoRotation } from '@livekit/rtc-ffi-bindings';
2
+ import type { Track } from './track.js';
3
3
  import { VideoFrame } from './video_frame.js';
4
- import 'node:stream/web';
5
- import './audio_frame.js';
6
- import './frame_processor.js';
7
- import './audio_source.js';
8
- import './ffi_client.js';
9
- import '@livekit/typed-emitter';
10
- import './types-_PdPVish.js';
11
- import './e2ee.js';
12
- import '@livekit/mutex';
13
- import 'node:fs';
14
- import './data_streams/stream_writer.js';
15
- import './rpc.js';
16
- import './transcription.js';
17
- import './types.js';
18
- import './video_source.js';
19
-
20
- type VideoFrameEvent = {
4
+ export type VideoFrameEvent = {
21
5
  frame: VideoFrame;
22
6
  timestampUs: bigint;
23
7
  rotation: VideoRotation;
24
8
  };
25
- declare class VideoStream extends ReadableStream<VideoFrameEvent> {
9
+ export declare class VideoStream extends ReadableStream<VideoFrameEvent> {
26
10
  constructor(track: Track);
27
11
  }
28
-
29
- export { type VideoFrameEvent, VideoStream };
12
+ //# sourceMappingURL=video_stream.d.ts.map
package/package.json CHANGED
@@ -3,10 +3,9 @@
3
3
  "description": "LiveKit RTC Node",
4
4
  "license": "Apache-2.0",
5
5
  "author": "LiveKit",
6
- "version": "0.13.32",
7
- "main": "dist/index.js",
8
- "require": "dist/index.cjs",
9
- "types": "dist/index.d.ts",
6
+ "version": "0.13.33",
7
+ "main": "dist/index.cjs",
8
+ "types": "dist/index.d.cts",
10
9
  "exports": {
11
10
  ".": {
12
11
  "import": {
@@ -32,7 +31,7 @@
32
31
  "dependencies": {
33
32
  "@datastructures-js/deque": "1.0.8",
34
33
  "@livekit/mutex": "^1.0.0",
35
- "@livekit/rtc-ffi-bindings": "0.12.68",
34
+ "@livekit/rtc-ffi-bindings": "0.12.73",
36
35
  "@livekit/typed-emitter": "^3.0.0",
37
36
  "pino": "^9.0.0",
38
37
  "pino-pretty": "^13.0.0"
@@ -51,7 +50,7 @@
51
50
  },
52
51
  "scripts": {
53
52
  "prebuild": "node -p \"'export const SDK_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
54
- "build": "pnpm prebuild && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
53
+ "build": "pnpm prebuild && tsup && node scripts/postbuild.mjs",
55
54
  "lint": "eslint -f unix \"src/**/*.ts\" --ignore-pattern \"src/proto/*\"",
56
55
  "test": "vitest run src",
57
56
  "test:e2e": "node scripts/run-e2e.mjs"
package/src/index.ts CHANGED
@@ -36,7 +36,14 @@ export {
36
36
  TrackSource,
37
37
  } from '@livekit/rtc-ffi-bindings';
38
38
  export { VideoBufferType, VideoCodec, VideoRotation } from '@livekit/rtc-ffi-bindings';
39
- export { ConnectError, Room, RoomEvent, type RoomOptions, type RtcConfiguration } from './room.js';
39
+ export {
40
+ ConnectError,
41
+ Room,
42
+ RoomEvent,
43
+ type RoomDataStreamOptions,
44
+ type RoomOptions,
45
+ type RtcConfiguration,
46
+ } from './room.js';
40
47
  export { RpcError, type PerformRpcParams, type RpcInvocationData } from './rpc.js';
41
48
  export {
42
49
  LocalAudioTrack,
@@ -277,6 +277,7 @@ export class LocalParticipant extends Participant {
277
277
  destinationIdentities?: Array<string>;
278
278
  streamId?: string;
279
279
  senderIdentity?: string;
280
+ totalSize?: number;
280
281
  }): Promise<TextStreamWriter> {
281
282
  const senderIdentity = options?.senderIdentity ?? this.identity;
282
283
  const streamId = options?.streamId ?? crypto.randomUUID();
@@ -287,6 +288,7 @@ export class LocalParticipant extends Participant {
287
288
  mimeType: 'text/plain',
288
289
  topic: options?.topic ?? '',
289
290
  timestamp: Date.now(),
291
+ totalSize: options?.totalSize,
290
292
  };
291
293
 
292
294
  const headerReq = new SendStreamHeaderRequest({
@@ -298,6 +300,7 @@ export class LocalParticipant extends Participant {
298
300
  mimeType: info.mimeType,
299
301
  topic: info.topic,
300
302
  timestamp: numberToBigInt(info.timestamp),
303
+ totalLength: numberToBigInt(info.totalSize),
301
304
  attributes: options?.attributes,
302
305
  contentHeader: {
303
306
  case: 'textHeader',
@@ -384,7 +387,10 @@ export class LocalParticipant extends Participant {
384
387
  streamId?: string;
385
388
  },
386
389
  ) {
387
- const writer = await this.streamText(options);
390
+ const writer = await this.streamText({
391
+ ...options,
392
+ totalSize: new TextEncoder().encode(text).byteLength,
393
+ });
388
394
  await writer.write(text);
389
395
  await writer.close();
390
396
  return writer.info;
package/src/room.ts CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  type IceServer,
30
30
  IceTransportType,
31
31
  type ReadyForRoomEventResponse,
32
+ RoomDataStreamOptions,
32
33
  type RoomInfo,
33
34
  type SimulateScenarioCallback,
34
35
  type SimulateScenarioKind,
@@ -58,6 +59,8 @@ import { RemoteTrackPublication } from './track_publication.js';
58
59
  import type { ChatMessage } from './types.js';
59
60
  import { bigIntToNumber } from './utils.js';
60
61
 
62
+ export { RoomDataStreamOptions };
63
+
61
64
  export interface RtcConfiguration {
62
65
  iceTransportType: IceTransportType;
63
66
  continualGatheringPolicy: ContinualGatheringPolicy;
@@ -273,6 +276,13 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
273
276
  */
274
277
  async connect(url: string, token: string, opts?: RoomOptions) {
275
278
  const options = { ...defaultRoomOptions, ...opts };
279
+ // The Node SDK still implements data streams in TypeScript on top of raw FFI
280
+ // packets, so always advertise only legacy (v1) data stream support to other
281
+ // clients, preserving any other data stream options provided by the user.
282
+ options.dataStream = new RoomDataStreamOptions({
283
+ ...options.dataStream,
284
+ useLegacyClientImplementation: true,
285
+ });
276
286
  const e2eeEnabled = options.encryption || options.e2ee;
277
287
  const e2eeOptions = options.encryption
278
288
  ? { ...defaultE2EEOptions, ...options.encryption }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.13.32";
1
+ export const SDK_VERSION = "0.13.33";
@@ -1,56 +0,0 @@
1
- import { Deque } from "@datastructures-js/deque";
2
- class AsyncQueue {
3
- constructor(capacity = Infinity) {
4
- this.capacity = capacity;
5
- this.items = [];
6
- this.waitingProducers = new Deque();
7
- this.waitingConsumers = new Deque();
8
- this.closed = false;
9
- }
10
- async put(item) {
11
- if (this.closed) throw new Error("Queue closed");
12
- while (this.items.length >= this.capacity) {
13
- await new Promise(
14
- (resolve, reject) => this.waitingProducers.pushBack({ resolve, reject })
15
- );
16
- if (this.closed) throw new Error("Queue closed");
17
- }
18
- this.items.push(item);
19
- if (this.waitingConsumers.size() > 0) {
20
- const resolve = this.waitingConsumers.popFront();
21
- resolve();
22
- }
23
- }
24
- get() {
25
- const item = this.items.shift();
26
- if (this.waitingProducers.size() > 0) {
27
- const producer = this.waitingProducers.popFront();
28
- producer.resolve();
29
- }
30
- return item;
31
- }
32
- /**
33
- * Wait until an item is available or the queue is closed.
34
- * Returns immediately if items are already available.
35
- */
36
- async waitForItem() {
37
- if (this.items.length > 0 || this.closed) {
38
- return;
39
- }
40
- await new Promise((resolve) => this.waitingConsumers.pushBack(resolve));
41
- }
42
- close() {
43
- this.closed = true;
44
- this.waitingProducers.toArray().forEach((producer) => producer.reject(new Error("Queue closed")));
45
- this.waitingConsumers.toArray().forEach((resolve) => resolve());
46
- this.waitingProducers.clear();
47
- this.waitingConsumers.clear();
48
- }
49
- get length() {
50
- return this.items.length;
51
- }
52
- }
53
- export {
54
- AsyncQueue
55
- };
56
- //# sourceMappingURL=async_queue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/async_queue.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { Deque } from '@datastructures-js/deque';\n\n/**\n * AsyncQueue is a bounded queue with async support for both producers and consumers.\n *\n * This queue simplifies the AudioMixer implementation by handling backpressure and\n * synchronization automatically:\n * - Producers can await put() until the queue has space (when queue is full)\n * - Consumers can await waitForItem() until data is available (when queue is empty)\n *\n * This eliminates the need for manual coordination logic, polling loops, and\n * complex state management throughout the rest of the codebase.\n */\nexport class AsyncQueue<T> {\n private items: T[] = [];\n private waitingProducers = new Deque<{ resolve: () => void; reject: (err: Error) => void }>();\n private waitingConsumers = new Deque<() => void>();\n closed = false;\n\n constructor(private capacity: number = Infinity) {}\n\n async put(item: T) {\n if (this.closed) throw new Error('Queue closed');\n\n while (this.items.length >= this.capacity) {\n await new Promise<void>((resolve, reject) =>\n this.waitingProducers.pushBack({ resolve, reject }),\n );\n // Re-check if closed after waking up\n if (this.closed) throw new Error('Queue closed');\n }\n\n this.items.push(item);\n\n // Wake up one waiting consumer\n if (this.waitingConsumers.size() > 0) {\n const resolve = this.waitingConsumers.popFront()!;\n resolve();\n }\n }\n\n get(): T | undefined {\n const item = this.items.shift();\n if (this.waitingProducers.size() > 0) {\n const producer = this.waitingProducers.popFront()!;\n producer.resolve(); // wakes up one waiting producer\n }\n return item;\n }\n\n /**\n * Wait until an item is available or the queue is closed.\n * Returns immediately if items are already available.\n */\n async waitForItem(): Promise<void> {\n if (this.items.length > 0 || this.closed) {\n return;\n }\n await new Promise<void>((resolve) => this.waitingConsumers.pushBack(resolve));\n }\n\n close() {\n this.closed = true;\n // Reject all waiting producers with an error\n this.waitingProducers\n .toArray()\n .forEach((producer) => producer.reject(new Error('Queue closed')));\n // Resolve all waiting consumers so they can see the queue is closed\n this.waitingConsumers.toArray().forEach((resolve) => resolve());\n this.waitingProducers.clear();\n this.waitingConsumers.clear();\n }\n\n get length() {\n return this.items.length;\n }\n}\n"],"mappings":"AAGA,SAAS,aAAa;AAaf,MAAM,WAAc;AAAA,EAMzB,YAAoB,WAAmB,UAAU;AAA7B;AALpB,SAAQ,QAAa,CAAC;AACtB,SAAQ,mBAAmB,IAAI,MAA6D;AAC5F,SAAQ,mBAAmB,IAAI,MAAkB;AACjD,kBAAS;AAAA,EAEyC;AAAA,EAElD,MAAM,IAAI,MAAS;AACjB,QAAI,KAAK,OAAQ,OAAM,IAAI,MAAM,cAAc;AAE/C,WAAO,KAAK,MAAM,UAAU,KAAK,UAAU;AACzC,YAAM,IAAI;AAAA,QAAc,CAAC,SAAS,WAChC,KAAK,iBAAiB,SAAS,EAAE,SAAS,OAAO,CAAC;AAAA,MACpD;AAEA,UAAI,KAAK,OAAQ,OAAM,IAAI,MAAM,cAAc;AAAA,IACjD;AAEA,SAAK,MAAM,KAAK,IAAI;AAGpB,QAAI,KAAK,iBAAiB,KAAK,IAAI,GAAG;AACpC,YAAM,UAAU,KAAK,iBAAiB,SAAS;AAC/C,cAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,MAAqB;AACnB,UAAM,OAAO,KAAK,MAAM,MAAM;AAC9B,QAAI,KAAK,iBAAiB,KAAK,IAAI,GAAG;AACpC,YAAM,WAAW,KAAK,iBAAiB,SAAS;AAChD,eAAS,QAAQ;AAAA,IACnB;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,cAA6B;AACjC,QAAI,KAAK,MAAM,SAAS,KAAK,KAAK,QAAQ;AACxC;AAAA,IACF;AACA,UAAM,IAAI,QAAc,CAAC,YAAY,KAAK,iBAAiB,SAAS,OAAO,CAAC;AAAA,EAC9E;AAAA,EAEA,QAAQ;AACN,SAAK,SAAS;AAEd,SAAK,iBACF,QAAQ,EACR,QAAQ,CAAC,aAAa,SAAS,OAAO,IAAI,MAAM,cAAc,CAAC,CAAC;AAEnE,SAAK,iBAAiB,QAAQ,EAAE,QAAQ,CAAC,YAAY,QAAQ,CAAC;AAC9D,SAAK,iBAAiB,MAAM;AAC5B,SAAK,iBAAiB,MAAM;AAAA,EAC9B;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
@@ -1,24 +0,0 @@
1
- import { LoadAudioFilterPluginRequest } from "@livekit/rtc-ffi-bindings";
2
- import { FfiClient } from "./ffi_client.js";
3
- class AudioFilter {
4
- constructor(moduleId, path, dependencies = []) {
5
- const req = new LoadAudioFilterPluginRequest({
6
- moduleId,
7
- pluginPath: path,
8
- dependencies
9
- });
10
- const res = FfiClient.instance.request({
11
- message: {
12
- case: "loadAudioFilterPlugin",
13
- value: req
14
- }
15
- });
16
- if (res.error) {
17
- throw new Error(`Failed to initialize audio filter: ${res.error}`);
18
- }
19
- }
20
- }
21
- export {
22
- AudioFilter
23
- };
24
- //# sourceMappingURL=audio_filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/audio_filter.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { LoadAudioFilterPluginResponse } from '@livekit/rtc-ffi-bindings';\nimport { LoadAudioFilterPluginRequest } from '@livekit/rtc-ffi-bindings';\nimport { FfiClient } from './ffi_client.js';\n\nexport class AudioFilter {\n constructor(moduleId: string, path: string, dependencies: string[] = []) {\n const req = new LoadAudioFilterPluginRequest({\n moduleId,\n pluginPath: path,\n dependencies,\n });\n\n const res = FfiClient.instance.request<LoadAudioFilterPluginResponse>({\n message: {\n case: 'loadAudioFilterPlugin',\n value: req,\n },\n });\n\n if (res.error) {\n throw new Error(`Failed to initialize audio filter: ${res.error}`);\n }\n }\n}\n"],"mappings":"AAIA,SAAS,oCAAoC;AAC7C,SAAS,iBAAiB;AAEnB,MAAM,YAAY;AAAA,EACvB,YAAY,UAAkB,MAAc,eAAyB,CAAC,GAAG;AACvE,UAAM,MAAM,IAAI,6BAA6B;AAAA,MAC3C;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,IACF,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAuC;AAAA,MACpE,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,QAAI,IAAI,OAAO;AACb,YAAM,IAAI,MAAM,sCAAsC,IAAI,KAAK,EAAE;AAAA,IACnE;AAAA,EACF;AACF;","names":[]}