@livekit/rtc-node 0.13.14 → 0.13.17
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/README.md +3 -0
- package/dist/audio_resampler.cjs +9 -0
- package/dist/audio_resampler.cjs.map +1 -1
- package/dist/audio_resampler.d.cts +3 -0
- package/dist/audio_resampler.d.ts +3 -0
- package/dist/audio_resampler.d.ts.map +1 -1
- package/dist/audio_resampler.js +9 -0
- package/dist/audio_resampler.js.map +1 -1
- package/dist/audio_stream.cjs +3 -2
- package/dist/audio_stream.cjs.map +1 -1
- package/dist/audio_stream.d.cts +2 -1
- package/dist/audio_stream.d.ts +2 -1
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +2 -1
- package/dist/audio_stream.js.map +1 -1
- package/dist/data_streams/index.d.cts +2 -2
- package/dist/data_streams/index.d.ts +2 -2
- package/dist/data_streams/stream_reader.cjs.map +1 -1
- package/dist/data_streams/stream_reader.d.cts +2 -2
- package/dist/data_streams/stream_reader.d.ts +2 -2
- package/dist/data_streams/stream_reader.d.ts.map +1 -1
- package/dist/data_streams/stream_reader.js.map +1 -1
- package/dist/data_streams/stream_writer.cjs.map +1 -1
- package/dist/data_streams/stream_writer.d.cts +2 -2
- package/dist/data_streams/stream_writer.d.ts +2 -2
- package/dist/data_streams/stream_writer.d.ts.map +1 -1
- package/dist/data_streams/stream_writer.js.map +1 -1
- package/dist/data_streams/types.d.cts +2 -2
- package/dist/data_streams/types.d.ts +2 -2
- package/dist/ffi_client.d.cts +1 -0
- package/dist/ffi_client.d.ts +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/participant.cjs +13 -15
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +2 -2
- package/dist/participant.d.ts +2 -2
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +5 -7
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs +4 -2
- package/dist/proto/audio_frame_pb.cjs.map +1 -1
- package/dist/proto/audio_frame_pb.d.cts +8 -0
- package/dist/proto/audio_frame_pb.d.ts +8 -0
- package/dist/proto/audio_frame_pb.d.ts.map +1 -1
- package/dist/proto/audio_frame_pb.js +4 -2
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/data_stream_pb.cjs +1549 -0
- package/dist/proto/data_stream_pb.cjs.map +1 -0
- package/dist/proto/data_stream_pb.d.cts +1358 -0
- package/dist/proto/data_stream_pb.d.ts +1358 -0
- package/dist/proto/data_stream_pb.d.ts.map +1 -0
- package/dist/proto/data_stream_pb.js +1473 -0
- package/dist/proto/data_stream_pb.js.map +1 -0
- package/dist/proto/ffi_pb.cjs +43 -3
- package/dist/proto/ffi_pb.cjs.map +1 -1
- package/dist/proto/ffi_pb.d.cts +244 -1
- package/dist/proto/ffi_pb.d.ts +244 -1
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +43 -3
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +5 -1
- package/dist/proto/participant_pb.cjs.map +1 -1
- package/dist/proto/participant_pb.d.cts +9 -1
- package/dist/proto/participant_pb.d.ts +9 -1
- package/dist/proto/participant_pb.d.ts.map +1 -1
- package/dist/proto/participant_pb.js +5 -1
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +99 -2
- package/dist/proto/room_pb.cjs.map +1 -1
- package/dist/proto/room_pb.d.cts +130 -2
- package/dist/proto/room_pb.d.ts +130 -2
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +97 -3
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs +27 -1
- package/dist/proto/track_pb.cjs.map +1 -1
- package/dist/proto/track_pb.d.cts +40 -1
- package/dist/proto/track_pb.d.ts +40 -1
- package/dist/proto/track_pb.d.ts.map +1 -1
- package/dist/proto/track_pb.js +26 -1
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/room.cjs +79 -3
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +51 -3
- package/dist/room.d.ts +51 -3
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +77 -1
- package/dist/room.js.map +1 -1
- package/dist/{stream_reader-a8_oiaOi.d.cts → stream_reader-Ch2zvjU3.d.cts} +0 -1
- package/dist/{stream_reader-DWUV4eJB.d.ts → stream_reader-DRyR29vo.d.ts} +0 -1
- package/dist/track.cjs +23 -4
- package/dist/track.cjs.map +1 -1
- package/dist/track.d.cts +8 -2
- package/dist/track.d.ts +8 -2
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +23 -4
- package/dist/track.js.map +1 -1
- package/dist/track_publication.d.cts +1 -0
- package/dist/track_publication.d.ts +1 -0
- 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_source.d.cts +1 -0
- package/dist/video_source.d.ts +1 -0
- package/dist/video_stream.cjs +1 -2
- package/dist/video_stream.cjs.map +1 -1
- package/dist/video_stream.d.cts +1 -1
- package/dist/video_stream.d.ts +1 -1
- package/dist/video_stream.d.ts.map +1 -1
- package/dist/video_stream.js +0 -1
- package/dist/video_stream.js.map +1 -1
- package/package.json +7 -7
- package/src/audio_resampler.ts +12 -0
- package/src/audio_stream.ts +5 -1
- package/src/data_streams/stream_reader.ts +0 -1
- package/src/data_streams/stream_writer.ts +0 -1
- package/src/participant.ts +13 -15
- package/src/proto/audio_frame_pb.ts +12 -0
- package/src/proto/data_stream_pb.ts +2515 -0
- package/src/proto/ffi_pb.ts +283 -1
- package/src/proto/participant_pb.ts +12 -0
- package/src/proto/room_pb.ts +212 -1
- package/src/proto/track_pb.ts +58 -0
- package/src/room.ts +79 -1
- package/src/track.ts +28 -4
- package/src/version.ts +1 -1
- package/src/video_stream.ts +1 -1
package/dist/track.d.cts
CHANGED
|
@@ -14,6 +14,7 @@ import './proto/participant_pb.cjs';
|
|
|
14
14
|
import './proto/stats_pb.cjs';
|
|
15
15
|
import './proto/video_frame_pb.cjs';
|
|
16
16
|
import './proto/e2ee_pb.cjs';
|
|
17
|
+
import './proto/data_stream_pb.cjs';
|
|
17
18
|
import './proto/rpc_pb.cjs';
|
|
18
19
|
import './proto/track_publication_pb.cjs';
|
|
19
20
|
import './video_frame.cjs';
|
|
@@ -29,14 +30,19 @@ declare abstract class Track {
|
|
|
29
30
|
get kind(): TrackKind | undefined;
|
|
30
31
|
get stream_state(): StreamState | undefined;
|
|
31
32
|
get muted(): boolean | undefined;
|
|
33
|
+
close(): Promise<void>;
|
|
32
34
|
}
|
|
33
35
|
declare class LocalAudioTrack extends Track {
|
|
34
|
-
|
|
36
|
+
private source?;
|
|
37
|
+
constructor(owned: OwnedTrack, source?: AudioSource);
|
|
35
38
|
static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack;
|
|
39
|
+
close(closeSource?: boolean): Promise<void>;
|
|
36
40
|
}
|
|
37
41
|
declare class LocalVideoTrack extends Track {
|
|
38
|
-
|
|
42
|
+
private source?;
|
|
43
|
+
constructor(owned: OwnedTrack, source?: VideoSource);
|
|
39
44
|
static createVideoTrack(name: string, source: VideoSource): LocalVideoTrack;
|
|
45
|
+
close(closeSource?: boolean): Promise<void>;
|
|
40
46
|
}
|
|
41
47
|
declare class RemoteVideoTrack extends Track {
|
|
42
48
|
constructor(owned: OwnedTrack);
|
package/dist/track.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import './proto/participant_pb.js';
|
|
|
14
14
|
import './proto/stats_pb.js';
|
|
15
15
|
import './proto/video_frame_pb.js';
|
|
16
16
|
import './proto/e2ee_pb.js';
|
|
17
|
+
import './proto/data_stream_pb.js';
|
|
17
18
|
import './proto/rpc_pb.js';
|
|
18
19
|
import './proto/track_publication_pb.js';
|
|
19
20
|
import './video_frame.js';
|
|
@@ -29,14 +30,19 @@ declare abstract class Track {
|
|
|
29
30
|
get kind(): TrackKind | undefined;
|
|
30
31
|
get stream_state(): StreamState | undefined;
|
|
31
32
|
get muted(): boolean | undefined;
|
|
33
|
+
close(): Promise<void>;
|
|
32
34
|
}
|
|
33
35
|
declare class LocalAudioTrack extends Track {
|
|
34
|
-
|
|
36
|
+
private source?;
|
|
37
|
+
constructor(owned: OwnedTrack, source?: AudioSource);
|
|
35
38
|
static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack;
|
|
39
|
+
close(closeSource?: boolean): Promise<void>;
|
|
36
40
|
}
|
|
37
41
|
declare class LocalVideoTrack extends Track {
|
|
38
|
-
|
|
42
|
+
private source?;
|
|
43
|
+
constructor(owned: OwnedTrack, source?: VideoSource);
|
|
39
44
|
static createVideoTrack(name: string, source: VideoSource): LocalVideoTrack;
|
|
45
|
+
close(closeSource?: boolean): Promise<void>;
|
|
40
46
|
}
|
|
41
47
|
declare class RemoteVideoTrack extends Track {
|
|
42
48
|
constructor(owned: OwnedTrack);
|
package/dist/track.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/track.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAa,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAGV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,8BAAsB,KAAK;IACzB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,gBAAgB;IAChB,UAAU,EAAE,SAAS,CAAC;gBAEV,KAAK,EAAE,UAAU;IAK7B,IAAI,GAAG,IAAI,MAAM,GAAG,SAAS,CAE5B;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,SAAS,CAEhC;IAED,IAAI,YAAY,IAAI,WAAW,GAAG,SAAS,CAE1C;IAED,IAAI,KAAK,IAAI,OAAO,GAAG,SAAS,CAE/B;
|
|
1
|
+
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/track.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAa,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAGV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,8BAAsB,KAAK;IACzB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,gBAAgB;IAChB,UAAU,EAAE,SAAS,CAAC;gBAEV,KAAK,EAAE,UAAU;IAK7B,IAAI,GAAG,IAAI,MAAM,GAAG,SAAS,CAE5B;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,IAAI,IAAI,SAAS,GAAG,SAAS,CAEhC;IAED,IAAI,YAAY,IAAI,WAAW,GAAG,SAAS,CAE1C;IAED,IAAI,KAAK,IAAI,OAAO,GAAG,SAAS,CAE/B;IAEK,KAAK;CAGZ;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,OAAO,CAAC,MAAM,CAAC,CAAc;gBAEjB,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW;IAKnD,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,eAAe;IAarE,KAAK,CAAC,WAAW,UAAO;CAM/B;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,OAAO,CAAC,MAAM,CAAC,CAAc;gBAEjB,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW;IAKnD,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,eAAe;IAarE,KAAK,CAAC,WAAW,UAAO;CAM/B;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,KAAK,EAAE,UAAU;CAG9B;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,KAAK,EAAE,UAAU;CAG9B;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,eAAe,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC"}
|
package/dist/track.js
CHANGED
|
@@ -25,10 +25,14 @@ class Track {
|
|
|
25
25
|
var _a;
|
|
26
26
|
return (_a = this.info) == null ? void 0 : _a.muted;
|
|
27
27
|
}
|
|
28
|
+
async close() {
|
|
29
|
+
this.ffi_handle.dispose();
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
class LocalAudioTrack extends Track {
|
|
30
|
-
constructor(owned) {
|
|
33
|
+
constructor(owned, source) {
|
|
31
34
|
super(owned);
|
|
35
|
+
this.source = source;
|
|
32
36
|
}
|
|
33
37
|
static createAudioTrack(name, source) {
|
|
34
38
|
const req = new CreateAudioTrackRequest({
|
|
@@ -38,12 +42,20 @@ class LocalAudioTrack extends Track {
|
|
|
38
42
|
const res = FfiClient.instance.request({
|
|
39
43
|
message: { case: "createAudioTrack", value: req }
|
|
40
44
|
});
|
|
41
|
-
return new LocalAudioTrack(res.track);
|
|
45
|
+
return new LocalAudioTrack(res.track, source);
|
|
46
|
+
}
|
|
47
|
+
async close(closeSource = true) {
|
|
48
|
+
var _a;
|
|
49
|
+
await super.close();
|
|
50
|
+
if (closeSource) {
|
|
51
|
+
await ((_a = this.source) == null ? void 0 : _a.close());
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
}
|
|
44
55
|
class LocalVideoTrack extends Track {
|
|
45
|
-
constructor(owned) {
|
|
56
|
+
constructor(owned, source) {
|
|
46
57
|
super(owned);
|
|
58
|
+
this.source = source;
|
|
47
59
|
}
|
|
48
60
|
static createVideoTrack(name, source) {
|
|
49
61
|
const req = new CreateVideoTrackRequest({
|
|
@@ -53,7 +65,14 @@ class LocalVideoTrack extends Track {
|
|
|
53
65
|
const res = FfiClient.instance.request({
|
|
54
66
|
message: { case: "createVideoTrack", value: req }
|
|
55
67
|
});
|
|
56
|
-
return new LocalVideoTrack(res.track);
|
|
68
|
+
return new LocalVideoTrack(res.track, source);
|
|
69
|
+
}
|
|
70
|
+
async close(closeSource = true) {
|
|
71
|
+
var _a;
|
|
72
|
+
await super.close();
|
|
73
|
+
if (closeSource) {
|
|
74
|
+
await ((_a = this.source) == null ? void 0 : _a.close());
|
|
75
|
+
}
|
|
57
76
|
}
|
|
58
77
|
}
|
|
59
78
|
class RemoteVideoTrack extends Track {
|
package/dist/track.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/track.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { AudioSource } from './audio_source.js';\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CreateAudioTrackResponse,\n CreateVideoTrackResponse,\n OwnedTrack,\n StreamState,\n TrackInfo,\n TrackKind,\n} from './proto/track_pb.js';\nimport { CreateAudioTrackRequest, CreateVideoTrackRequest } from './proto/track_pb.js';\nimport type { VideoSource } from './video_source.js';\n\nexport abstract class Track {\n /** @internal */\n info?: TrackInfo;\n\n /** @internal */\n ffi_handle: FfiHandle;\n\n constructor(owned: OwnedTrack) {\n this.info = owned.info;\n this.ffi_handle = new FfiHandle(owned.handle!.id!);\n }\n\n get sid(): string | undefined {\n return this.info?.sid;\n }\n\n get name(): string | undefined {\n return this.info?.name;\n }\n\n get kind(): TrackKind | undefined {\n return this.info?.kind;\n }\n\n get stream_state(): StreamState | undefined {\n return this.info?.streamState;\n }\n\n get muted(): boolean | undefined {\n return this.info?.muted;\n }\n}\n\nexport class LocalAudioTrack extends Track {\n constructor(owned: OwnedTrack) {\n super(owned);\n }\n\n static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack {\n const req = new CreateAudioTrackRequest({\n name: name,\n sourceHandle: source.ffiHandle.handle,\n });\n\n const res = FfiClient.instance.request<CreateAudioTrackResponse>({\n message: { case: 'createAudioTrack', value: req },\n });\n\n return new LocalAudioTrack(res.track
|
|
1
|
+
{"version":3,"sources":["../src/track.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { AudioSource } from './audio_source.js';\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CreateAudioTrackResponse,\n CreateVideoTrackResponse,\n OwnedTrack,\n StreamState,\n TrackInfo,\n TrackKind,\n} from './proto/track_pb.js';\nimport { CreateAudioTrackRequest, CreateVideoTrackRequest } from './proto/track_pb.js';\nimport type { VideoSource } from './video_source.js';\n\nexport abstract class Track {\n /** @internal */\n info?: TrackInfo;\n\n /** @internal */\n ffi_handle: FfiHandle;\n\n constructor(owned: OwnedTrack) {\n this.info = owned.info;\n this.ffi_handle = new FfiHandle(owned.handle!.id!);\n }\n\n get sid(): string | undefined {\n return this.info?.sid;\n }\n\n get name(): string | undefined {\n return this.info?.name;\n }\n\n get kind(): TrackKind | undefined {\n return this.info?.kind;\n }\n\n get stream_state(): StreamState | undefined {\n return this.info?.streamState;\n }\n\n get muted(): boolean | undefined {\n return this.info?.muted;\n }\n\n async close() {\n this.ffi_handle.dispose();\n }\n}\n\nexport class LocalAudioTrack extends Track {\n private source?: AudioSource;\n\n constructor(owned: OwnedTrack, source?: AudioSource) {\n super(owned);\n this.source = source;\n }\n\n static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack {\n const req = new CreateAudioTrackRequest({\n name: name,\n sourceHandle: source.ffiHandle.handle,\n });\n\n const res = FfiClient.instance.request<CreateAudioTrackResponse>({\n message: { case: 'createAudioTrack', value: req },\n });\n\n return new LocalAudioTrack(res.track!, source);\n }\n\n async close(closeSource = true) {\n await super.close();\n if (closeSource) {\n await this.source?.close();\n }\n }\n}\n\nexport class LocalVideoTrack extends Track {\n private source?: VideoSource;\n\n constructor(owned: OwnedTrack, source?: VideoSource) {\n super(owned);\n this.source = source;\n }\n\n static createVideoTrack(name: string, source: VideoSource): LocalVideoTrack {\n const req = new CreateVideoTrackRequest({\n name: name,\n sourceHandle: source.ffiHandle.handle,\n });\n\n const res = FfiClient.instance.request<CreateVideoTrackResponse>({\n message: { case: 'createVideoTrack', value: req },\n });\n\n return new LocalVideoTrack(res.track!, source);\n }\n\n async close(closeSource = true) {\n await super.close();\n if (closeSource) {\n await this.source?.close();\n }\n }\n}\n\nexport class RemoteVideoTrack extends Track {\n constructor(owned: OwnedTrack) {\n super(owned);\n }\n}\n\nexport class RemoteAudioTrack extends Track {\n constructor(owned: OwnedTrack) {\n super(owned);\n }\n}\n\nexport type LocalTrack = LocalVideoTrack | LocalAudioTrack;\nexport type RemoteTrack = RemoteVideoTrack | RemoteAudioTrack;\nexport type AudioTrack = LocalAudioTrack | RemoteAudioTrack;\nexport type VideoTrack = LocalVideoTrack | RemoteVideoTrack;\n"],"mappings":"AAIA,SAAS,WAAW,iBAAiB;AASrC,SAAS,yBAAyB,+BAA+B;AAG1D,MAAe,MAAM;AAAA,EAO1B,YAAY,OAAmB;AAC7B,SAAK,OAAO,MAAM;AAClB,SAAK,aAAa,IAAI,UAAU,MAAM,OAAQ,EAAG;AAAA,EACnD;AAAA,EAEA,IAAI,MAA0B;AA5BhC;AA6BI,YAAO,UAAK,SAAL,mBAAW;AAAA,EACpB;AAAA,EAEA,IAAI,OAA2B;AAhCjC;AAiCI,YAAO,UAAK,SAAL,mBAAW;AAAA,EACpB;AAAA,EAEA,IAAI,OAA8B;AApCpC;AAqCI,YAAO,UAAK,SAAL,mBAAW;AAAA,EACpB;AAAA,EAEA,IAAI,eAAwC;AAxC9C;AAyCI,YAAO,UAAK,SAAL,mBAAW;AAAA,EACpB;AAAA,EAEA,IAAI,QAA6B;AA5CnC;AA6CI,YAAO,UAAK,SAAL,mBAAW;AAAA,EACpB;AAAA,EAEA,MAAM,QAAQ;AACZ,SAAK,WAAW,QAAQ;AAAA,EAC1B;AACF;AAEO,MAAM,wBAAwB,MAAM;AAAA,EAGzC,YAAY,OAAmB,QAAsB;AACnD,UAAM,KAAK;AACX,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAO,iBAAiB,MAAc,QAAsC;AAC1E,UAAM,MAAM,IAAI,wBAAwB;AAAA,MACtC;AAAA,MACA,cAAc,OAAO,UAAU;AAAA,IACjC,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAkC;AAAA,MAC/D,SAAS,EAAE,MAAM,oBAAoB,OAAO,IAAI;AAAA,IAClD,CAAC;AAED,WAAO,IAAI,gBAAgB,IAAI,OAAQ,MAAM;AAAA,EAC/C;AAAA,EAEA,MAAM,MAAM,cAAc,MAAM;AA1ElC;AA2EI,UAAM,MAAM,MAAM;AAClB,QAAI,aAAa;AACf,cAAM,UAAK,WAAL,mBAAa;AAAA,IACrB;AAAA,EACF;AACF;AAEO,MAAM,wBAAwB,MAAM;AAAA,EAGzC,YAAY,OAAmB,QAAsB;AACnD,UAAM,KAAK;AACX,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAO,iBAAiB,MAAc,QAAsC;AAC1E,UAAM,MAAM,IAAI,wBAAwB;AAAA,MACtC;AAAA,MACA,cAAc,OAAO,UAAU;AAAA,IACjC,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAkC;AAAA,MAC/D,SAAS,EAAE,MAAM,oBAAoB,OAAO,IAAI;AAAA,IAClD,CAAC;AAED,WAAO,IAAI,gBAAgB,IAAI,OAAQ,MAAM;AAAA,EAC/C;AAAA,EAEA,MAAM,MAAM,cAAc,MAAM;AAvGlC;AAwGI,UAAM,MAAM,MAAM;AAClB,QAAI,aAAa;AACf,cAAM,UAAK,WAAL,mBAAa;AAAA,IACrB;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,MAAM;AAAA,EAC1C,YAAY,OAAmB;AAC7B,UAAM,KAAK;AAAA,EACb;AACF;AAEO,MAAM,yBAAyB,MAAM;AAAA,EAC1C,YAAY,OAAmB;AAC7B,UAAM,KAAK;AAAA,EACb;AACF;","names":[]}
|
|
@@ -14,6 +14,7 @@ import './proto/ffi_pb.cjs';
|
|
|
14
14
|
import './proto/room_pb.cjs';
|
|
15
15
|
import './proto/participant_pb.cjs';
|
|
16
16
|
import './proto/video_frame_pb.cjs';
|
|
17
|
+
import './proto/data_stream_pb.cjs';
|
|
17
18
|
import './proto/rpc_pb.cjs';
|
|
18
19
|
import './proto/track_publication_pb.cjs';
|
|
19
20
|
import './video_source.cjs';
|
|
@@ -14,6 +14,7 @@ import './proto/ffi_pb.js';
|
|
|
14
14
|
import './proto/room_pb.js';
|
|
15
15
|
import './proto/participant_pb.js';
|
|
16
16
|
import './proto/video_frame_pb.js';
|
|
17
|
+
import './proto/data_stream_pb.js';
|
|
17
18
|
import './proto/rpc_pb.js';
|
|
18
19
|
import './proto/track_publication_pb.js';
|
|
19
20
|
import './video_source.js';
|
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.17";
|
|
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.17\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;","names":[]}
|
package/dist/version.d.cts
CHANGED
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/version.js.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.17\";\n"],"mappings":"AAAO,MAAM,cAAc;","names":[]}
|
package/dist/video_source.d.cts
CHANGED
|
@@ -11,6 +11,7 @@ import './proto/handle_pb.cjs';
|
|
|
11
11
|
import './proto/track_pb.cjs';
|
|
12
12
|
import './proto/stats_pb.cjs';
|
|
13
13
|
import './proto/e2ee_pb.cjs';
|
|
14
|
+
import './proto/data_stream_pb.cjs';
|
|
14
15
|
import './proto/audio_frame_pb.cjs';
|
|
15
16
|
import './proto/rpc_pb.cjs';
|
|
16
17
|
import './proto/track_publication_pb.cjs';
|
package/dist/video_source.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import './proto/handle_pb.js';
|
|
|
11
11
|
import './proto/track_pb.js';
|
|
12
12
|
import './proto/stats_pb.js';
|
|
13
13
|
import './proto/e2ee_pb.js';
|
|
14
|
+
import './proto/data_stream_pb.js';
|
|
14
15
|
import './proto/audio_frame_pb.js';
|
|
15
16
|
import './proto/rpc_pb.js';
|
|
16
17
|
import './proto/track_publication_pb.js';
|
package/dist/video_stream.cjs
CHANGED
|
@@ -21,7 +21,6 @@ __export(video_stream_exports, {
|
|
|
21
21
|
VideoStream: () => VideoStream
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(video_stream_exports);
|
|
24
|
-
var import_web = require("node:stream/web");
|
|
25
24
|
var import_ffi_client = require("./ffi_client.cjs");
|
|
26
25
|
var import_video_frame_pb = require("./proto/video_frame_pb.cjs");
|
|
27
26
|
var import_video_frame = require("./video_frame.cjs");
|
|
@@ -75,7 +74,7 @@ class VideoStreamSource {
|
|
|
75
74
|
this.ffiHandle.dispose();
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
|
-
class VideoStream extends
|
|
77
|
+
class VideoStream extends ReadableStream {
|
|
79
78
|
constructor(track) {
|
|
80
79
|
super(new VideoStreamSource(track));
|
|
81
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/video_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { UnderlyingSource } from 'node:stream/web';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { NewVideoStreamResponse, VideoRotation } from './proto/video_frame_pb.js';\nimport { NewVideoStreamRequest, VideoStreamType } from './proto/video_frame_pb.js';\nimport type { Track } from './track.js';\nimport { VideoFrame } from './video_frame.js';\n\nexport type VideoFrameEvent = {\n frame: VideoFrame;\n timestampUs: bigint;\n rotation: VideoRotation;\n};\n\nclass VideoStreamSource implements UnderlyingSource<VideoFrameEvent> {\n private controller?: ReadableStreamDefaultController<VideoFrameEvent>;\n private ffiHandle: FfiHandle;\n\n constructor(track: Track) {\n const req = new NewVideoStreamRequest({\n type: VideoStreamType.VIDEO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n });\n\n const res = FfiClient.instance.request<NewVideoStreamResponse>({\n message: {\n case: 'newVideoStream',\n value: req,\n },\n });\n\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id!);\n FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);\n }\n\n private onEvent = (ev: FfiEvent) => {\n if (!this.controller) {\n throw new Error('Stream controller not initialized');\n }\n\n if (\n ev.message.case != 'videoStreamEvent' ||\n ev.message.value.streamHandle != this.ffiHandle.handle\n ) {\n return;\n }\n\n const streamEvent = ev.message.value.message;\n switch (streamEvent.case) {\n case 'frameReceived':\n const rotation = streamEvent.value.rotation;\n const timestampUs = streamEvent.value.timestampUs;\n const frame = VideoFrame.fromOwnedInfo(streamEvent.value.buffer!);\n const value = { rotation, timestampUs, frame };\n const videoFrameEvent = {\n frame: value.frame,\n timestampUs: value.timestampUs!,\n rotation: value.rotation!,\n };\n this.controller.enqueue(videoFrameEvent);\n break;\n case 'eos':\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n this.controller.close();\n break;\n }\n };\n\n start(controller: ReadableStreamDefaultController<VideoFrameEvent>) {\n this.controller = controller;\n }\n\n cancel() {\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n this.ffiHandle.dispose();\n }\n}\n\nexport class VideoStream extends ReadableStream<VideoFrameEvent> {\n constructor(track: Track) {\n super(new VideoStreamSource(track));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,wBAAqD;AAErD,4BAAuD;AAEvD,yBAA2B;AAQ3B,MAAM,kBAA+D;AAAA,EAInE,YAAY,OAAc;AAiB1B,SAAQ,UAAU,CAAC,OAAiB;AAClC,UAAI,CAAC,KAAK,YAAY;AACpB,cAAM,IAAI,MAAM,mCAAmC;AAAA,MACrD;AAEA,UACE,GAAG,QAAQ,QAAQ,sBACnB,GAAG,QAAQ,MAAM,gBAAgB,KAAK,UAAU,QAChD;AACA;AAAA,MACF;AAEA,YAAM,cAAc,GAAG,QAAQ,MAAM;AACrC,cAAQ,YAAY,MAAM;AAAA,QACxB,KAAK;AACH,gBAAM,WAAW,YAAY,MAAM;AACnC,gBAAM,cAAc,YAAY,MAAM;AACtC,gBAAM,QAAQ,8BAAW,cAAc,YAAY,MAAM,MAAO;AAChE,gBAAM,QAAQ,EAAE,UAAU,aAAa,MAAM;AAC7C,gBAAM,kBAAkB;AAAA,YACtB,OAAO,MAAM;AAAA,YACb,aAAa,MAAM;AAAA,YACnB,UAAU,MAAM;AAAA,UAClB;AACA,eAAK,WAAW,QAAQ,eAAe;AACvC;AAAA,QACF,KAAK;AACH,sCAAU,SAAS,IAAI,iCAAe,UAAU,KAAK,OAAO;AAC5D,eAAK,WAAW,MAAM;AACtB;AAAA,MACJ;AAAA,IACF;AA/CE,UAAM,MAAM,IAAI,4CAAsB;AAAA,MACpC,MAAM,sCAAgB;AAAA,MACtB,aAAa,MAAM,WAAW;AAAA,IAChC,CAAC;AAED,UAAM,MAAM,4BAAU,SAAS,QAAgC;AAAA,MAC7D,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,SAAK,YAAY,IAAI,4BAAU,IAAI,OAAQ,OAAQ,EAAG;AACtD,gCAAU,SAAS,GAAG,iCAAe,UAAU,KAAK,OAAO;AAAA,EAC7D;AAAA,EAmCA,MAAM,YAA8D;AAClE,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,SAAS;AACP,gCAAU,SAAS,IAAI,iCAAe,UAAU,KAAK,OAAO;AAC5D,SAAK,UAAU,QAAQ;AAAA,EACzB;AACF;AAEO,MAAM,oBAAoB,eAAgC;AAAA,EAC/D,YAAY,OAAc;AACxB,UAAM,IAAI,kBAAkB,KAAK,CAAC;AAAA,EACpC;AACF;","names":[]}
|
package/dist/video_stream.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from 'node:stream/web';
|
|
2
1
|
import { VideoRotation } from './proto/video_frame_pb.cjs';
|
|
3
2
|
import { Track } from './track.cjs';
|
|
4
3
|
import { VideoFrame } from './video_frame.cjs';
|
|
@@ -16,6 +15,7 @@ import '@livekit/typed-emitter';
|
|
|
16
15
|
import './proto/ffi_pb.cjs';
|
|
17
16
|
import './proto/room_pb.cjs';
|
|
18
17
|
import './proto/participant_pb.cjs';
|
|
18
|
+
import './proto/data_stream_pb.cjs';
|
|
19
19
|
import './proto/rpc_pb.cjs';
|
|
20
20
|
import './proto/track_publication_pb.cjs';
|
|
21
21
|
import './video_source.cjs';
|
package/dist/video_stream.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from 'node:stream/web';
|
|
2
1
|
import { VideoRotation } from './proto/video_frame_pb.js';
|
|
3
2
|
import { Track } from './track.js';
|
|
4
3
|
import { VideoFrame } from './video_frame.js';
|
|
@@ -16,6 +15,7 @@ import '@livekit/typed-emitter';
|
|
|
16
15
|
import './proto/ffi_pb.js';
|
|
17
16
|
import './proto/room_pb.js';
|
|
18
17
|
import './proto/participant_pb.js';
|
|
18
|
+
import './proto/data_stream_pb.js';
|
|
19
19
|
import './proto/rpc_pb.js';
|
|
20
20
|
import './proto/track_publication_pb.js';
|
|
21
21
|
import './video_source.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video_stream.d.ts","sourceRoot":"","sources":["../src/video_stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"video_stream.d.ts","sourceRoot":"","sources":["../src/video_stream.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAA0B,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;CACzB,CAAC;AAkEF,qBAAa,WAAY,SAAQ,cAAc,CAAC,eAAe,CAAC;gBAClD,KAAK,EAAE,KAAK;CAGzB"}
|
package/dist/video_stream.js
CHANGED
package/dist/video_stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/video_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { UnderlyingSource } from 'node:stream/web';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { NewVideoStreamResponse, VideoRotation } from './proto/video_frame_pb.js';\nimport { NewVideoStreamRequest, VideoStreamType } from './proto/video_frame_pb.js';\nimport type { Track } from './track.js';\nimport { VideoFrame } from './video_frame.js';\n\nexport type VideoFrameEvent = {\n frame: VideoFrame;\n timestampUs: bigint;\n rotation: VideoRotation;\n};\n\nclass VideoStreamSource implements UnderlyingSource<VideoFrameEvent> {\n private controller?: ReadableStreamDefaultController<VideoFrameEvent>;\n private ffiHandle: FfiHandle;\n\n constructor(track: Track) {\n const req = new NewVideoStreamRequest({\n type: VideoStreamType.VIDEO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n });\n\n const res = FfiClient.instance.request<NewVideoStreamResponse>({\n message: {\n case: 'newVideoStream',\n value: req,\n },\n });\n\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id!);\n FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);\n }\n\n private onEvent = (ev: FfiEvent) => {\n if (!this.controller) {\n throw new Error('Stream controller not initialized');\n }\n\n if (\n ev.message.case != 'videoStreamEvent' ||\n ev.message.value.streamHandle != this.ffiHandle.handle\n ) {\n return;\n }\n\n const streamEvent = ev.message.value.message;\n switch (streamEvent.case) {\n case 'frameReceived':\n const rotation = streamEvent.value.rotation;\n const timestampUs = streamEvent.value.timestampUs;\n const frame = VideoFrame.fromOwnedInfo(streamEvent.value.buffer!);\n const value = { rotation, timestampUs, frame };\n const videoFrameEvent = {\n frame: value.frame,\n timestampUs: value.timestampUs!,\n rotation: value.rotation!,\n };\n this.controller.enqueue(videoFrameEvent);\n break;\n case 'eos':\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n this.controller.close();\n break;\n }\n };\n\n start(controller: ReadableStreamDefaultController<VideoFrameEvent>) {\n this.controller = controller;\n }\n\n cancel() {\n FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);\n this.ffiHandle.dispose();\n }\n}\n\nexport class VideoStream extends ReadableStream<VideoFrameEvent> {\n constructor(track: Track) {\n super(new VideoStreamSource(track));\n }\n}\n"],"mappings":"AAKA,SAAS,WAAW,gBAAgB,iBAAiB;AAErD,SAAS,uBAAuB,uBAAuB;AAEvD,SAAS,kBAAkB;AAQ3B,MAAM,kBAA+D;AAAA,EAInE,YAAY,OAAc;AAiB1B,SAAQ,UAAU,CAAC,OAAiB;AAClC,UAAI,CAAC,KAAK,YAAY;AACpB,cAAM,IAAI,MAAM,mCAAmC;AAAA,MACrD;AAEA,UACE,GAAG,QAAQ,QAAQ,sBACnB,GAAG,QAAQ,MAAM,gBAAgB,KAAK,UAAU,QAChD;AACA;AAAA,MACF;AAEA,YAAM,cAAc,GAAG,QAAQ,MAAM;AACrC,cAAQ,YAAY,MAAM;AAAA,QACxB,KAAK;AACH,gBAAM,WAAW,YAAY,MAAM;AACnC,gBAAM,cAAc,YAAY,MAAM;AACtC,gBAAM,QAAQ,WAAW,cAAc,YAAY,MAAM,MAAO;AAChE,gBAAM,QAAQ,EAAE,UAAU,aAAa,MAAM;AAC7C,gBAAM,kBAAkB;AAAA,YACtB,OAAO,MAAM;AAAA,YACb,aAAa,MAAM;AAAA,YACnB,UAAU,MAAM;AAAA,UAClB;AACA,eAAK,WAAW,QAAQ,eAAe;AACvC;AAAA,QACF,KAAK;AACH,oBAAU,SAAS,IAAI,eAAe,UAAU,KAAK,OAAO;AAC5D,eAAK,WAAW,MAAM;AACtB;AAAA,MACJ;AAAA,IACF;AA/CE,UAAM,MAAM,IAAI,sBAAsB;AAAA,MACpC,MAAM,gBAAgB;AAAA,MACtB,aAAa,MAAM,WAAW;AAAA,IAChC,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAgC;AAAA,MAC7D,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,SAAK,YAAY,IAAI,UAAU,IAAI,OAAQ,OAAQ,EAAG;AACtD,cAAU,SAAS,GAAG,eAAe,UAAU,KAAK,OAAO;AAAA,EAC7D;AAAA,EAmCA,MAAM,YAA8D;AAClE,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA,SAAS;AACP,cAAU,SAAS,IAAI,eAAe,UAAU,KAAK,OAAO;AAC5D,SAAK,UAAU,QAAQ;AAAA,EACzB;AACF;AAEO,MAAM,oBAAoB,eAAgC;AAAA,EAC/D,YAAY,OAAc;AACxB,UAAM,IAAI,kBAAkB,KAAK,CAAC;AAAA,EACpC;AACF;","names":[]}
|
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.17",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"require": "dist/index.cjs",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@napi-rs/cli": "^2.18.0",
|
|
57
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^22.13.10",
|
|
58
58
|
"prettier": "^3.0.3",
|
|
59
59
|
"tsup": "^8.3.5",
|
|
60
60
|
"typescript": "^5.2.2",
|
|
61
61
|
"@bufbuild/protoc-gen-es": "^1.10.0"
|
|
62
62
|
},
|
|
63
63
|
"optionalDependencies": {
|
|
64
|
-
"@livekit/rtc-node-darwin-arm64": "0.13.
|
|
65
|
-
"@livekit/rtc-node-darwin-x64": "0.13.
|
|
66
|
-
"@livekit/rtc-node-linux-
|
|
67
|
-
"@livekit/rtc-node-linux-
|
|
68
|
-
"@livekit/rtc-node-win32-x64-msvc": "0.13.
|
|
64
|
+
"@livekit/rtc-node-darwin-arm64": "0.13.17",
|
|
65
|
+
"@livekit/rtc-node-darwin-x64": "0.13.17",
|
|
66
|
+
"@livekit/rtc-node-linux-arm64-gnu": "0.13.17",
|
|
67
|
+
"@livekit/rtc-node-linux-x64-gnu": "0.13.17",
|
|
68
|
+
"@livekit/rtc-node-win32-x64-msvc": "0.13.17"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">= 18"
|
package/src/audio_resampler.ts
CHANGED
|
@@ -85,6 +85,18 @@ export class AudioResampler {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
get inputRate(): number {
|
|
89
|
+
return this.#inputRate;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
get outputRate(): number {
|
|
93
|
+
return this.#outputRate;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
get channels(): number {
|
|
97
|
+
return this.#channels;
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
/**
|
|
89
101
|
* Push audio data into the resampler and retrieve any available resampled data.
|
|
90
102
|
*
|
package/src/audio_stream.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import {
|
|
4
|
+
import type { UnderlyingSource } from 'node:stream/web';
|
|
5
5
|
import { AudioFrame } from './audio_frame.js';
|
|
6
6
|
import type { FfiEvent } from './ffi_client.js';
|
|
7
7
|
import { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';
|
|
@@ -13,6 +13,7 @@ export interface AudioStreamOptions {
|
|
|
13
13
|
noiseCancellation?: NoiseCancellationOptions;
|
|
14
14
|
sampleRate?: number;
|
|
15
15
|
numChannels?: number;
|
|
16
|
+
frameSizeMs?: number;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export interface NoiseCancellationOptions {
|
|
@@ -26,6 +27,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
|
|
|
26
27
|
private sampleRate: number;
|
|
27
28
|
private numChannels: number;
|
|
28
29
|
private ncOptions?: NoiseCancellationOptions;
|
|
30
|
+
private frameSizeMs?: number;
|
|
29
31
|
|
|
30
32
|
constructor(
|
|
31
33
|
track: Track,
|
|
@@ -36,6 +38,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
|
|
|
36
38
|
this.sampleRate = sampleRateOrOptions.sampleRate ?? 48000;
|
|
37
39
|
this.numChannels = sampleRateOrOptions.numChannels ?? 1;
|
|
38
40
|
this.ncOptions = sampleRateOrOptions.noiseCancellation;
|
|
41
|
+
this.frameSizeMs = sampleRateOrOptions.frameSizeMs;
|
|
39
42
|
} else {
|
|
40
43
|
this.sampleRate = (sampleRateOrOptions as number) ?? 48000;
|
|
41
44
|
this.numChannels = numChannels ?? 1;
|
|
@@ -46,6 +49,7 @@ class AudioStreamSource implements UnderlyingSource<AudioFrame> {
|
|
|
46
49
|
trackHandle: track.ffi_handle.handle,
|
|
47
50
|
sampleRate: this.sampleRate,
|
|
48
51
|
numChannels: this.numChannels,
|
|
52
|
+
frameSizeMs: this.frameSizeMs,
|
|
49
53
|
...(this.ncOptions
|
|
50
54
|
? {
|
|
51
55
|
audioFilterModuleId: this.ncOptions.moduleId,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import type { ReadableStream } from 'node:stream/web';
|
|
5
4
|
import { log } from '../log.js';
|
|
6
5
|
import type { DataStream_Chunk } from '../proto/room_pb.js';
|
|
7
6
|
import { bigIntToNumber } from '../utils.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import type { WritableStream } from 'node:stream/web';
|
|
5
4
|
import type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from './types.js';
|
|
6
5
|
|
|
7
6
|
class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
|
package/src/participant.ts
CHANGED
|
@@ -20,21 +20,29 @@ import {
|
|
|
20
20
|
ParticipantKind,
|
|
21
21
|
} from './proto/participant_pb.js';
|
|
22
22
|
import {
|
|
23
|
+
ChatMessage as ChatMessageModel,
|
|
23
24
|
DataStream_ByteHeader,
|
|
24
25
|
DataStream_Chunk,
|
|
25
26
|
DataStream_Header,
|
|
26
27
|
DataStream_OperationType,
|
|
27
28
|
DataStream_TextHeader,
|
|
28
29
|
DataStream_Trailer,
|
|
30
|
+
EditChatMessageRequest,
|
|
31
|
+
TranscriptionSegment as ProtoTranscriptionSegment,
|
|
29
32
|
type PublishDataCallback,
|
|
33
|
+
PublishDataRequest,
|
|
30
34
|
type PublishDataResponse,
|
|
31
35
|
type PublishSipDtmfCallback,
|
|
36
|
+
PublishSipDtmfRequest,
|
|
32
37
|
type PublishSipDtmfResponse,
|
|
33
38
|
type PublishTrackCallback,
|
|
39
|
+
PublishTrackRequest,
|
|
34
40
|
type PublishTrackResponse,
|
|
35
41
|
type PublishTranscriptionCallback,
|
|
42
|
+
PublishTranscriptionRequest,
|
|
36
43
|
type PublishTranscriptionResponse,
|
|
37
44
|
type SendChatMessageCallback,
|
|
45
|
+
SendChatMessageRequest,
|
|
38
46
|
type SendChatMessageResponse,
|
|
39
47
|
type SendStreamChunkCallback,
|
|
40
48
|
SendStreamChunkRequest,
|
|
@@ -46,28 +54,18 @@ import {
|
|
|
46
54
|
SendStreamTrailerRequest,
|
|
47
55
|
type SendStreamTrailerResponse,
|
|
48
56
|
type SetLocalAttributesCallback,
|
|
57
|
+
SetLocalAttributesRequest,
|
|
49
58
|
type SetLocalAttributesResponse,
|
|
50
59
|
type SetLocalMetadataCallback,
|
|
60
|
+
SetLocalMetadataRequest,
|
|
51
61
|
type SetLocalMetadataResponse,
|
|
52
62
|
type SetLocalNameCallback,
|
|
63
|
+
SetLocalNameRequest,
|
|
53
64
|
type SetLocalNameResponse,
|
|
54
65
|
type TrackPublishOptions,
|
|
55
66
|
type UnpublishTrackCallback,
|
|
56
|
-
type UnpublishTrackResponse,
|
|
57
|
-
} from './proto/room_pb.js';
|
|
58
|
-
import { ChatMessage as ChatMessageModel } from './proto/room_pb.js';
|
|
59
|
-
import {
|
|
60
|
-
EditChatMessageRequest,
|
|
61
|
-
TranscriptionSegment as ProtoTranscriptionSegment,
|
|
62
|
-
PublishDataRequest,
|
|
63
|
-
PublishSipDtmfRequest,
|
|
64
|
-
PublishTrackRequest,
|
|
65
|
-
PublishTranscriptionRequest,
|
|
66
|
-
SendChatMessageRequest,
|
|
67
|
-
SetLocalAttributesRequest,
|
|
68
|
-
SetLocalMetadataRequest,
|
|
69
|
-
SetLocalNameRequest,
|
|
70
67
|
UnpublishTrackRequest,
|
|
68
|
+
type UnpublishTrackResponse,
|
|
71
69
|
} from './proto/room_pb.js';
|
|
72
70
|
import type {
|
|
73
71
|
PerformRpcCallback,
|
|
@@ -460,7 +458,7 @@ export class LocalParticipant extends Participant {
|
|
|
460
458
|
const fileStats = await stat(path);
|
|
461
459
|
const file = await open(path);
|
|
462
460
|
try {
|
|
463
|
-
const stream: ReadableStream<Uint8Array> = file.readableWebStream(
|
|
461
|
+
const stream: ReadableStream<Uint8Array> = file.readableWebStream();
|
|
464
462
|
const streamId = crypto.randomUUID();
|
|
465
463
|
const destinationIdentities = options?.destinationIdentities;
|
|
466
464
|
|
|
@@ -211,6 +211,11 @@ export class NewAudioStreamRequest extends Message<NewAudioStreamRequest> {
|
|
|
211
211
|
*/
|
|
212
212
|
audioFilterOptions?: string;
|
|
213
213
|
|
|
214
|
+
/**
|
|
215
|
+
* @generated from field: optional uint32 frame_size_ms = 7;
|
|
216
|
+
*/
|
|
217
|
+
frameSizeMs?: number;
|
|
218
|
+
|
|
214
219
|
constructor(data?: PartialMessage<NewAudioStreamRequest>) {
|
|
215
220
|
super();
|
|
216
221
|
proto2.util.initPartial(data, this);
|
|
@@ -225,6 +230,7 @@ export class NewAudioStreamRequest extends Message<NewAudioStreamRequest> {
|
|
|
225
230
|
{ no: 4, name: "num_channels", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
|
|
226
231
|
{ no: 5, name: "audio_filter_module_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
227
232
|
{ no: 6, name: "audio_filter_options", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
233
|
+
{ no: 7, name: "frame_size_ms", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
|
|
228
234
|
]);
|
|
229
235
|
|
|
230
236
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NewAudioStreamRequest {
|
|
@@ -320,6 +326,11 @@ export class AudioStreamFromParticipantRequest extends Message<AudioStreamFromPa
|
|
|
320
326
|
*/
|
|
321
327
|
audioFilterOptions?: string;
|
|
322
328
|
|
|
329
|
+
/**
|
|
330
|
+
* @generated from field: optional uint32 frame_size_ms = 9;
|
|
331
|
+
*/
|
|
332
|
+
frameSizeMs?: number;
|
|
333
|
+
|
|
323
334
|
constructor(data?: PartialMessage<AudioStreamFromParticipantRequest>) {
|
|
324
335
|
super();
|
|
325
336
|
proto2.util.initPartial(data, this);
|
|
@@ -335,6 +346,7 @@ export class AudioStreamFromParticipantRequest extends Message<AudioStreamFromPa
|
|
|
335
346
|
{ no: 6, name: "num_channels", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
|
|
336
347
|
{ no: 7, name: "audio_filter_module_id", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
337
348
|
{ no: 8, name: "audio_filter_options", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
349
|
+
{ no: 9, name: "frame_size_ms", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true },
|
|
338
350
|
]);
|
|
339
351
|
|
|
340
352
|
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AudioStreamFromParticipantRequest {
|