@livekit/rtc-node 0.13.33 → 0.13.34
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.
- package/dist/{audio_stream-CnODFAmo.d.cts → audio_stream-BNVaONuH.d.cts} +36 -11
- package/dist/audio_stream.d.cts +2 -2
- package/dist/data_streams/index.d.cts +1 -1
- package/dist/data_streams/stream_reader.cjs +97 -58
- package/dist/data_streams/stream_reader.cjs.map +1 -1
- package/dist/data_streams/stream_reader.d.cts +1 -1
- package/dist/data_streams/stream_reader.d.ts +28 -11
- package/dist/data_streams/stream_reader.d.ts.map +1 -1
- package/dist/data_streams/stream_writer.d.cts +1 -1
- package/dist/data_streams/types.cjs.map +1 -1
- package/dist/data_streams/types.d.cts +1 -1
- package/dist/data_streams/types.d.ts +6 -0
- package/dist/data_streams/types.d.ts.map +1 -1
- package/dist/e2ee.cjs +5 -1
- package/dist/e2ee.cjs.map +1 -1
- package/dist/e2ee.d.cts +3 -1
- package/dist/e2ee.d.ts +3 -1
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/participant.cjs +178 -196
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +2 -2
- package/dist/participant.d.ts +22 -5
- package/dist/participant.d.ts.map +1 -1
- package/dist/room.cjs +166 -126
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +3 -3
- package/dist/room.d.ts +16 -8
- package/dist/room.d.ts.map +1 -1
- package/dist/tests/e2e_common.cjs +157 -0
- package/dist/tests/e2e_common.cjs.map +1 -0
- package/dist/tests/e2e_common.d.cts +56 -0
- package/dist/tests/e2e_common.d.ts +37 -0
- package/dist/tests/e2e_common.d.ts.map +1 -0
- package/dist/track.d.cts +2 -2
- package/dist/track_publication.d.cts +2 -2
- package/dist/{types-_PdPVish.d.cts → types-f7wTlFjs.d.cts} +34 -11
- package/dist/utils.cjs +27 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +8 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/video_stream.d.cts +2 -2
- package/package.json +2 -2
- package/src/audio_stream_room_lifecycle.test.ts +4 -1
- package/src/data_streams/stream_reader.ts +132 -82
- package/src/data_streams/types.ts +6 -0
- package/src/e2ee.ts +7 -0
- package/src/participant.ts +251 -228
- package/src/room.ts +233 -144
- package/src/tests/e2e.test.ts +50 -139
- package/src/tests/e2e_common.ts +163 -0
- package/src/tests/e2e_data_streams.test.ts +639 -0
- package/src/utils.ts +30 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe } from 'vitest';
|
|
2
|
+
import '../ffi_client.cjs';
|
|
3
|
+
import { m as RoomOptions, j as Room, l as RoomEvent } from '../audio_stream-BNVaONuH.cjs';
|
|
4
|
+
import '@livekit/rtc-ffi-bindings';
|
|
5
|
+
import '@livekit/typed-emitter';
|
|
6
|
+
import 'node:stream/web';
|
|
7
|
+
import '../audio_frame.cjs';
|
|
8
|
+
import '../frame_processor.cjs';
|
|
9
|
+
import '../video_frame.cjs';
|
|
10
|
+
import '../audio_source.cjs';
|
|
11
|
+
import '../types-f7wTlFjs.cjs';
|
|
12
|
+
import '../e2ee.cjs';
|
|
13
|
+
import '@livekit/mutex';
|
|
14
|
+
import 'node:fs';
|
|
15
|
+
import '../data_streams/stream_writer.cjs';
|
|
16
|
+
import '../rpc.cjs';
|
|
17
|
+
import '../transcription.cjs';
|
|
18
|
+
import '../types.cjs';
|
|
19
|
+
import '../video_source.cjs';
|
|
20
|
+
|
|
21
|
+
declare const hasE2EEnv: boolean;
|
|
22
|
+
declare const describeE2E: typeof describe;
|
|
23
|
+
declare const testTimeoutMs = 10000;
|
|
24
|
+
type TestEnv = {
|
|
25
|
+
url: string;
|
|
26
|
+
apiKey: string;
|
|
27
|
+
apiSecret: string;
|
|
28
|
+
};
|
|
29
|
+
declare function getTestEnv(): TestEnv;
|
|
30
|
+
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T>;
|
|
31
|
+
declare function waitFor(condition: () => boolean, opts: {
|
|
32
|
+
timeoutMs: number;
|
|
33
|
+
intervalMs?: number;
|
|
34
|
+
debugName?: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
declare function createJoinToken(params: {
|
|
37
|
+
env: TestEnv;
|
|
38
|
+
roomName: string;
|
|
39
|
+
identity: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
declare function connectTestRooms(count: number,
|
|
43
|
+
/**
|
|
44
|
+
* Extra room options applied to every room, e.g. data stream limits or
|
|
45
|
+
* `encryption` to bring up the whole set with a shared e2ee key.
|
|
46
|
+
*/
|
|
47
|
+
options?: Partial<RoomOptions>): Promise<{
|
|
48
|
+
roomName: string;
|
|
49
|
+
rooms: Room[];
|
|
50
|
+
}>;
|
|
51
|
+
declare function waitForRoomEvent<R>(room: Room, event: RoomEvent, timeoutMs: number, take: (...args: any[]) => R,
|
|
52
|
+
/** Ignore emissions that don't match, e.g. events for another participant. */
|
|
53
|
+
match?: (...args: unknown[]) => boolean): Promise<R>;
|
|
54
|
+
declare function concatUint8(chunks: Uint8Array[]): Uint8Array;
|
|
55
|
+
|
|
56
|
+
export { type TestEnv, concatUint8, connectTestRooms, createJoinToken, describeE2E, getTestEnv, hasE2EEnv, testTimeoutMs, waitFor, waitForRoomEvent, withTimeout };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe } from 'vitest';
|
|
2
|
+
import { Room, type RoomEvent, type RoomOptions } from '../index.js';
|
|
3
|
+
export declare const hasE2EEnv: boolean;
|
|
4
|
+
export declare const describeE2E: typeof describe;
|
|
5
|
+
export declare const testTimeoutMs = 10000;
|
|
6
|
+
export type TestEnv = {
|
|
7
|
+
url: string;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
apiSecret: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getTestEnv(): TestEnv;
|
|
12
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T>;
|
|
13
|
+
export declare function waitFor(condition: () => boolean, opts: {
|
|
14
|
+
timeoutMs: number;
|
|
15
|
+
intervalMs?: number;
|
|
16
|
+
debugName?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
export declare function createJoinToken(params: {
|
|
19
|
+
env: TestEnv;
|
|
20
|
+
roomName: string;
|
|
21
|
+
identity: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
export declare function connectTestRooms(count: number,
|
|
25
|
+
/**
|
|
26
|
+
* Extra room options applied to every room, e.g. data stream limits or
|
|
27
|
+
* `encryption` to bring up the whole set with a shared e2ee key.
|
|
28
|
+
*/
|
|
29
|
+
options?: Partial<RoomOptions>): Promise<{
|
|
30
|
+
roomName: string;
|
|
31
|
+
rooms: Room[];
|
|
32
|
+
}>;
|
|
33
|
+
export declare function waitForRoomEvent<R>(room: Room, event: RoomEvent, timeoutMs: number, take: (...args: any[]) => R,
|
|
34
|
+
/** Ignore emissions that don't match, e.g. events for another participant. */
|
|
35
|
+
match?: (...args: unknown[]) => boolean): Promise<R>;
|
|
36
|
+
export declare function concatUint8(chunks: Uint8Array[]): Uint8Array;
|
|
37
|
+
//# sourceMappingURL=e2e_common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e_common.d.ts","sourceRoot":"","sources":["../../src/tests/e2e_common.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,SAAS,SAC0E,CAAC;AAGjG,eAAO,MAAM,WAAW,EAAE,OAAO,QAEK,CAAC;AACvC,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF,wBAAgB,UAAU,IAAI,OAAO,CAWpC;AAED,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAQZ;AAED,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,OAAO,EACxB,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC5C,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAclB;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM;AACb;;;GAGG;AACH,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC7B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,CA4B9C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC;AAC3B,8EAA8E;AAC9E,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GACtC,OAAO,CAAC,CAAC,CAAC,CAgBZ;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAS5D"}
|
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-
|
|
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-BNVaONuH.cjs';
|
|
4
4
|
import './ffi_client.cjs';
|
|
5
5
|
import './video_source.cjs';
|
|
6
6
|
import './audio_frame.cjs';
|
|
@@ -8,7 +8,7 @@ import 'node:stream/web';
|
|
|
8
8
|
import './frame_processor.cjs';
|
|
9
9
|
import './video_frame.cjs';
|
|
10
10
|
import '@livekit/typed-emitter';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-f7wTlFjs.cjs';
|
|
12
12
|
import './e2ee.cjs';
|
|
13
13
|
import '@livekit/mutex';
|
|
14
14
|
import 'node:fs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@livekit/rtc-ffi-bindings';
|
|
2
|
-
export { d as LocalTrackPublication, h as RemoteTrackPublication,
|
|
2
|
+
export { d as LocalTrackPublication, h as RemoteTrackPublication, o as TrackPublication } from './audio_stream-BNVaONuH.cjs';
|
|
3
3
|
import 'node:stream/web';
|
|
4
4
|
import './audio_frame.cjs';
|
|
5
5
|
import './frame_processor.cjs';
|
|
@@ -7,7 +7,7 @@ import './video_frame.cjs';
|
|
|
7
7
|
import './audio_source.cjs';
|
|
8
8
|
import './ffi_client.cjs';
|
|
9
9
|
import '@livekit/typed-emitter';
|
|
10
|
-
import './types-
|
|
10
|
+
import './types-f7wTlFjs.cjs';
|
|
11
11
|
import './e2ee.cjs';
|
|
12
12
|
import '@livekit/mutex';
|
|
13
13
|
import 'node:fs';
|
|
@@ -5,9 +5,34 @@ declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
|
5
5
|
protected totalByteSize?: number;
|
|
6
6
|
protected _info: T;
|
|
7
7
|
protected bytesReceived: number;
|
|
8
|
+
private closed;
|
|
9
|
+
private activeReader;
|
|
8
10
|
get info(): T;
|
|
9
11
|
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number);
|
|
10
|
-
protected
|
|
12
|
+
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
13
|
+
/** Takes the stream's reader for an iteration, remembering it so that
|
|
14
|
+
* close() can cancel a read that is still in flight. */
|
|
15
|
+
protected acquireReader(): ReadableStreamDefaultReader<DataStream_Chunk>;
|
|
16
|
+
/** Releases the stream lock after an iteration ended on its own — because a
|
|
17
|
+
* read reported end-of-stream, or because the stream itself errored. Either
|
|
18
|
+
* way the stream is in a terminal state and the FFI subscription behind it
|
|
19
|
+
* was already dropped by that terminal event, so there is nothing to cancel.
|
|
20
|
+
*
|
|
21
|
+
* An error raised *around* a read rather than by it — a chunk that failed to
|
|
22
|
+
* process — leaves the stream live, so it has to go through close() instead. */
|
|
23
|
+
protected finishIteration(reader: ReadableStreamDefaultReader<DataStream_Chunk>): void;
|
|
24
|
+
/**
|
|
25
|
+
* Stops receiving this stream and releases the resources behind it.
|
|
26
|
+
*
|
|
27
|
+
* A reader is subscribed to FFI events from the moment it is handed to a
|
|
28
|
+
* stream handler, and only unsubscribes once a read consumes the stream's
|
|
29
|
+
* end-of-stream event. So a reader that is abandoned part-way through, or
|
|
30
|
+
* that a handler never reads at all, has to be closed here or its
|
|
31
|
+
* subscription lives for the rest of the process. Reading to completion — or
|
|
32
|
+
* breaking out of a `for await` — closes the reader for you, and closing an
|
|
33
|
+
* already-closed reader is a no-op.
|
|
34
|
+
*/
|
|
35
|
+
close(): Promise<void>;
|
|
11
36
|
onProgress?: (progress: number | undefined) => void;
|
|
12
37
|
abstract readAll(): Promise<string | Array<Uint8Array>>;
|
|
13
38
|
}
|
|
@@ -15,10 +40,9 @@ declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
|
15
40
|
* A class to read chunks from a ReadableStream and provide them in a structured format.
|
|
16
41
|
*/
|
|
17
42
|
declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
18
|
-
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
19
43
|
[Symbol.asyncIterator](): {
|
|
20
44
|
next: () => Promise<IteratorResult<Uint8Array>>;
|
|
21
|
-
return()
|
|
45
|
+
return: () => Promise<IteratorResult<Uint8Array>>;
|
|
22
46
|
};
|
|
23
47
|
readAll(): Promise<Array<Uint8Array>>;
|
|
24
48
|
}
|
|
@@ -26,13 +50,6 @@ declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
|
26
50
|
* A class to read chunks from a ReadableStream and provide them in a structured format.
|
|
27
51
|
*/
|
|
28
52
|
declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
29
|
-
private receivedChunks;
|
|
30
|
-
/**
|
|
31
|
-
* A TextStreamReader instance can be used as an AsyncIterator that returns the entire string
|
|
32
|
-
* that has been received up to the current point in time.
|
|
33
|
-
*/
|
|
34
|
-
constructor(info: TextStreamInfo, stream: ReadableStream<DataStream_Chunk>, totalChunkCount?: number);
|
|
35
|
-
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
36
53
|
/**
|
|
37
54
|
* Async iterator implementation to allow usage of `for await...of` syntax.
|
|
38
55
|
* Yields structured chunks from the stream.
|
|
@@ -40,7 +57,7 @@ declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
|
40
57
|
*/
|
|
41
58
|
[Symbol.asyncIterator](): {
|
|
42
59
|
next: () => Promise<IteratorResult<string>>;
|
|
43
|
-
return()
|
|
60
|
+
return: () => Promise<IteratorResult<string>>;
|
|
44
61
|
};
|
|
45
62
|
readAll(): Promise<string>;
|
|
46
63
|
}
|
|
@@ -76,6 +93,12 @@ interface TextStreamOptions extends DataStreamOptions {
|
|
|
76
93
|
interface ByteStreamOptions extends DataStreamOptions {
|
|
77
94
|
name?: string;
|
|
78
95
|
onProgress?: (progress: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the payload may be compressed on the wire. Defaults to true;
|
|
98
|
+
* compression is only applied when it actually reduces the payload size
|
|
99
|
+
* and every recipient supports it.
|
|
100
|
+
*/
|
|
101
|
+
compress?: boolean;
|
|
79
102
|
}
|
|
80
103
|
type ByteStreamHandler = (reader: ByteStreamReader, participantInfo: {
|
|
81
104
|
identity: string;
|
package/dist/utils.cjs
CHANGED
|
@@ -19,8 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var utils_exports = {};
|
|
20
20
|
__export(utils_exports, {
|
|
21
21
|
bigIntToNumber: () => bigIntToNumber,
|
|
22
|
+
byteStreamInfoFromProto: () => byteStreamInfoFromProto,
|
|
22
23
|
numberToBigInt: () => numberToBigInt,
|
|
23
|
-
splitUtf8: () => splitUtf8
|
|
24
|
+
splitUtf8: () => splitUtf8,
|
|
25
|
+
textStreamInfoFromProto: () => textStreamInfoFromProto
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(utils_exports);
|
|
26
28
|
function bigIntToNumber(value) {
|
|
@@ -52,10 +54,33 @@ function splitUtf8(s, n) {
|
|
|
52
54
|
}
|
|
53
55
|
return result;
|
|
54
56
|
}
|
|
57
|
+
function textStreamInfoFromProto(info) {
|
|
58
|
+
return {
|
|
59
|
+
streamId: info.streamId,
|
|
60
|
+
mimeType: info.mimeType,
|
|
61
|
+
topic: info.topic,
|
|
62
|
+
timestamp: bigIntToNumber(info.timestamp),
|
|
63
|
+
totalSize: info.totalLength ? bigIntToNumber(info.totalLength) : void 0,
|
|
64
|
+
attributes: info.attributes
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function byteStreamInfoFromProto(info) {
|
|
68
|
+
return {
|
|
69
|
+
streamId: info.streamId,
|
|
70
|
+
name: info.name ?? "unknown",
|
|
71
|
+
mimeType: info.mimeType,
|
|
72
|
+
topic: info.topic,
|
|
73
|
+
timestamp: bigIntToNumber(info.timestamp),
|
|
74
|
+
totalSize: info.totalLength !== void 0 ? bigIntToNumber(info.totalLength) : void 0,
|
|
75
|
+
attributes: info.attributes
|
|
76
|
+
};
|
|
77
|
+
}
|
|
55
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
79
|
0 && (module.exports = {
|
|
57
80
|
bigIntToNumber,
|
|
81
|
+
byteStreamInfoFromProto,
|
|
58
82
|
numberToBigInt,
|
|
59
|
-
splitUtf8
|
|
83
|
+
splitUtf8,
|
|
84
|
+
textStreamInfoFromProto
|
|
60
85
|
});
|
|
61
86
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\n/** convert bigints to numbers preserving undefined values */\nexport function bigIntToNumber<T extends bigint | undefined>(\n value: T,\n): T extends bigint ? number : undefined {\n return (value !== undefined ? Number(value) : undefined) as T extends bigint ? number : undefined;\n}\n\n/** convert numbers to bigints preserving undefined values */\nexport function numberToBigInt<T extends number | undefined>(\n value: T,\n): T extends number ? bigint : undefined {\n return (value !== undefined ? BigInt(value) : undefined) as T extends number ? bigint : undefined;\n}\n\nexport function splitUtf8(s: string, n: number): Uint8Array[] {\n if (n < 4) {\n throw new Error('n must be at least 4 due to utf8 encoding rules');\n }\n // adapted from https://stackoverflow.com/a/6043797\n const result: Uint8Array[] = [];\n let encoded = new TextEncoder().encode(s);\n while (encoded.length > n) {\n let k = n;\n while (k > 0) {\n const byte = encoded[k];\n if (byte !== undefined && (byte & 0xc0) !== 0x80) {\n break;\n }\n k--;\n }\n result.push(encoded.slice(0, k));\n encoded = encoded.slice(k);\n }\n if (encoded.length > 0) {\n result.push(encoded);\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type {\n ByteStreamInfo as ProtoByteStreamInfo,\n TextStreamInfo as ProtoTextStreamInfo,\n} from '@livekit/rtc-ffi-bindings';\nimport type { ByteStreamInfo, TextStreamInfo } from './data_streams/types.js';\n\n/** convert bigints to numbers preserving undefined values */\nexport function bigIntToNumber<T extends bigint | undefined>(\n value: T,\n): T extends bigint ? number : undefined {\n return (value !== undefined ? Number(value) : undefined) as T extends bigint ? number : undefined;\n}\n\n/** convert numbers to bigints preserving undefined values */\nexport function numberToBigInt<T extends number | undefined>(\n value: T,\n): T extends number ? bigint : undefined {\n return (value !== undefined ? BigInt(value) : undefined) as T extends number ? bigint : undefined;\n}\n\nexport function splitUtf8(s: string, n: number): Uint8Array[] {\n if (n < 4) {\n throw new Error('n must be at least 4 due to utf8 encoding rules');\n }\n // adapted from https://stackoverflow.com/a/6043797\n const result: Uint8Array[] = [];\n let encoded = new TextEncoder().encode(s);\n while (encoded.length > n) {\n let k = n;\n while (k > 0) {\n const byte = encoded[k];\n if (byte !== undefined && (byte & 0xc0) !== 0x80) {\n break;\n }\n k--;\n }\n result.push(encoded.slice(0, k));\n encoded = encoded.slice(k);\n }\n if (encoded.length > 0) {\n result.push(encoded);\n }\n return result;\n}\n\n/** @internal */\nexport function textStreamInfoFromProto(info: ProtoTextStreamInfo): TextStreamInfo {\n return {\n streamId: info.streamId!,\n mimeType: info.mimeType!,\n topic: info.topic!,\n timestamp: bigIntToNumber(info.timestamp!),\n totalSize: info.totalLength ? bigIntToNumber(info.totalLength) : undefined,\n attributes: info.attributes,\n };\n}\n\n/** @internal */\nexport function byteStreamInfoFromProto(info: ProtoByteStreamInfo): ByteStreamInfo {\n return {\n streamId: info.streamId!,\n name: info.name ?? 'unknown',\n mimeType: info.mimeType!,\n topic: info.topic!,\n timestamp: bigIntToNumber(info.timestamp!),\n totalSize: info.totalLength !== undefined ? bigIntToNumber(info.totalLength) : undefined,\n attributes: info.attributes,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,eACd,OACuC;AACvC,SAAQ,UAAU,SAAY,OAAO,KAAK,IAAI;AAChD;AAGO,SAAS,eACd,OACuC;AACvC,SAAQ,UAAU,SAAY,OAAO,KAAK,IAAI;AAChD;AAEO,SAAS,UAAU,GAAW,GAAyB;AAC5D,MAAI,IAAI,GAAG;AACT,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACnE;AAEA,QAAM,SAAuB,CAAC;AAC9B,MAAI,UAAU,IAAI,YAAY,EAAE,OAAO,CAAC;AACxC,SAAO,QAAQ,SAAS,GAAG;AACzB,QAAI,IAAI;AACR,WAAO,IAAI,GAAG;AACZ,YAAM,OAAO,QAAQ,CAAC;AACtB,UAAI,SAAS,WAAc,OAAO,SAAU,KAAM;AAChD;AAAA,MACF;AACA;AAAA,IACF;AACA,WAAO,KAAK,QAAQ,MAAM,GAAG,CAAC,CAAC;AAC/B,cAAU,QAAQ,MAAM,CAAC;AAAA,EAC3B;AACA,MAAI,QAAQ,SAAS,GAAG;AACtB,WAAO,KAAK,OAAO;AAAA,EACrB;AACA,SAAO;AACT;AAGO,SAAS,wBAAwB,MAA2C;AACjF,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,UAAU,KAAK;AAAA,IACf,OAAO,KAAK;AAAA,IACZ,WAAW,eAAe,KAAK,SAAU;AAAA,IACzC,WAAW,KAAK,cAAc,eAAe,KAAK,WAAW,IAAI;AAAA,IACjE,YAAY,KAAK;AAAA,EACnB;AACF;AAGO,SAAS,wBAAwB,MAA2C;AACjF,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,MAAM,KAAK,QAAQ;AAAA,IACnB,UAAU,KAAK;AAAA,IACf,OAAO,KAAK;AAAA,IACZ,WAAW,eAAe,KAAK,SAAU;AAAA,IACzC,WAAW,KAAK,gBAAgB,SAAY,eAAe,KAAK,WAAW,IAAI;AAAA,IAC/E,YAAY,KAAK;AAAA,EACnB;AACF;","names":[]}
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { ByteStreamInfo, TextStreamInfo } from '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import { b as ByteStreamInfo$1, e as TextStreamInfo$1 } from './types-f7wTlFjs.cjs';
|
|
3
|
+
|
|
1
4
|
/** convert bigints to numbers preserving undefined values */
|
|
2
5
|
declare function bigIntToNumber<T extends bigint | undefined>(value: T): T extends bigint ? number : undefined;
|
|
3
6
|
/** convert numbers to bigints preserving undefined values */
|
|
4
7
|
declare function numberToBigInt<T extends number | undefined>(value: T): T extends number ? bigint : undefined;
|
|
5
8
|
declare function splitUtf8(s: string, n: number): Uint8Array[];
|
|
9
|
+
/** @internal */
|
|
10
|
+
declare function textStreamInfoFromProto(info: TextStreamInfo): TextStreamInfo$1;
|
|
11
|
+
/** @internal */
|
|
12
|
+
declare function byteStreamInfoFromProto(info: ByteStreamInfo): ByteStreamInfo$1;
|
|
6
13
|
|
|
7
|
-
export { bigIntToNumber, numberToBigInt, splitUtf8 };
|
|
14
|
+
export { bigIntToNumber, byteStreamInfoFromProto, numberToBigInt, splitUtf8, textStreamInfoFromProto };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { ByteStreamInfo as ProtoByteStreamInfo, TextStreamInfo as ProtoTextStreamInfo } from '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import type { ByteStreamInfo, TextStreamInfo } from './data_streams/types.js';
|
|
1
3
|
/** convert bigints to numbers preserving undefined values */
|
|
2
4
|
export declare function bigIntToNumber<T extends bigint | undefined>(value: T): T extends bigint ? number : undefined;
|
|
3
5
|
/** convert numbers to bigints preserving undefined values */
|
|
4
6
|
export declare function numberToBigInt<T extends number | undefined>(value: T): T extends number ? bigint : undefined;
|
|
5
7
|
export declare function splitUtf8(s: string, n: number): Uint8Array[];
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function textStreamInfoFromProto(info: ProtoTextStreamInfo): TextStreamInfo;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare function byteStreamInfoFromProto(info: ProtoByteStreamInfo): ByteStreamInfo;
|
|
6
12
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,IAAI,mBAAmB,EACrC,cAAc,IAAI,mBAAmB,EACtC,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EACzD,KAAK,EAAE,CAAC,GACP,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvC;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EACzD,KAAK,EAAE,CAAC,GACP,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvC;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAuB5D;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,cAAc,CASjF;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,GAAG,cAAc,CAUjF"}
|
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.
|
|
24
|
+
const SDK_VERSION = "0.13.34";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
SDK_VERSION
|
package/dist/version.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.34\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;","names":[]}
|
package/dist/version.d.cts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.13.
|
|
1
|
+
export declare const SDK_VERSION = "0.13.34";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/video_stream.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VideoRotation } from '@livekit/rtc-ffi-bindings';
|
|
2
|
-
import { T as Track } from './audio_stream-
|
|
2
|
+
import { T as Track } from './audio_stream-BNVaONuH.cjs';
|
|
3
3
|
import { VideoFrame } from './video_frame.cjs';
|
|
4
4
|
import 'node:stream/web';
|
|
5
5
|
import './audio_frame.cjs';
|
|
@@ -7,7 +7,7 @@ import './frame_processor.cjs';
|
|
|
7
7
|
import './audio_source.cjs';
|
|
8
8
|
import './ffi_client.cjs';
|
|
9
9
|
import '@livekit/typed-emitter';
|
|
10
|
-
import './types-
|
|
10
|
+
import './types-f7wTlFjs.cjs';
|
|
11
11
|
import './e2ee.cjs';
|
|
12
12
|
import '@livekit/mutex';
|
|
13
13
|
import 'node:fs';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "LiveKit RTC Node",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "LiveKit",
|
|
6
|
-
"version": "0.13.
|
|
6
|
+
"version": "0.13.34",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
8
8
|
"types": "dist/index.d.cts",
|
|
9
9
|
"exports": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"tsup": "^8.3.5",
|
|
44
44
|
"typescript": "5.8.2",
|
|
45
45
|
"vitest": "^4.0.0",
|
|
46
|
-
"livekit-server-sdk": "2.
|
|
46
|
+
"livekit-server-sdk": "2.18.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">= 18"
|
|
@@ -146,12 +146,15 @@ function makeEndTrackingStream(): { stream: AudioStreamSource; endCount: () => n
|
|
|
146
146
|
|
|
147
147
|
function makeLocalParticipant(identity: string): LocalParticipant {
|
|
148
148
|
// Bypass the FFI-touching constructor; set only the fields the lifecycle
|
|
149
|
-
// paths read (identity getter
|
|
149
|
+
// paths read (identity getter, trackPublications map, and the open data
|
|
150
|
+
// stream writers that disconnect cleanup disposes).
|
|
150
151
|
const p = Object.create(LocalParticipant.prototype) as LocalParticipant;
|
|
151
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
153
|
(p as any).info = { identity };
|
|
153
154
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
155
|
(p as any).trackPublications = new Map();
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
|
+
(p as any).openStreamWriters = new Set();
|
|
155
158
|
return p;
|
|
156
159
|
}
|
|
157
160
|
|