@livekit/rtc-node 0.12.2 → 0.13.1
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.cjs +2 -2
- package/dist/audio_frame.cjs.map +1 -1
- package/dist/audio_frame.d.cts +2 -3
- package/dist/audio_frame.d.ts +2 -3
- package/dist/audio_frame.d.ts.map +1 -1
- package/dist/audio_frame.js +3 -3
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_resampler.cjs +10 -7
- package/dist/audio_resampler.cjs.map +1 -1
- package/dist/audio_resampler.d.cts +2 -3
- package/dist/audio_resampler.d.ts +2 -3
- package/dist/audio_resampler.d.ts.map +1 -1
- package/dist/audio_resampler.js +13 -10
- package/dist/audio_resampler.js.map +1 -1
- package/dist/audio_source.cjs +6 -4
- package/dist/audio_source.cjs.map +1 -1
- package/dist/audio_source.d.cts +3 -3
- package/dist/audio_source.d.ts +3 -3
- package/dist/audio_source.d.ts.map +1 -1
- package/dist/audio_source.js +9 -7
- package/dist/audio_source.js.map +1 -1
- package/dist/audio_stream.cjs +1 -2
- package/dist/audio_stream.cjs.map +1 -1
- package/dist/audio_stream.d.cts +2 -3
- package/dist/audio_stream.d.ts +2 -3
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +2 -3
- package/dist/audio_stream.js.map +1 -1
- package/dist/e2ee.cjs +19 -20
- package/dist/e2ee.cjs.map +1 -1
- package/dist/e2ee.d.cts +5 -6
- package/dist/e2ee.d.ts +5 -6
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/e2ee.js +29 -30
- package/dist/e2ee.js.map +1 -1
- package/dist/ffi_client.cjs +6 -5
- package/dist/ffi_client.cjs.map +1 -1
- package/dist/ffi_client.d.cts +10 -10
- package/dist/ffi_client.d.ts +10 -10
- package/dist/ffi_client.d.ts.map +1 -1
- package/dist/ffi_client.js +6 -10
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.cjs +16 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -35
- package/dist/index.d.ts +6 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -46
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.cjs.map +1 -1
- package/dist/napi/native.d.ts +5 -5
- package/dist/native.d.ts +5 -5
- package/dist/participant.cjs +60 -36
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +11 -11
- package/dist/participant.d.ts +11 -11
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +78 -52
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs +977 -125
- package/dist/proto/audio_frame_pb.cjs.map +1 -1
- package/dist/proto/audio_frame_pb.d.cts +502 -417
- package/dist/proto/audio_frame_pb.d.ts +502 -417
- package/dist/proto/audio_frame_pb.d.ts.map +1 -1
- package/dist/proto/audio_frame_pb.js +943 -85
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/e2ee_pb.cjs +700 -85
- package/dist/proto/e2ee_pb.cjs.map +1 -1
- package/dist/proto/e2ee_pb.d.cts +331 -263
- package/dist/proto/e2ee_pb.d.ts +331 -263
- package/dist/proto/e2ee_pb.d.ts.map +1 -1
- package/dist/proto/e2ee_pb.js +675 -57
- package/dist/proto/e2ee_pb.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +369 -36
- package/dist/proto/ffi_pb.cjs.map +1 -1
- package/dist/proto/ffi_pb.d.cts +156 -109
- package/dist/proto/ffi_pb.d.ts +156 -109
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +364 -29
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/handle_pb.cjs +27 -7
- package/dist/proto/handle_pb.cjs.map +1 -1
- package/dist/proto/handle_pb.d.cts +13 -15
- package/dist/proto/handle_pb.d.ts +13 -15
- package/dist/proto/handle_pb.d.ts.map +1 -1
- package/dist/proto/handle_pb.js +26 -5
- package/dist/proto/handle_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +112 -15
- package/dist/proto/participant_pb.cjs.map +1 -1
- package/dist/proto/participant_pb.d.cts +140 -52
- package/dist/proto/participant_pb.d.ts +140 -52
- package/dist/proto/participant_pb.d.ts.map +1 -1
- package/dist/proto/participant_pb.js +109 -11
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +2693 -302
- package/dist/proto/room_pb.cjs.map +1 -1
- package/dist/proto/room_pb.d.cts +1265 -862
- package/dist/proto/room_pb.d.ts +1265 -862
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +2603 -210
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/rpc_pb.cjs +302 -37
- package/dist/proto/rpc_pb.cjs.map +1 -1
- package/dist/proto/rpc_pb.d.cts +138 -108
- package/dist/proto/rpc_pb.d.ts +138 -108
- package/dist/proto/rpc_pb.d.ts.map +1 -1
- package/dist/proto/rpc_pb.js +291 -25
- package/dist/proto/rpc_pb.js.map +1 -1
- package/dist/proto/stats_pb.cjs +1253 -139
- package/dist/proto/stats_pb.cjs.map +1 -1
- package/dist/proto/stats_pb.d.cts +803 -692
- package/dist/proto/stats_pb.d.ts +803 -692
- package/dist/proto/stats_pb.d.ts.map +1 -1
- package/dist/proto/stats_pb.js +1216 -93
- package/dist/proto/stats_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs +462 -64
- package/dist/proto/track_pb.cjs.map +1 -1
- package/dist/proto/track_pb.d.cts +250 -218
- package/dist/proto/track_pb.d.ts +250 -218
- package/dist/proto/track_pb.d.ts.map +1 -1
- package/dist/proto/track_pb.js +447 -45
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/proto/track_publication_pb.cjs +130 -0
- package/dist/proto/track_publication_pb.cjs.map +1 -0
- package/dist/proto/track_publication_pb.d.cts +80 -0
- package/dist/proto/track_publication_pb.d.ts +80 -0
- package/dist/proto/track_publication_pb.d.ts.map +1 -0
- package/dist/proto/track_publication_pb.js +103 -0
- package/dist/proto/track_publication_pb.js.map +1 -0
- package/dist/proto/video_frame_pb.cjs +648 -88
- package/dist/proto/video_frame_pb.cjs.map +1 -1
- package/dist/proto/video_frame_pb.d.cts +371 -328
- package/dist/proto/video_frame_pb.d.ts +371 -328
- package/dist/proto/video_frame_pb.d.ts.map +1 -1
- package/dist/proto/video_frame_pb.js +626 -60
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +85 -125
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +6 -17
- package/dist/room.d.ts +6 -17
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +85 -123
- package/dist/room.js.map +1 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +0 -1
- package/dist/rpc.d.ts +0 -1
- package/dist/rpc.js.map +1 -1
- package/dist/track.cjs +12 -8
- package/dist/track.cjs.map +1 -1
- package/dist/track.d.cts +8 -9
- package/dist/track.d.ts +8 -9
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +13 -9
- package/dist/track.js.map +1 -1
- package/dist/track_publication.cjs +21 -12
- package/dist/track_publication.cjs.map +1 -1
- package/dist/track_publication.d.cts +12 -13
- package/dist/track_publication.d.ts +12 -13
- package/dist/track_publication.d.ts.map +1 -1
- package/dist/track_publication.js +22 -13
- package/dist/track_publication.js.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/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/video_frame.cjs +26 -45
- package/dist/video_frame.cjs.map +1 -1
- package/dist/video_frame.d.cts +2 -3
- package/dist/video_frame.d.ts +2 -3
- package/dist/video_frame.d.ts.map +1 -1
- package/dist/video_frame.js +29 -48
- package/dist/video_frame.js.map +1 -1
- package/dist/video_source.cjs +7 -4
- package/dist/video_source.cjs.map +1 -1
- package/dist/video_source.d.cts +4 -4
- package/dist/video_source.d.ts +4 -4
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +9 -6
- package/dist/video_source.js.map +1 -1
- package/dist/video_stream.cjs +16 -5
- package/dist/video_stream.cjs.map +1 -1
- package/dist/video_stream.d.cts +3 -4
- package/dist/video_stream.d.ts +3 -4
- package/dist/video_stream.d.ts.map +1 -1
- package/dist/video_stream.js +17 -6
- package/dist/video_stream.js.map +1 -1
- package/package.json +9 -9
- package/src/audio_frame.ts +10 -10
- package/src/audio_resampler.ts +15 -13
- package/src/audio_source.ts +11 -8
- package/src/audio_stream.ts +3 -4
- package/src/e2ee.ts +41 -42
- package/src/ffi_client.ts +8 -16
- package/src/index.ts +5 -68
- package/src/napi/native.d.ts +5 -5
- package/src/participant.ts +102 -73
- package/src/proto/audio_frame_pb.ts +1220 -496
- package/src/proto/e2ee_pb.ts +858 -337
- package/src/proto/ffi_pb.ts +442 -135
- package/src/proto/handle_pb.ts +33 -19
- package/src/proto/participant_pb.ts +225 -60
- package/src/proto/room_pb.ts +3149 -1013
- package/src/proto/rpc_pb.ts +358 -129
- package/src/proto/stats_pb.ts +1891 -877
- package/src/proto/track_pb.ts +587 -253
- package/src/proto/track_publication_pb.ts +180 -0
- package/src/proto/video_frame_pb.ts +861 -394
- package/src/room.ts +137 -189
- package/src/rpc.ts +1 -1
- package/src/track.ts +16 -17
- package/src/track_publication.ts +25 -26
- package/src/version.ts +1 -1
- package/src/video_frame.ts +48 -72
- package/src/video_source.ts +11 -8
- package/src/video_stream.ts +18 -8
package/src/e2ee.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { create } from '@bufbuild/protobuf';
|
|
5
4
|
import { FfiClient } from './ffi_client.js';
|
|
6
5
|
import type {
|
|
7
6
|
E2eeManagerGetFrameCryptorsResponse,
|
|
@@ -12,17 +11,17 @@ import type {
|
|
|
12
11
|
RatchetSharedKeyResponse,
|
|
13
12
|
} from './proto/e2ee_pb.js';
|
|
14
13
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
E2eeManagerSetEnabledRequest,
|
|
15
|
+
E2eeRequest,
|
|
17
16
|
EncryptionType,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
FrameCryptorSetEnabledRequest,
|
|
18
|
+
FrameCryptorSetKeyIndexRequest,
|
|
19
|
+
GetKeyRequest,
|
|
20
|
+
GetSharedKeyRequest,
|
|
21
|
+
RatchetKeyRequest,
|
|
22
|
+
RatchetSharedKeyRequest,
|
|
23
|
+
SetKeyRequest,
|
|
24
|
+
SetSharedKeyRequest,
|
|
26
25
|
} from './proto/e2ee_pb.js';
|
|
27
26
|
|
|
28
27
|
const DEFAULT_RATCHET_SALT = new TextEncoder().encode('LKFrameEncryptionKey');
|
|
@@ -31,9 +30,9 @@ const DEFAULT_FAILURE_TOLERANCE = -1;
|
|
|
31
30
|
|
|
32
31
|
export interface KeyProviderOptions {
|
|
33
32
|
sharedKey?: Uint8Array;
|
|
34
|
-
ratchetSalt
|
|
35
|
-
ratchetWindowSize
|
|
36
|
-
failureTolerance
|
|
33
|
+
ratchetSalt?: Uint8Array;
|
|
34
|
+
ratchetWindowSize?: number;
|
|
35
|
+
failureTolerance?: number;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export const defaultKeyProviderOptions: KeyProviderOptions = {
|
|
@@ -44,7 +43,7 @@ export const defaultKeyProviderOptions: KeyProviderOptions = {
|
|
|
44
43
|
|
|
45
44
|
export interface E2EEOptions {
|
|
46
45
|
keyProviderOptions: KeyProviderOptions;
|
|
47
|
-
encryptionType
|
|
46
|
+
encryptionType?: EncryptionType;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
export const defaultE2EEOptions: E2EEOptions = {
|
|
@@ -63,11 +62,11 @@ export class KeyProvider {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
setSharedKey(sharedKey: Uint8Array, keyIndex: number) {
|
|
66
|
-
const req =
|
|
65
|
+
const req = new E2eeRequest({
|
|
67
66
|
roomHandle: this.roomHandle,
|
|
68
67
|
message: {
|
|
69
68
|
case: 'setSharedKey',
|
|
70
|
-
value:
|
|
69
|
+
value: new SetSharedKeyRequest({
|
|
71
70
|
keyIndex: keyIndex,
|
|
72
71
|
sharedKey: sharedKey,
|
|
73
72
|
}),
|
|
@@ -83,11 +82,11 @@ export class KeyProvider {
|
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
exportSharedKey(keyIndex: number): Uint8Array {
|
|
86
|
-
const req =
|
|
85
|
+
const req = new E2eeRequest({
|
|
87
86
|
roomHandle: this.roomHandle,
|
|
88
87
|
message: {
|
|
89
88
|
case: 'getSharedKey',
|
|
90
|
-
value:
|
|
89
|
+
value: new GetSharedKeyRequest({
|
|
91
90
|
keyIndex: keyIndex,
|
|
92
91
|
}),
|
|
93
92
|
},
|
|
@@ -100,15 +99,15 @@ export class KeyProvider {
|
|
|
100
99
|
},
|
|
101
100
|
});
|
|
102
101
|
|
|
103
|
-
return (res.message.value as GetSharedKeyResponse).key
|
|
102
|
+
return (res.message.value as GetSharedKeyResponse).key!;
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
ratchetSharedKey(keyIndex: number): Uint8Array {
|
|
107
|
-
const req =
|
|
106
|
+
const req = new E2eeRequest({
|
|
108
107
|
roomHandle: this.roomHandle,
|
|
109
108
|
message: {
|
|
110
109
|
case: 'ratchetSharedKey',
|
|
111
|
-
value:
|
|
110
|
+
value: new RatchetSharedKeyRequest({
|
|
112
111
|
keyIndex: keyIndex,
|
|
113
112
|
}),
|
|
114
113
|
},
|
|
@@ -121,15 +120,15 @@ export class KeyProvider {
|
|
|
121
120
|
},
|
|
122
121
|
});
|
|
123
122
|
|
|
124
|
-
return (res.message.value as RatchetSharedKeyResponse).newKey
|
|
123
|
+
return (res.message.value as RatchetSharedKeyResponse).newKey!;
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
setKey(participantIdentity: string, keyIndex: number) {
|
|
128
|
-
const req =
|
|
127
|
+
const req = new E2eeRequest({
|
|
129
128
|
roomHandle: this.roomHandle,
|
|
130
129
|
message: {
|
|
131
130
|
case: 'setKey',
|
|
132
|
-
value:
|
|
131
|
+
value: new SetKeyRequest({
|
|
133
132
|
keyIndex: keyIndex,
|
|
134
133
|
participantIdentity: participantIdentity,
|
|
135
134
|
}),
|
|
@@ -145,11 +144,11 @@ export class KeyProvider {
|
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
exportKey(participantIdentity: string, keyIndex: number): Uint8Array {
|
|
148
|
-
const req =
|
|
147
|
+
const req = new E2eeRequest({
|
|
149
148
|
roomHandle: this.roomHandle,
|
|
150
149
|
message: {
|
|
151
150
|
case: 'getKey',
|
|
152
|
-
value:
|
|
151
|
+
value: new GetKeyRequest({
|
|
153
152
|
keyIndex: keyIndex,
|
|
154
153
|
participantIdentity: participantIdentity,
|
|
155
154
|
}),
|
|
@@ -163,15 +162,15 @@ export class KeyProvider {
|
|
|
163
162
|
},
|
|
164
163
|
});
|
|
165
164
|
|
|
166
|
-
return (res.message.value as GetKeyResponse).key
|
|
165
|
+
return (res.message.value as GetKeyResponse).key!;
|
|
167
166
|
}
|
|
168
167
|
|
|
169
168
|
ratchetKey(participantIdentity: string, keyIndex: number): Uint8Array {
|
|
170
|
-
const req =
|
|
169
|
+
const req = new E2eeRequest({
|
|
171
170
|
roomHandle: this.roomHandle,
|
|
172
171
|
message: {
|
|
173
172
|
case: 'ratchetKey',
|
|
174
|
-
value:
|
|
173
|
+
value: new RatchetKeyRequest({
|
|
175
174
|
keyIndex: keyIndex,
|
|
176
175
|
participantIdentity: participantIdentity,
|
|
177
176
|
}),
|
|
@@ -185,7 +184,7 @@ export class KeyProvider {
|
|
|
185
184
|
},
|
|
186
185
|
});
|
|
187
186
|
|
|
188
|
-
return (res.message.value as RatchetKeyResponse).newKey
|
|
187
|
+
return (res.message.value as RatchetKeyResponse).newKey!;
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
|
|
@@ -204,11 +203,11 @@ export class FrameCryptor {
|
|
|
204
203
|
|
|
205
204
|
setEnabled(enabled: boolean) {
|
|
206
205
|
this.enabled = enabled;
|
|
207
|
-
const req =
|
|
206
|
+
const req = new E2eeRequest({
|
|
208
207
|
roomHandle: this.roomHandle,
|
|
209
208
|
message: {
|
|
210
209
|
case: 'cryptorSetEnabled',
|
|
211
|
-
value:
|
|
210
|
+
value: new FrameCryptorSetEnabledRequest({
|
|
212
211
|
participantIdentity: this.participantIdentity,
|
|
213
212
|
enabled: this.enabled,
|
|
214
213
|
}),
|
|
@@ -225,11 +224,11 @@ export class FrameCryptor {
|
|
|
225
224
|
|
|
226
225
|
setKeyIndex(keyIndex: number) {
|
|
227
226
|
this.keyIndex = keyIndex;
|
|
228
|
-
const req =
|
|
227
|
+
const req = new E2eeRequest({
|
|
229
228
|
roomHandle: this.roomHandle,
|
|
230
229
|
message: {
|
|
231
230
|
case: 'cryptorSetKeyIndex',
|
|
232
|
-
value:
|
|
231
|
+
value: new FrameCryptorSetKeyIndexRequest({
|
|
233
232
|
participantIdentity: this.participantIdentity,
|
|
234
233
|
keyIndex: this.keyIndex,
|
|
235
234
|
}),
|
|
@@ -248,7 +247,7 @@ export class FrameCryptor {
|
|
|
248
247
|
export class E2EEManager {
|
|
249
248
|
private roomHandle = BigInt(0);
|
|
250
249
|
private options: E2EEOptions;
|
|
251
|
-
private keyProvider
|
|
250
|
+
private keyProvider: KeyProvider;
|
|
252
251
|
|
|
253
252
|
enabled: boolean;
|
|
254
253
|
|
|
@@ -265,11 +264,11 @@ export class E2EEManager {
|
|
|
265
264
|
|
|
266
265
|
setEnabled(enabled: boolean) {
|
|
267
266
|
this.enabled = enabled;
|
|
268
|
-
const req =
|
|
267
|
+
const req = new E2eeRequest({
|
|
269
268
|
roomHandle: this.roomHandle,
|
|
270
269
|
message: {
|
|
271
270
|
case: 'managerSetEnabled',
|
|
272
|
-
value:
|
|
271
|
+
value: new E2eeManagerSetEnabledRequest({
|
|
273
272
|
enabled: this.enabled,
|
|
274
273
|
}),
|
|
275
274
|
},
|
|
@@ -284,7 +283,7 @@ export class E2EEManager {
|
|
|
284
283
|
}
|
|
285
284
|
|
|
286
285
|
frameCryptors(): FrameCryptor[] {
|
|
287
|
-
const req =
|
|
286
|
+
const req = new E2eeRequest({
|
|
288
287
|
roomHandle: this.roomHandle,
|
|
289
288
|
message: {
|
|
290
289
|
case: 'managerGetFrameCryptors',
|
|
@@ -305,9 +304,9 @@ export class E2EEManager {
|
|
|
305
304
|
(cryptor) =>
|
|
306
305
|
new FrameCryptor(
|
|
307
306
|
this.roomHandle,
|
|
308
|
-
cryptor.participantIdentity
|
|
309
|
-
cryptor.keyIndex
|
|
310
|
-
cryptor.enabled
|
|
307
|
+
cryptor.participantIdentity!,
|
|
308
|
+
cryptor.keyIndex!,
|
|
309
|
+
cryptor.enabled!,
|
|
311
310
|
),
|
|
312
311
|
);
|
|
313
312
|
|
package/src/ffi_client.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import type {
|
|
5
|
-
import { create, fromBinary, toBinary } from '@bufbuild/protobuf';
|
|
4
|
+
import type { PartialMessage } from '@bufbuild/protobuf';
|
|
6
5
|
import type { TypedEventEmitter as TypedEmitter } from '@livekit/typed-emitter';
|
|
7
6
|
import EventEmitter from 'events';
|
|
8
7
|
import {
|
|
@@ -13,17 +12,10 @@ import {
|
|
|
13
12
|
livekitInitialize,
|
|
14
13
|
livekitRetrievePtr,
|
|
15
14
|
} from './napi/native.js';
|
|
16
|
-
import {
|
|
17
|
-
type FfiEvent,
|
|
18
|
-
FfiEventSchema,
|
|
19
|
-
type FfiRequest,
|
|
20
|
-
FfiRequestSchema,
|
|
21
|
-
type FfiResponse,
|
|
22
|
-
FfiResponseSchema,
|
|
23
|
-
} from './proto/ffi_pb.js';
|
|
15
|
+
import { FfiEvent, FfiRequest, FfiResponse } from './proto/ffi_pb.js';
|
|
24
16
|
import { SDK_VERSION } from './version.js';
|
|
25
17
|
|
|
26
|
-
export { FfiHandle, type FfiEvent, type FfiResponse,
|
|
18
|
+
export { FfiHandle, type FfiEvent, type FfiResponse, FfiRequest, livekitDispose as dispose };
|
|
27
19
|
|
|
28
20
|
export type FfiClientCallbacks = {
|
|
29
21
|
ffi_event: (event: FfiEvent) => void;
|
|
@@ -49,7 +41,7 @@ export class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClient
|
|
|
49
41
|
|
|
50
42
|
livekitInitialize(
|
|
51
43
|
(event_data: Uint8Array) => {
|
|
52
|
-
const event = fromBinary(
|
|
44
|
+
const event = FfiEvent.fromBinary(event_data);
|
|
53
45
|
this.emit(FfiClientEvent.FfiEvent, event);
|
|
54
46
|
},
|
|
55
47
|
true,
|
|
@@ -57,11 +49,11 @@ export class FfiClient extends (EventEmitter as new () => TypedEmitter<FfiClient
|
|
|
57
49
|
);
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
request<T>(req:
|
|
61
|
-
const request =
|
|
62
|
-
const req_data = toBinary(
|
|
52
|
+
request<T>(req: PartialMessage<FfiRequest>): T {
|
|
53
|
+
const request = new FfiRequest(req);
|
|
54
|
+
const req_data = request.toBinary();
|
|
63
55
|
const res_data = livekitFfiRequest(req_data);
|
|
64
|
-
return fromBinary(
|
|
56
|
+
return FfiResponse.fromBinary(res_data).message.value as T;
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
copyBuffer(ptr: bigint, len: number): Uint8Array {
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import type { MessageInitShape } from '@bufbuild/protobuf';
|
|
5
|
-
import { create } from '@bufbuild/protobuf';
|
|
6
|
-
import type { AudioEncoding, TrackPublishOptionsSchema, VideoEncoding } from './proto/room_pb.js';
|
|
7
|
-
import {
|
|
8
|
-
AudioEncodingSchema,
|
|
9
|
-
IceServerSchema,
|
|
10
|
-
type IceServer as IceServerType,
|
|
11
|
-
type TrackPublishOptions as TrackPublishOptionsType,
|
|
12
|
-
VideoEncodingSchema,
|
|
13
|
-
} from './proto/room_pb.js';
|
|
14
|
-
import { TrackSource } from './proto/track_pb.js';
|
|
15
|
-
import { VideoCodec } from './proto/video_frame_pb.js';
|
|
16
4
|
|
|
17
5
|
export { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';
|
|
18
6
|
export { Participant, RemoteParticipant, LocalParticipant } from './participant.js';
|
|
@@ -39,20 +27,16 @@ export {
|
|
|
39
27
|
RemoteTrackPublication,
|
|
40
28
|
LocalTrackPublication,
|
|
41
29
|
} from './track_publication.js';
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
|
|
45
|
-
type E2EEOptions,
|
|
46
|
-
type KeyProviderOptions,
|
|
47
|
-
KeyProvider,
|
|
48
|
-
FrameCryptor,
|
|
49
|
-
} from './e2ee.js';
|
|
50
|
-
|
|
30
|
+
export type { Transcription, TranscriptionSegment } from './transcription.js';
|
|
31
|
+
export { E2EEManager, KeyProvider, FrameCryptor } from './e2ee.js';
|
|
32
|
+
export type { E2EEOptions, KeyProviderOptions } from './e2ee.js';
|
|
51
33
|
export {
|
|
52
34
|
ConnectionQuality,
|
|
35
|
+
IceServer,
|
|
53
36
|
IceTransportType,
|
|
54
37
|
DataPacketKind,
|
|
55
38
|
ContinualGatheringPolicy,
|
|
39
|
+
TrackPublishOptions,
|
|
56
40
|
ConnectionState,
|
|
57
41
|
} from './proto/room_pb.js';
|
|
58
42
|
export { RpcError, type RpcInvocationData, type PerformRpcParams } from './rpc.js';
|
|
@@ -62,50 +46,3 @@ export { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_
|
|
|
62
46
|
export { ParticipantKind } from './proto/participant_pb.js';
|
|
63
47
|
export { dispose } from './ffi_client.js';
|
|
64
48
|
export type { ChatMessage } from './types.js';
|
|
65
|
-
|
|
66
|
-
// exposing helpers for API compatibility with 1.x version of protobuf-es where these were class instances
|
|
67
|
-
|
|
68
|
-
type IceServerInit = MessageInitShape<typeof IceServerSchema> & {
|
|
69
|
-
urls: string[];
|
|
70
|
-
};
|
|
71
|
-
export class IceServer implements IceServerType {
|
|
72
|
-
$typeName = 'livekit.proto.IceServer' as const;
|
|
73
|
-
urls: string[];
|
|
74
|
-
username: string;
|
|
75
|
-
password: string;
|
|
76
|
-
constructor(init: IceServerInit) {
|
|
77
|
-
const { urls, username, password } = init;
|
|
78
|
-
this.urls = urls;
|
|
79
|
-
this.username = username ?? '';
|
|
80
|
-
this.password = password ?? '';
|
|
81
|
-
create(IceServerSchema, init);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export class TrackPublishOptions implements TrackPublishOptionsType {
|
|
86
|
-
$typeName = 'livekit.proto.TrackPublishOptions' as const;
|
|
87
|
-
videoCodec: VideoCodec;
|
|
88
|
-
videoEncoding?: VideoEncoding | undefined;
|
|
89
|
-
audioEncoding?: AudioEncoding | undefined;
|
|
90
|
-
dtx: boolean;
|
|
91
|
-
simulcast: boolean;
|
|
92
|
-
source: TrackSource;
|
|
93
|
-
stream: string;
|
|
94
|
-
red: boolean;
|
|
95
|
-
|
|
96
|
-
constructor(init: MessageInitShape<typeof TrackPublishOptionsSchema> = {}) {
|
|
97
|
-
const { videoCodec, videoEncoding, audioEncoding, dtx, simulcast, source, stream, red } = init;
|
|
98
|
-
this.videoCodec = videoCodec ?? VideoCodec.VP8;
|
|
99
|
-
if (videoEncoding) {
|
|
100
|
-
this.videoEncoding = create(VideoEncodingSchema, videoEncoding);
|
|
101
|
-
}
|
|
102
|
-
if (audioEncoding) {
|
|
103
|
-
this.audioEncoding = create(AudioEncodingSchema, audioEncoding);
|
|
104
|
-
}
|
|
105
|
-
this.dtx = dtx ?? false;
|
|
106
|
-
this.simulcast = simulcast ?? false;
|
|
107
|
-
this.source = source ?? TrackSource.SOURCE_UNKNOWN;
|
|
108
|
-
this.stream = stream ?? '';
|
|
109
|
-
this.red = red ?? false;
|
|
110
|
-
}
|
|
111
|
-
}
|
package/src/napi/native.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function livekitInitialize(
|
|
7
7
|
callback: (data: Uint8Array) => void,
|
|
8
8
|
captureLogs: boolean,
|
|
9
9
|
sdkVersion: string,
|
|
10
10
|
): void;
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
11
|
+
export function livekitFfiRequest(data: Uint8Array): Uint8Array;
|
|
12
|
+
export function livekitRetrievePtr(handle: Uint8Array): bigint;
|
|
13
|
+
export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
14
|
+
export function livekitDispose(): Promise<void>;
|
|
15
15
|
export declare class FfiHandle {
|
|
16
16
|
constructor(handle: bigint);
|
|
17
17
|
dispose(): void;
|