@livekit/rtc-node 0.12.0 → 0.12.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.
- package/dist/audio_frame.d.cts +32 -0
- package/dist/audio_frame.d.ts +12 -5
- package/dist/audio_resampler.d.cts +60 -0
- package/dist/audio_resampler.d.ts +12 -3
- package/dist/audio_source.d.cts +37 -0
- package/dist/audio_source.d.ts +13 -5
- package/dist/audio_stream.d.cts +38 -0
- package/dist/audio_stream.d.ts +17 -5
- package/dist/e2ee.d.cts +48 -0
- package/dist/e2ee.d.ts +12 -8
- package/dist/ffi_client.cjs +0 -6
- package/dist/ffi_client.cjs.map +1 -1
- package/dist/ffi_client.d.cts +35 -0
- package/dist/ffi_client.d.ts +22 -10
- package/dist/ffi_client.d.ts.map +1 -1
- package/dist/ffi_client.js +0 -6
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.cjs +0 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -0
- package/dist/index.d.ts +27 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -20
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.cjs.map +1 -1
- package/dist/napi/native.d.d.cts +21 -0
- package/dist/napi/native.d.d.ts +21 -0
- package/dist/napi/native.d.ts +5 -5
- package/dist/native.d.ts +5 -5
- package/dist/participant.d.cts +126 -0
- package/dist/participant.d.ts +28 -14
- package/dist/proto/audio_frame_pb.d.cts +813 -0
- package/dist/proto/audio_frame_pb.d.ts +90 -86
- package/dist/proto/e2ee_pb.d.cts +585 -0
- package/dist/proto/e2ee_pb.d.ts +60 -58
- package/dist/proto/ffi_pb.d.cts +851 -0
- package/dist/proto/ffi_pb.d.ts +35 -30
- package/dist/proto/handle_pb.d.cts +33 -0
- package/dist/proto/handle_pb.d.ts +8 -6
- package/dist/proto/participant_pb.d.cts +93 -0
- package/dist/proto/participant_pb.d.ts +13 -11
- package/dist/proto/room_pb.d.cts +2072 -0
- package/dist/proto/room_pb.d.ts +198 -196
- package/dist/proto/rpc_pb.d.cts +237 -0
- package/dist/proto/rpc_pb.d.ts +28 -26
- package/dist/proto/stats_pb.d.cts +1653 -0
- package/dist/proto/stats_pb.d.ts +96 -94
- package/dist/proto/track_pb.d.cts +402 -0
- package/dist/proto/track_pb.d.ts +47 -45
- package/dist/proto/video_frame_pb.d.cts +617 -0
- package/dist/proto/video_frame_pb.d.ts +64 -60
- package/dist/room.d.cts +134 -0
- package/dist/room.d.ts +36 -22
- package/dist/rpc.d.cts +82 -0
- package/dist/rpc.d.ts +11 -7
- package/dist/track.d.cts +46 -0
- package/dist/track.d.ts +25 -14
- package/dist/track_publication.d.cts +48 -0
- package/dist/track_publication.d.ts +20 -8
- package/dist/transcription.d.cts +15 -0
- package/dist/transcription.d.ts +4 -3
- package/dist/types.d.cts +9 -0
- package/dist/types.d.ts +3 -2
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +3 -0
- package/dist/version.d.ts +3 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/video_frame.d.cts +25 -0
- package/dist/video_frame.d.ts +11 -4
- package/dist/video_source.d.cts +22 -0
- package/dist/video_source.d.ts +13 -6
- package/dist/video_stream.d.cts +41 -0
- package/dist/video_stream.d.ts +18 -6
- package/package.json +14 -9
- package/src/ffi_client.ts +4 -4
- package/src/index.ts +14 -8
- package/src/napi/native.d.ts +5 -5
- package/src/version.ts +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OwnedAudioFrameBuffer, AudioFrameBufferInfo } from './proto/audio_frame_pb.cjs';
|
|
2
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
3
|
+
import './proto/handle_pb.cjs';
|
|
4
|
+
import '@bufbuild/protobuf';
|
|
5
|
+
import './proto/track_pb.cjs';
|
|
6
|
+
import './proto/e2ee_pb.cjs';
|
|
7
|
+
import './proto/stats_pb.cjs';
|
|
8
|
+
|
|
9
|
+
declare class AudioFrame {
|
|
10
|
+
data: Int16Array;
|
|
11
|
+
sampleRate: number;
|
|
12
|
+
channels: number;
|
|
13
|
+
samplesPerChannel: number;
|
|
14
|
+
constructor(data: Int16Array, sampleRate: number, channels: number, samplesPerChannel: number);
|
|
15
|
+
static create(sampleRate: number, channels: number, samplesPerChannel: number): AudioFrame;
|
|
16
|
+
/** @internal */
|
|
17
|
+
static fromOwnedInfo(owned: OwnedAudioFrameBuffer): AudioFrame;
|
|
18
|
+
/** @internal */
|
|
19
|
+
protoInfo(): AudioFrameBufferInfo;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Combines one or more `rtc.AudioFrame` objects into a single `rtc.AudioFrame`.
|
|
23
|
+
*
|
|
24
|
+
* This function concatenates the audio data from multiple frames, ensuring that all frames have
|
|
25
|
+
* the same sample rate and number of channels. It efficiently merges the data by preallocating the
|
|
26
|
+
* necessary memory and copying the frame data without unnecessary reallocations.
|
|
27
|
+
*
|
|
28
|
+
* @param buffer - a single AudioFrame or list thereof
|
|
29
|
+
*/
|
|
30
|
+
declare const combineAudioFrames: (buffer: AudioFrame | AudioFrame[]) => AudioFrame;
|
|
31
|
+
|
|
32
|
+
export { AudioFrame, combineAudioFrames };
|
package/dist/audio_frame.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { OwnedAudioFrameBuffer, AudioFrameBufferInfo } from './proto/audio_frame_pb.js';
|
|
2
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
3
|
+
import './proto/handle_pb.js';
|
|
4
|
+
import '@bufbuild/protobuf';
|
|
5
|
+
import './proto/track_pb.js';
|
|
6
|
+
import './proto/e2ee_pb.js';
|
|
7
|
+
import './proto/stats_pb.js';
|
|
8
|
+
|
|
9
|
+
declare class AudioFrame {
|
|
4
10
|
data: Int16Array;
|
|
5
11
|
sampleRate: number;
|
|
6
12
|
channels: number;
|
|
@@ -21,5 +27,6 @@ export declare class AudioFrame {
|
|
|
21
27
|
*
|
|
22
28
|
* @param buffer - a single AudioFrame or list thereof
|
|
23
29
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
declare const combineAudioFrames: (buffer: AudioFrame | AudioFrame[]) => AudioFrame;
|
|
31
|
+
|
|
32
|
+
export { AudioFrame, combineAudioFrames };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AudioFrame } from './audio_frame.cjs';
|
|
2
|
+
import './proto/audio_frame_pb.cjs';
|
|
3
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
4
|
+
import './proto/handle_pb.cjs';
|
|
5
|
+
import '@bufbuild/protobuf';
|
|
6
|
+
import './proto/track_pb.cjs';
|
|
7
|
+
import './proto/e2ee_pb.cjs';
|
|
8
|
+
import './proto/stats_pb.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resampler quality. Higher quality settings result in better audio quality but require more
|
|
12
|
+
* processing power.
|
|
13
|
+
*/
|
|
14
|
+
declare enum AudioResamplerQuality {
|
|
15
|
+
QUICK = 0,
|
|
16
|
+
LOW = 1,
|
|
17
|
+
MEDIUM = 2,
|
|
18
|
+
HIGH = 3,
|
|
19
|
+
VERY_HIGH = 4
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* AudioResampler provides functionality to resample audio data from an input sample rate to
|
|
23
|
+
* an output sample rate using the Sox resampling library. It supports multiple channels and
|
|
24
|
+
* configurable resampling quality.
|
|
25
|
+
*/
|
|
26
|
+
declare class AudioResampler {
|
|
27
|
+
#private;
|
|
28
|
+
/**
|
|
29
|
+
* Initializes a new AudioResampler.
|
|
30
|
+
*
|
|
31
|
+
* @param inputRate - The sample rate of the input audio data (in Hz).
|
|
32
|
+
* @param outputRate - The desired sample rate of the output audio data (in Hz).
|
|
33
|
+
* @param channels - The number of audio channels (e.g., 1 for mono, 2 for stereo). Defaults to 1.
|
|
34
|
+
* @param quality - The quality setting for the resampler. Defaults to
|
|
35
|
+
* `AudioResamplerQuality.MEDIUM`.
|
|
36
|
+
*/
|
|
37
|
+
constructor(inputRate: number, outputRate: number, channels?: number, quality?: AudioResamplerQuality);
|
|
38
|
+
/**
|
|
39
|
+
* Push audio data into the resampler and retrieve any available resampled data.
|
|
40
|
+
*
|
|
41
|
+
* This method accepts audio data, resamples it according to the configured input and output rates,
|
|
42
|
+
* and returns any resampled data that is available after processing the input.
|
|
43
|
+
*
|
|
44
|
+
* @param data - The audio frame to resample
|
|
45
|
+
*
|
|
46
|
+
* @returns A list of {@link AudioFrame} objects containing the resampled audio data. The list may
|
|
47
|
+
* be empty if no output data is available yet.
|
|
48
|
+
*/
|
|
49
|
+
push(data: AudioFrame): AudioFrame[];
|
|
50
|
+
/**
|
|
51
|
+
* Flush any remaining audio data through the resampler and retrieve the resampled data.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* This method should be called when no more input data will be provided to ensure that all
|
|
55
|
+
* internal buffers are processed and all resampled data is output.
|
|
56
|
+
*/
|
|
57
|
+
flush(): AudioFrame[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { AudioResampler, AudioResamplerQuality };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { AudioFrame } from './audio_frame.js';
|
|
2
|
+
import './proto/audio_frame_pb.js';
|
|
3
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
4
|
+
import './proto/handle_pb.js';
|
|
5
|
+
import '@bufbuild/protobuf';
|
|
6
|
+
import './proto/track_pb.js';
|
|
7
|
+
import './proto/e2ee_pb.js';
|
|
8
|
+
import './proto/stats_pb.js';
|
|
9
|
+
|
|
2
10
|
/**
|
|
3
11
|
* Resampler quality. Higher quality settings result in better audio quality but require more
|
|
4
12
|
* processing power.
|
|
5
13
|
*/
|
|
6
|
-
|
|
14
|
+
declare enum AudioResamplerQuality {
|
|
7
15
|
QUICK = 0,
|
|
8
16
|
LOW = 1,
|
|
9
17
|
MEDIUM = 2,
|
|
@@ -15,7 +23,7 @@ export declare enum AudioResamplerQuality {
|
|
|
15
23
|
* an output sample rate using the Sox resampling library. It supports multiple channels and
|
|
16
24
|
* configurable resampling quality.
|
|
17
25
|
*/
|
|
18
|
-
|
|
26
|
+
declare class AudioResampler {
|
|
19
27
|
#private;
|
|
20
28
|
/**
|
|
21
29
|
* Initializes a new AudioResampler.
|
|
@@ -48,4 +56,5 @@ export declare class AudioResampler {
|
|
|
48
56
|
*/
|
|
49
57
|
flush(): AudioFrame[];
|
|
50
58
|
}
|
|
51
|
-
|
|
59
|
+
|
|
60
|
+
export { AudioResampler, AudioResamplerQuality };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AudioFrame } from './audio_frame.cjs';
|
|
2
|
+
import { FfiHandle } from './napi/native.d.cjs';
|
|
3
|
+
import { AudioSourceInfo } from './proto/audio_frame_pb.cjs';
|
|
4
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
5
|
+
import './proto/handle_pb.cjs';
|
|
6
|
+
import '@bufbuild/protobuf';
|
|
7
|
+
import './proto/track_pb.cjs';
|
|
8
|
+
import './proto/e2ee_pb.cjs';
|
|
9
|
+
import './proto/stats_pb.cjs';
|
|
10
|
+
|
|
11
|
+
declare class AudioSource {
|
|
12
|
+
/** @internal */
|
|
13
|
+
info: AudioSourceInfo;
|
|
14
|
+
/** @internal */
|
|
15
|
+
ffiHandle: FfiHandle;
|
|
16
|
+
/** @internal */
|
|
17
|
+
lastCapture: number;
|
|
18
|
+
/** @internal */
|
|
19
|
+
currentQueueSize: number;
|
|
20
|
+
/** @internal */
|
|
21
|
+
release: () => void;
|
|
22
|
+
promise: Promise<void>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
timeout?: ReturnType<typeof setTimeout>;
|
|
25
|
+
sampleRate: number;
|
|
26
|
+
numChannels: number;
|
|
27
|
+
queueSize: number;
|
|
28
|
+
constructor(sampleRate: number, numChannels: number, queueSize?: number);
|
|
29
|
+
get queuedDuration(): number;
|
|
30
|
+
clearQueue(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
newPromise(): Promise<void>;
|
|
33
|
+
waitForPlayout(): Promise<void>;
|
|
34
|
+
captureFrame(frame: AudioFrame): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { AudioSource };
|
package/dist/audio_source.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { FfiHandle } from './napi/native.js';
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { AudioFrame } from './audio_frame.js';
|
|
2
|
+
import { FfiHandle } from './napi/native.d.js';
|
|
3
|
+
import { AudioSourceInfo } from './proto/audio_frame_pb.js';
|
|
4
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
5
|
+
import './proto/handle_pb.js';
|
|
6
|
+
import '@bufbuild/protobuf';
|
|
7
|
+
import './proto/track_pb.js';
|
|
8
|
+
import './proto/e2ee_pb.js';
|
|
9
|
+
import './proto/stats_pb.js';
|
|
10
|
+
|
|
11
|
+
declare class AudioSource {
|
|
5
12
|
/** @internal */
|
|
6
13
|
info: AudioSourceInfo;
|
|
7
14
|
/** @internal */
|
|
@@ -26,4 +33,5 @@ export declare class AudioSource {
|
|
|
26
33
|
waitForPlayout(): Promise<void>;
|
|
27
34
|
captureFrame(frame: AudioFrame): Promise<void>;
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
|
|
37
|
+
export { AudioSource };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Mutex } from '@livekit/mutex';
|
|
2
|
+
import { AudioFrame } from './audio_frame.cjs';
|
|
3
|
+
import { FfiHandle } from './napi/native.d.cjs';
|
|
4
|
+
import { AudioStreamInfo } from './proto/audio_frame_pb.cjs';
|
|
5
|
+
import { Track } from './track.cjs';
|
|
6
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
7
|
+
import './proto/handle_pb.cjs';
|
|
8
|
+
import '@bufbuild/protobuf';
|
|
9
|
+
import './proto/track_pb.cjs';
|
|
10
|
+
import './proto/e2ee_pb.cjs';
|
|
11
|
+
import './proto/stats_pb.cjs';
|
|
12
|
+
import './audio_source.cjs';
|
|
13
|
+
import './video_source.cjs';
|
|
14
|
+
import './proto/video_frame_pb.cjs';
|
|
15
|
+
import './video_frame.cjs';
|
|
16
|
+
|
|
17
|
+
declare class AudioStream implements AsyncIterableIterator<AudioFrame> {
|
|
18
|
+
/** @internal */
|
|
19
|
+
info: AudioStreamInfo;
|
|
20
|
+
/** @internal */
|
|
21
|
+
ffiHandle: FfiHandle;
|
|
22
|
+
/** @internal */
|
|
23
|
+
eventQueue: (AudioFrame | null)[];
|
|
24
|
+
/** @internal */
|
|
25
|
+
queueResolve: ((value: IteratorResult<AudioFrame>) => void) | null;
|
|
26
|
+
/** @internal */
|
|
27
|
+
mutex: Mutex;
|
|
28
|
+
track: Track;
|
|
29
|
+
sampleRate: number;
|
|
30
|
+
numChannels: number;
|
|
31
|
+
constructor(track: Track, sampleRate?: number, numChannels?: number);
|
|
32
|
+
private onEvent;
|
|
33
|
+
next(): Promise<IteratorResult<AudioFrame>>;
|
|
34
|
+
close(): void;
|
|
35
|
+
[Symbol.asyncIterator](): AudioStream;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { AudioStream };
|
package/dist/audio_stream.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { Mutex } from '@livekit/mutex';
|
|
2
2
|
import { AudioFrame } from './audio_frame.js';
|
|
3
|
-
import { FfiHandle } from './
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
3
|
+
import { FfiHandle } from './napi/native.d.js';
|
|
4
|
+
import { AudioStreamInfo } from './proto/audio_frame_pb.js';
|
|
5
|
+
import { Track } from './track.js';
|
|
6
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
7
|
+
import './proto/handle_pb.js';
|
|
8
|
+
import '@bufbuild/protobuf';
|
|
9
|
+
import './proto/track_pb.js';
|
|
10
|
+
import './proto/e2ee_pb.js';
|
|
11
|
+
import './proto/stats_pb.js';
|
|
12
|
+
import './audio_source.js';
|
|
13
|
+
import './video_source.js';
|
|
14
|
+
import './proto/video_frame_pb.js';
|
|
15
|
+
import './video_frame.js';
|
|
16
|
+
|
|
17
|
+
declare class AudioStream implements AsyncIterableIterator<AudioFrame> {
|
|
7
18
|
/** @internal */
|
|
8
19
|
info: AudioStreamInfo;
|
|
9
20
|
/** @internal */
|
|
@@ -23,4 +34,5 @@ export declare class AudioStream implements AsyncIterableIterator<AudioFrame> {
|
|
|
23
34
|
close(): void;
|
|
24
35
|
[Symbol.asyncIterator](): AudioStream;
|
|
25
36
|
}
|
|
26
|
-
|
|
37
|
+
|
|
38
|
+
export { AudioStream };
|
package/dist/e2ee.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EncryptionType } from './proto/e2ee_pb.cjs';
|
|
2
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
3
|
+
import '@bufbuild/protobuf';
|
|
4
|
+
|
|
5
|
+
interface KeyProviderOptions {
|
|
6
|
+
sharedKey?: Uint8Array;
|
|
7
|
+
ratchetSalt: Uint8Array;
|
|
8
|
+
ratchetWindowSize: number;
|
|
9
|
+
failureTolerance: number;
|
|
10
|
+
}
|
|
11
|
+
declare const defaultKeyProviderOptions: KeyProviderOptions;
|
|
12
|
+
interface E2EEOptions {
|
|
13
|
+
keyProviderOptions: KeyProviderOptions;
|
|
14
|
+
encryptionType: EncryptionType;
|
|
15
|
+
}
|
|
16
|
+
declare const defaultE2EEOptions: E2EEOptions;
|
|
17
|
+
declare class KeyProvider {
|
|
18
|
+
private roomHandle;
|
|
19
|
+
options: KeyProviderOptions;
|
|
20
|
+
/** internal */
|
|
21
|
+
constructor(roomHandle: bigint, opts: KeyProviderOptions);
|
|
22
|
+
setSharedKey(sharedKey: Uint8Array, keyIndex: number): void;
|
|
23
|
+
exportSharedKey(keyIndex: number): Uint8Array;
|
|
24
|
+
ratchetSharedKey(keyIndex: number): Uint8Array;
|
|
25
|
+
setKey(participantIdentity: string, keyIndex: number): void;
|
|
26
|
+
exportKey(participantIdentity: string, keyIndex: number): Uint8Array;
|
|
27
|
+
ratchetKey(participantIdentity: string, keyIndex: number): Uint8Array;
|
|
28
|
+
}
|
|
29
|
+
declare class FrameCryptor {
|
|
30
|
+
private roomHandle;
|
|
31
|
+
participantIdentity: string;
|
|
32
|
+
keyIndex: number;
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
constructor(roomHandle: bigint, participantIdentity: string, keyIndex: number, enabled: boolean);
|
|
35
|
+
setEnabled(enabled: boolean): void;
|
|
36
|
+
setKeyIndex(keyIndex: number): void;
|
|
37
|
+
}
|
|
38
|
+
declare class E2EEManager {
|
|
39
|
+
private roomHandle;
|
|
40
|
+
private options;
|
|
41
|
+
private keyProvider?;
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
constructor(roomHandle: bigint, opts?: E2EEOptions);
|
|
44
|
+
setEnabled(enabled: boolean): void;
|
|
45
|
+
frameCryptors(): FrameCryptor[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { E2EEManager, type E2EEOptions, FrameCryptor, KeyProvider, type KeyProviderOptions, defaultE2EEOptions, defaultKeyProviderOptions };
|
package/dist/e2ee.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { EncryptionType } from './proto/e2ee_pb.js';
|
|
2
|
-
|
|
2
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
3
|
+
import '@bufbuild/protobuf';
|
|
4
|
+
|
|
5
|
+
interface KeyProviderOptions {
|
|
3
6
|
sharedKey?: Uint8Array;
|
|
4
7
|
ratchetSalt: Uint8Array;
|
|
5
8
|
ratchetWindowSize: number;
|
|
6
9
|
failureTolerance: number;
|
|
7
10
|
}
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
declare const defaultKeyProviderOptions: KeyProviderOptions;
|
|
12
|
+
interface E2EEOptions {
|
|
10
13
|
keyProviderOptions: KeyProviderOptions;
|
|
11
14
|
encryptionType: EncryptionType;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
declare const defaultE2EEOptions: E2EEOptions;
|
|
17
|
+
declare class KeyProvider {
|
|
15
18
|
private roomHandle;
|
|
16
19
|
options: KeyProviderOptions;
|
|
17
20
|
/** internal */
|
|
@@ -23,7 +26,7 @@ export declare class KeyProvider {
|
|
|
23
26
|
exportKey(participantIdentity: string, keyIndex: number): Uint8Array;
|
|
24
27
|
ratchetKey(participantIdentity: string, keyIndex: number): Uint8Array;
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
declare class FrameCryptor {
|
|
27
30
|
private roomHandle;
|
|
28
31
|
participantIdentity: string;
|
|
29
32
|
keyIndex: number;
|
|
@@ -32,7 +35,7 @@ export declare class FrameCryptor {
|
|
|
32
35
|
setEnabled(enabled: boolean): void;
|
|
33
36
|
setKeyIndex(keyIndex: number): void;
|
|
34
37
|
}
|
|
35
|
-
|
|
38
|
+
declare class E2EEManager {
|
|
36
39
|
private roomHandle;
|
|
37
40
|
private options;
|
|
38
41
|
private keyProvider?;
|
|
@@ -41,4 +44,5 @@ export declare class E2EEManager {
|
|
|
41
44
|
setEnabled(enabled: boolean): void;
|
|
42
45
|
frameCryptors(): FrameCryptor[];
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
|
|
48
|
+
export { E2EEManager, type E2EEOptions, FrameCryptor, KeyProvider, type KeyProviderOptions, defaultE2EEOptions, defaultKeyProviderOptions };
|
package/dist/ffi_client.cjs
CHANGED
|
@@ -30,10 +30,7 @@ var ffi_client_exports = {};
|
|
|
30
30
|
__export(ffi_client_exports, {
|
|
31
31
|
FfiClient: () => FfiClient,
|
|
32
32
|
FfiClientEvent: () => FfiClientEvent,
|
|
33
|
-
FfiEvent: () => import_ffi_pb.FfiEvent,
|
|
34
33
|
FfiHandle: () => import_native.FfiHandle,
|
|
35
|
-
FfiRequest: () => import_ffi_pb.FfiRequest,
|
|
36
|
-
FfiResponse: () => import_ffi_pb.FfiResponse,
|
|
37
34
|
dispose: () => import_native.livekitDispose
|
|
38
35
|
});
|
|
39
36
|
module.exports = __toCommonJS(ffi_client_exports);
|
|
@@ -92,10 +89,7 @@ class FfiClient extends import_events.default {
|
|
|
92
89
|
0 && (module.exports = {
|
|
93
90
|
FfiClient,
|
|
94
91
|
FfiClientEvent,
|
|
95
|
-
FfiEvent,
|
|
96
92
|
FfiHandle,
|
|
97
|
-
FfiRequest,
|
|
98
|
-
FfiResponse,
|
|
99
93
|
dispose
|
|
100
94
|
});
|
|
101
95
|
//# sourceMappingURL=ffi_client.cjs.map
|
package/dist/ffi_client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ffi_client.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { MessageInitShape } from '@bufbuild/protobuf';\nimport { create, fromBinary, toBinary } from '@bufbuild/protobuf';\nimport type { TypedEventEmitter as TypedEmitter } from '@livekit/typed-emitter';\nimport EventEmitter from 'events';\nimport {\n FfiHandle,\n livekitCopyBuffer,\n livekitDispose,\n livekitFfiRequest,\n livekitInitialize,\n livekitRetrievePtr,\n} from './napi/native.js';\nimport {\n FfiEvent,\n FfiEventSchema,\n FfiRequest,\n FfiRequestSchema,\n FfiResponse,\n FfiResponseSchema,\n} from './proto/ffi_pb.js';\nimport { SDK_VERSION } from './version.js';\n\nexport { FfiHandle, FfiEvent, FfiResponse, FfiRequest, livekitDispose as dispose };\n\nexport type FfiClientCallbacks = {\n ffi_event: (event: FfiEvent) => void;\n};\n\nexport enum FfiClientEvent {\n FfiEvent = 'ffi_event',\n}\n\nexport class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClientCallbacks>) {\n static _client?: FfiClient;\n\n /** @internal */\n static get instance(): FfiClient {\n if (!FfiClient._client) FfiClient._client = new FfiClient();\n\n return FfiClient._client;\n }\n\n constructor() {\n super();\n this.setMaxListeners(0);\n\n livekitInitialize(\n (event_data: Uint8Array) => {\n const event = fromBinary(FfiEventSchema, event_data);\n this.emit(FfiClientEvent.FfiEvent, event);\n },\n true,\n SDK_VERSION,\n );\n }\n\n request<T>(req: MessageInitShape<typeof FfiRequestSchema>): T {\n const request = create(FfiRequestSchema, req);\n const req_data = toBinary(FfiRequestSchema, request);\n const res_data = livekitFfiRequest(req_data);\n return fromBinary(FfiResponseSchema, res_data).message.value as T;\n }\n\n copyBuffer(ptr: bigint, len: number): Uint8Array {\n return livekitCopyBuffer(ptr, len);\n }\n\n retrievePtr(data: Uint8Array): bigint {\n return livekitRetrievePtr(data);\n }\n\n async waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T> {\n return new Promise<T>((resolve) => {\n const listener = (ev: FfiEvent) => {\n if (predicate(ev)) {\n this.off(FfiClientEvent.FfiEvent, listener);\n resolve(ev.message.value as T);\n }\n };\n this.on(FfiClientEvent.FfiEvent, listener);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../src/ffi_client.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { MessageInitShape } from '@bufbuild/protobuf';\nimport { create, fromBinary, toBinary } from '@bufbuild/protobuf';\nimport type { TypedEventEmitter as TypedEmitter } from '@livekit/typed-emitter';\nimport EventEmitter from 'events';\nimport {\n FfiHandle,\n livekitCopyBuffer,\n livekitDispose,\n livekitFfiRequest,\n livekitInitialize,\n livekitRetrievePtr,\n} from './napi/native.js';\nimport {\n type FfiEvent,\n FfiEventSchema,\n type FfiRequest,\n FfiRequestSchema,\n type FfiResponse,\n FfiResponseSchema,\n} from './proto/ffi_pb.js';\nimport { SDK_VERSION } from './version.js';\n\nexport { FfiHandle, type FfiEvent, type FfiResponse, type FfiRequest, livekitDispose as dispose };\n\nexport type FfiClientCallbacks = {\n ffi_event: (event: FfiEvent) => void;\n};\n\nexport enum FfiClientEvent {\n FfiEvent = 'ffi_event',\n}\n\nexport class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClientCallbacks>) {\n static _client?: FfiClient;\n\n /** @internal */\n static get instance(): FfiClient {\n if (!FfiClient._client) FfiClient._client = new FfiClient();\n\n return FfiClient._client;\n }\n\n constructor() {\n super();\n this.setMaxListeners(0);\n\n livekitInitialize(\n (event_data: Uint8Array) => {\n const event = fromBinary(FfiEventSchema, event_data);\n this.emit(FfiClientEvent.FfiEvent, event);\n },\n true,\n SDK_VERSION,\n );\n }\n\n request<T>(req: MessageInitShape<typeof FfiRequestSchema>): T {\n const request = create(FfiRequestSchema, req);\n const req_data = toBinary(FfiRequestSchema, request);\n const res_data = livekitFfiRequest(req_data);\n return fromBinary(FfiResponseSchema, res_data).message.value as T;\n }\n\n copyBuffer(ptr: bigint, len: number): Uint8Array {\n return livekitCopyBuffer(ptr, len);\n }\n\n retrievePtr(data: Uint8Array): bigint {\n return livekitRetrievePtr(data);\n }\n\n async waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T> {\n return new Promise<T>((resolve) => {\n const listener = (ev: FfiEvent) => {\n if (predicate(ev)) {\n this.off(FfiClientEvent.FfiEvent, listener);\n resolve(ev.message.value as T);\n }\n };\n this.on(FfiClientEvent.FfiEvent, listener);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAA6C;AAE7C,oBAAyB;AACzB,oBAOO;AACP,oBAOO;AACP,qBAA4B;AAQrB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,cAAW;AADD,SAAAA;AAAA,GAAA;AAIL,MAAM,kBAAmB,cAAAC,QAA4D;AAAA;AAAA,EAI1F,WAAW,WAAsB;AAC/B,QAAI,CAAC,UAAU,QAAS,WAAU,UAAU,IAAI,UAAU;AAE1D,WAAO,UAAU;AAAA,EACnB;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,gBAAgB,CAAC;AAEtB;AAAA,MACE,CAAC,eAA2B;AAC1B,cAAM,YAAQ,4BAAW,8BAAgB,UAAU;AACnD,aAAK,KAAK,4BAAyB,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAW,KAAmD;AAC5D,UAAM,cAAU,wBAAO,gCAAkB,GAAG;AAC5C,UAAM,eAAW,0BAAS,gCAAkB,OAAO;AACnD,UAAM,eAAW,iCAAkB,QAAQ;AAC3C,eAAO,4BAAW,iCAAmB,QAAQ,EAAE,QAAQ;AAAA,EACzD;AAAA,EAEA,WAAW,KAAa,KAAyB;AAC/C,eAAO,iCAAkB,KAAK,GAAG;AAAA,EACnC;AAAA,EAEA,YAAY,MAA0B;AACpC,eAAO,kCAAmB,IAAI;AAAA,EAChC;AAAA,EAEA,MAAM,QAAW,WAAkD;AACjE,WAAO,IAAI,QAAW,CAAC,YAAY;AACjC,YAAM,WAAW,CAAC,OAAiB;AACjC,YAAI,UAAU,EAAE,GAAG;AACjB,eAAK,IAAI,4BAAyB,QAAQ;AAC1C,kBAAQ,GAAG,QAAQ,KAAU;AAAA,QAC/B;AAAA,MACF;AACA,WAAK,GAAG,4BAAyB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":["FfiClientEvent","EventEmitter"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MessageInitShape } from '@bufbuild/protobuf';
|
|
2
|
+
import { TypedEventEmitter } from '@livekit/typed-emitter';
|
|
3
|
+
export { FfiHandle, livekitDispose as dispose } from './napi/native.d.cjs';
|
|
4
|
+
import { FfiEvent, FfiRequestSchema } from './proto/ffi_pb.cjs';
|
|
5
|
+
export { FfiRequest, FfiResponse } from './proto/ffi_pb.cjs';
|
|
6
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
7
|
+
import './proto/e2ee_pb.cjs';
|
|
8
|
+
import './proto/track_pb.cjs';
|
|
9
|
+
import './proto/handle_pb.cjs';
|
|
10
|
+
import './proto/stats_pb.cjs';
|
|
11
|
+
import './proto/room_pb.cjs';
|
|
12
|
+
import './proto/participant_pb.cjs';
|
|
13
|
+
import './proto/video_frame_pb.cjs';
|
|
14
|
+
import './proto/audio_frame_pb.cjs';
|
|
15
|
+
import './proto/rpc_pb.cjs';
|
|
16
|
+
|
|
17
|
+
type FfiClientCallbacks = {
|
|
18
|
+
ffi_event: (event: FfiEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
declare enum FfiClientEvent {
|
|
21
|
+
FfiEvent = "ffi_event"
|
|
22
|
+
}
|
|
23
|
+
declare const FfiClient_base: new () => TypedEventEmitter<FfiClientCallbacks>;
|
|
24
|
+
declare class FfiClient extends FfiClient_base {
|
|
25
|
+
static _client?: FfiClient;
|
|
26
|
+
/** @internal */
|
|
27
|
+
static get instance(): FfiClient;
|
|
28
|
+
constructor();
|
|
29
|
+
request<T>(req: MessageInitShape<typeof FfiRequestSchema>): T;
|
|
30
|
+
copyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
31
|
+
retrievePtr(data: Uint8Array): bigint;
|
|
32
|
+
waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { FfiClient, type FfiClientCallbacks, FfiClientEvent, FfiEvent };
|
package/dist/ffi_client.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { FfiEvent,
|
|
5
|
-
export {
|
|
6
|
-
|
|
1
|
+
import { MessageInitShape } from '@bufbuild/protobuf';
|
|
2
|
+
import { TypedEventEmitter } from '@livekit/typed-emitter';
|
|
3
|
+
export { FfiHandle, livekitDispose as dispose } from './napi/native.d.js';
|
|
4
|
+
import { FfiEvent, FfiRequestSchema } from './proto/ffi_pb.js';
|
|
5
|
+
export { FfiRequest, FfiResponse } from './proto/ffi_pb.js';
|
|
6
|
+
import '@bufbuild/protobuf/codegenv1';
|
|
7
|
+
import './proto/e2ee_pb.js';
|
|
8
|
+
import './proto/track_pb.js';
|
|
9
|
+
import './proto/handle_pb.js';
|
|
10
|
+
import './proto/stats_pb.js';
|
|
11
|
+
import './proto/room_pb.js';
|
|
12
|
+
import './proto/participant_pb.js';
|
|
13
|
+
import './proto/video_frame_pb.js';
|
|
14
|
+
import './proto/audio_frame_pb.js';
|
|
15
|
+
import './proto/rpc_pb.js';
|
|
16
|
+
|
|
17
|
+
type FfiClientCallbacks = {
|
|
7
18
|
ffi_event: (event: FfiEvent) => void;
|
|
8
19
|
};
|
|
9
|
-
|
|
20
|
+
declare enum FfiClientEvent {
|
|
10
21
|
FfiEvent = "ffi_event"
|
|
11
22
|
}
|
|
12
|
-
declare const FfiClient_base: new () =>
|
|
13
|
-
|
|
23
|
+
declare const FfiClient_base: new () => TypedEventEmitter<FfiClientCallbacks>;
|
|
24
|
+
declare class FfiClient extends FfiClient_base {
|
|
14
25
|
static _client?: FfiClient;
|
|
15
26
|
/** @internal */
|
|
16
27
|
static get instance(): FfiClient;
|
|
@@ -20,4 +31,5 @@ export declare class FfiClient extends FfiClient_base {
|
|
|
20
31
|
retrievePtr(data: Uint8Array): bigint;
|
|
21
32
|
waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T>;
|
|
22
33
|
}
|
|
23
|
-
|
|
34
|
+
|
|
35
|
+
export { FfiClient, type FfiClientCallbacks, FfiClientEvent, FfiEvent };
|
package/dist/ffi_client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ffi_client.d.ts","sourceRoot":"","sources":["../src/ffi_client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"ffi_client.d.ts","sourceRoot":"","sources":["../src/ffi_client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,cAAc,IAAI,OAAO,EAAE,CAAC;AAElG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,oBAAY,cAAc;IACxB,QAAQ,cAAc;CACvB;wCAEyD,YAAY,CAAC,kBAAkB,CAAC;AAA1F,qBAAa,SAAU,SAAQ,cAA4D;IACzF,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAE3B,gBAAgB;IAChB,MAAM,KAAK,QAAQ,IAAI,SAAS,CAI/B;;IAgBD,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,GAAG,CAAC;IAO7D,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU;IAIhD,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAI/B,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAWnE"}
|
package/dist/ffi_client.js
CHANGED
|
@@ -9,11 +9,8 @@ import {
|
|
|
9
9
|
livekitRetrievePtr
|
|
10
10
|
} from "./napi/native.js";
|
|
11
11
|
import {
|
|
12
|
-
FfiEvent,
|
|
13
12
|
FfiEventSchema,
|
|
14
|
-
FfiRequest,
|
|
15
13
|
FfiRequestSchema,
|
|
16
|
-
FfiResponse,
|
|
17
14
|
FfiResponseSchema
|
|
18
15
|
} from "./proto/ffi_pb.js";
|
|
19
16
|
import { SDK_VERSION } from "./version.js";
|
|
@@ -66,10 +63,7 @@ class FfiClient extends EventEmitter {
|
|
|
66
63
|
export {
|
|
67
64
|
FfiClient,
|
|
68
65
|
FfiClientEvent,
|
|
69
|
-
FfiEvent,
|
|
70
66
|
FfiHandle,
|
|
71
|
-
FfiRequest,
|
|
72
|
-
FfiResponse,
|
|
73
67
|
livekitDispose as dispose
|
|
74
68
|
};
|
|
75
69
|
//# sourceMappingURL=ffi_client.js.map
|
package/dist/ffi_client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ffi_client.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { MessageInitShape } from '@bufbuild/protobuf';\nimport { create, fromBinary, toBinary } from '@bufbuild/protobuf';\nimport type { TypedEventEmitter as TypedEmitter } from '@livekit/typed-emitter';\nimport EventEmitter from 'events';\nimport {\n FfiHandle,\n livekitCopyBuffer,\n livekitDispose,\n livekitFfiRequest,\n livekitInitialize,\n livekitRetrievePtr,\n} from './napi/native.js';\nimport {\n FfiEvent,\n FfiEventSchema,\n FfiRequest,\n FfiRequestSchema,\n FfiResponse,\n FfiResponseSchema,\n} from './proto/ffi_pb.js';\nimport { SDK_VERSION } from './version.js';\n\nexport { FfiHandle, FfiEvent, FfiResponse, FfiRequest, livekitDispose as dispose };\n\nexport type FfiClientCallbacks = {\n ffi_event: (event: FfiEvent) => void;\n};\n\nexport enum FfiClientEvent {\n FfiEvent = 'ffi_event',\n}\n\nexport class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClientCallbacks>) {\n static _client?: FfiClient;\n\n /** @internal */\n static get instance(): FfiClient {\n if (!FfiClient._client) FfiClient._client = new FfiClient();\n\n return FfiClient._client;\n }\n\n constructor() {\n super();\n this.setMaxListeners(0);\n\n livekitInitialize(\n (event_data: Uint8Array) => {\n const event = fromBinary(FfiEventSchema, event_data);\n this.emit(FfiClientEvent.FfiEvent, event);\n },\n true,\n SDK_VERSION,\n );\n }\n\n request<T>(req: MessageInitShape<typeof FfiRequestSchema>): T {\n const request = create(FfiRequestSchema, req);\n const req_data = toBinary(FfiRequestSchema, request);\n const res_data = livekitFfiRequest(req_data);\n return fromBinary(FfiResponseSchema, res_data).message.value as T;\n }\n\n copyBuffer(ptr: bigint, len: number): Uint8Array {\n return livekitCopyBuffer(ptr, len);\n }\n\n retrievePtr(data: Uint8Array): bigint {\n return livekitRetrievePtr(data);\n }\n\n async waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T> {\n return new Promise<T>((resolve) => {\n const listener = (ev: FfiEvent) => {\n if (predicate(ev)) {\n this.off(FfiClientEvent.FfiEvent, listener);\n resolve(ev.message.value as T);\n }\n };\n this.on(FfiClientEvent.FfiEvent, listener);\n });\n }\n}\n"],"mappings":"AAIA,SAAS,QAAQ,YAAY,gBAAgB;AAE7C,OAAO,kBAAkB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/ffi_client.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { MessageInitShape } from '@bufbuild/protobuf';\nimport { create, fromBinary, toBinary } from '@bufbuild/protobuf';\nimport type { TypedEventEmitter as TypedEmitter } from '@livekit/typed-emitter';\nimport EventEmitter from 'events';\nimport {\n FfiHandle,\n livekitCopyBuffer,\n livekitDispose,\n livekitFfiRequest,\n livekitInitialize,\n livekitRetrievePtr,\n} from './napi/native.js';\nimport {\n type FfiEvent,\n FfiEventSchema,\n type FfiRequest,\n FfiRequestSchema,\n type FfiResponse,\n FfiResponseSchema,\n} from './proto/ffi_pb.js';\nimport { SDK_VERSION } from './version.js';\n\nexport { FfiHandle, type FfiEvent, type FfiResponse, type FfiRequest, livekitDispose as dispose };\n\nexport type FfiClientCallbacks = {\n ffi_event: (event: FfiEvent) => void;\n};\n\nexport enum FfiClientEvent {\n FfiEvent = 'ffi_event',\n}\n\nexport class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClientCallbacks>) {\n static _client?: FfiClient;\n\n /** @internal */\n static get instance(): FfiClient {\n if (!FfiClient._client) FfiClient._client = new FfiClient();\n\n return FfiClient._client;\n }\n\n constructor() {\n super();\n this.setMaxListeners(0);\n\n livekitInitialize(\n (event_data: Uint8Array) => {\n const event = fromBinary(FfiEventSchema, event_data);\n this.emit(FfiClientEvent.FfiEvent, event);\n },\n true,\n SDK_VERSION,\n );\n }\n\n request<T>(req: MessageInitShape<typeof FfiRequestSchema>): T {\n const request = create(FfiRequestSchema, req);\n const req_data = toBinary(FfiRequestSchema, request);\n const res_data = livekitFfiRequest(req_data);\n return fromBinary(FfiResponseSchema, res_data).message.value as T;\n }\n\n copyBuffer(ptr: bigint, len: number): Uint8Array {\n return livekitCopyBuffer(ptr, len);\n }\n\n retrievePtr(data: Uint8Array): bigint {\n return livekitRetrievePtr(data);\n }\n\n async waitFor<T>(predicate: (ev: FfiEvent) => boolean): Promise<T> {\n return new Promise<T>((resolve) => {\n const listener = (ev: FfiEvent) => {\n if (predicate(ev)) {\n this.off(FfiClientEvent.FfiEvent, listener);\n resolve(ev.message.value as T);\n }\n };\n this.on(FfiClientEvent.FfiEvent, listener);\n });\n }\n}\n"],"mappings":"AAIA,SAAS,QAAQ,YAAY,gBAAgB;AAE7C,OAAO,kBAAkB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,mBAAmB;AAQrB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,cAAW;AADD,SAAAA;AAAA,GAAA;AAIL,MAAM,kBAAmB,aAA4D;AAAA;AAAA,EAI1F,WAAW,WAAsB;AAC/B,QAAI,CAAC,UAAU,QAAS,WAAU,UAAU,IAAI,UAAU;AAE1D,WAAO,UAAU;AAAA,EACnB;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,gBAAgB,CAAC;AAEtB;AAAA,MACE,CAAC,eAA2B;AAC1B,cAAM,QAAQ,WAAW,gBAAgB,UAAU;AACnD,aAAK,KAAK,4BAAyB,KAAK;AAAA,MAC1C;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAW,KAAmD;AAC5D,UAAM,UAAU,OAAO,kBAAkB,GAAG;AAC5C,UAAM,WAAW,SAAS,kBAAkB,OAAO;AACnD,UAAM,WAAW,kBAAkB,QAAQ;AAC3C,WAAO,WAAW,mBAAmB,QAAQ,EAAE,QAAQ;AAAA,EACzD;AAAA,EAEA,WAAW,KAAa,KAAyB;AAC/C,WAAO,kBAAkB,KAAK,GAAG;AAAA,EACnC;AAAA,EAEA,YAAY,MAA0B;AACpC,WAAO,mBAAmB,IAAI;AAAA,EAChC;AAAA,EAEA,MAAM,QAAW,WAAkD;AACjE,WAAO,IAAI,QAAW,CAAC,YAAY;AACjC,YAAM,WAAW,CAAC,OAAiB;AACjC,YAAI,UAAU,EAAE,GAAG;AACjB,eAAK,IAAI,4BAAyB,QAAQ;AAC1C,kBAAQ,GAAG,QAAQ,KAAU;AAAA,QAC/B;AAAA,MACF;AACA,WAAK,GAAG,4BAAyB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AACF;","names":["FfiClientEvent"]}
|