@livekit/rtc-node 0.13.14 → 0.13.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio_stream.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_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/audio_stream.cjs
CHANGED
|
@@ -21,7 +21,6 @@ __export(audio_stream_exports, {
|
|
|
21
21
|
AudioStream: () => AudioStream
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(audio_stream_exports);
|
|
24
|
-
var import_web = require("node:stream/web");
|
|
25
24
|
var import_audio_frame = require("./audio_frame.cjs");
|
|
26
25
|
var import_ffi_client = require("./ffi_client.cjs");
|
|
27
26
|
var import_audio_frame_pb = require("./proto/audio_frame_pb.cjs");
|
|
@@ -50,6 +49,7 @@ class AudioStreamSource {
|
|
|
50
49
|
this.sampleRate = sampleRateOrOptions.sampleRate ?? 48e3;
|
|
51
50
|
this.numChannels = sampleRateOrOptions.numChannels ?? 1;
|
|
52
51
|
this.ncOptions = sampleRateOrOptions.noiseCancellation;
|
|
52
|
+
this.frameSizeMs = sampleRateOrOptions.frameSizeMs;
|
|
53
53
|
} else {
|
|
54
54
|
this.sampleRate = sampleRateOrOptions ?? 48e3;
|
|
55
55
|
this.numChannels = numChannels ?? 1;
|
|
@@ -59,6 +59,7 @@ class AudioStreamSource {
|
|
|
59
59
|
trackHandle: track.ffi_handle.handle,
|
|
60
60
|
sampleRate: this.sampleRate,
|
|
61
61
|
numChannels: this.numChannels,
|
|
62
|
+
frameSizeMs: this.frameSizeMs,
|
|
62
63
|
...this.ncOptions ? {
|
|
63
64
|
audioFilterModuleId: this.ncOptions.moduleId,
|
|
64
65
|
audioFilterOptions: JSON.stringify(this.ncOptions.options)
|
|
@@ -81,7 +82,7 @@ class AudioStreamSource {
|
|
|
81
82
|
this.ffiHandle.dispose();
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
|
-
class AudioStream extends
|
|
85
|
+
class AudioStream extends ReadableStream {
|
|
85
86
|
constructor(track, sampleRateOrOptions, numChannels) {
|
|
86
87
|
super(new AudioStreamSource(track, sampleRateOrOptions, numChannels));
|
|
87
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { UnderlyingSource } from 'node:stream/web';\nimport { AudioFrame } from './audio_frame.js';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { NewAudioStreamResponse } from './proto/audio_frame_pb.js';\nimport { AudioStreamType, NewAudioStreamRequest } from './proto/audio_frame_pb.js';\nimport type { Track } from './track.js';\n\nexport interface AudioStreamOptions {\n noiseCancellation?: NoiseCancellationOptions;\n sampleRate?: number;\n numChannels?: number;\n frameSizeMs?: number;\n}\n\nexport interface NoiseCancellationOptions {\n moduleId: string;\n options: Record<string, any>;\n}\n\nclass AudioStreamSource implements UnderlyingSource<AudioFrame> {\n private controller?: ReadableStreamDefaultController<AudioFrame>;\n private ffiHandle: FfiHandle;\n private sampleRate: number;\n private numChannels: number;\n private ncOptions?: NoiseCancellationOptions;\n private frameSizeMs?: number;\n\n constructor(\n track: Track,\n sampleRateOrOptions?: number | AudioStreamOptions,\n numChannels?: number,\n ) {\n if (sampleRateOrOptions !== undefined && typeof sampleRateOrOptions !== 'number') {\n this.sampleRate = sampleRateOrOptions.sampleRate ?? 48000;\n this.numChannels = sampleRateOrOptions.numChannels ?? 1;\n this.ncOptions = sampleRateOrOptions.noiseCancellation;\n this.frameSizeMs = sampleRateOrOptions.frameSizeMs;\n } else {\n this.sampleRate = (sampleRateOrOptions as number) ?? 48000;\n this.numChannels = numChannels ?? 1;\n }\n\n const req = new NewAudioStreamRequest({\n type: AudioStreamType.AUDIO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n sampleRate: this.sampleRate,\n numChannels: this.numChannels,\n frameSizeMs: this.frameSizeMs,\n ...(this.ncOptions\n ? {\n audioFilterModuleId: this.ncOptions.moduleId,\n audioFilterOptions: JSON.stringify(this.ncOptions.options),\n }\n : {}),\n });\n\n const res = FfiClient.instance.request<NewAudioStreamResponse>({\n message: {\n case: 'newAudioStream',\n value: req,\n },\n });\n\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id!);\n\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 != 'audioStreamEvent' ||\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 frame = AudioFrame.fromOwnedInfo(streamEvent.value.frame!);\n this.controller.enqueue(frame);\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<AudioFrame>) {\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 AudioStream extends ReadableStream<AudioFrame> {\n constructor(track: Track);\n constructor(track: Track, sampleRate: number);\n constructor(track: Track, sampleRate: number, numChannels: number);\n constructor(track: Track, options: AudioStreamOptions);\n constructor(\n track: Track,\n sampleRateOrOptions?: number | AudioStreamOptions,\n numChannels?: number,\n ) {\n super(new AudioStreamSource(track, sampleRateOrOptions, numChannels));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAA2B;AAE3B,wBAAqD;AAErD,4BAAuD;AAevD,MAAM,kBAA0D;AAAA,EAQ9D,YACE,OACA,qBACA,aACA;AAqCF,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,QAAQ,8BAAW,cAAc,YAAY,MAAM,KAAM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AW,CAAC;AAAA,EACtE;AACF;","names":[]}
|
package/dist/audio_stream.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from 'node:stream/web';
|
|
2
1
|
import { AudioFrame } from './audio_frame.cjs';
|
|
3
2
|
import { Track } from './track.cjs';
|
|
4
3
|
import './proto/audio_frame_pb.cjs';
|
|
@@ -15,6 +14,7 @@ import './proto/ffi_pb.cjs';
|
|
|
15
14
|
import './proto/room_pb.cjs';
|
|
16
15
|
import './proto/participant_pb.cjs';
|
|
17
16
|
import './proto/video_frame_pb.cjs';
|
|
17
|
+
import './proto/data_stream_pb.cjs';
|
|
18
18
|
import './proto/rpc_pb.cjs';
|
|
19
19
|
import './proto/track_publication_pb.cjs';
|
|
20
20
|
import './video_source.cjs';
|
|
@@ -24,6 +24,7 @@ interface AudioStreamOptions {
|
|
|
24
24
|
noiseCancellation?: NoiseCancellationOptions;
|
|
25
25
|
sampleRate?: number;
|
|
26
26
|
numChannels?: number;
|
|
27
|
+
frameSizeMs?: number;
|
|
27
28
|
}
|
|
28
29
|
interface NoiseCancellationOptions {
|
|
29
30
|
moduleId: string;
|
package/dist/audio_stream.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from 'node:stream/web';
|
|
2
1
|
import { AudioFrame } from './audio_frame.js';
|
|
3
2
|
import { Track } from './track.js';
|
|
4
3
|
import './proto/audio_frame_pb.js';
|
|
@@ -15,6 +14,7 @@ import './proto/ffi_pb.js';
|
|
|
15
14
|
import './proto/room_pb.js';
|
|
16
15
|
import './proto/participant_pb.js';
|
|
17
16
|
import './proto/video_frame_pb.js';
|
|
17
|
+
import './proto/data_stream_pb.js';
|
|
18
18
|
import './proto/rpc_pb.js';
|
|
19
19
|
import './proto/track_publication_pb.js';
|
|
20
20
|
import './video_source.js';
|
|
@@ -24,6 +24,7 @@ interface AudioStreamOptions {
|
|
|
24
24
|
noiseCancellation?: NoiseCancellationOptions;
|
|
25
25
|
sampleRate?: number;
|
|
26
26
|
numChannels?: number;
|
|
27
|
+
frameSizeMs?: number;
|
|
27
28
|
}
|
|
28
29
|
interface NoiseCancellationOptions {
|
|
29
30
|
moduleId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio_stream.d.ts","sourceRoot":"","sources":["../src/audio_stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audio_stream.d.ts","sourceRoot":"","sources":["../src/audio_stream.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAsFD,qBAAa,WAAY,SAAQ,cAAc,CAAC,UAAU,CAAC;gBAC7C,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM;gBAChC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;gBACrD,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB;CAQtD"}
|
package/dist/audio_stream.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReadableStream } from "node:stream/web";
|
|
2
1
|
import { AudioFrame } from "./audio_frame.js";
|
|
3
2
|
import { FfiClient, FfiClientEvent, FfiHandle } from "./ffi_client.js";
|
|
4
3
|
import { AudioStreamType, NewAudioStreamRequest } from "./proto/audio_frame_pb.js";
|
|
@@ -27,6 +26,7 @@ class AudioStreamSource {
|
|
|
27
26
|
this.sampleRate = sampleRateOrOptions.sampleRate ?? 48e3;
|
|
28
27
|
this.numChannels = sampleRateOrOptions.numChannels ?? 1;
|
|
29
28
|
this.ncOptions = sampleRateOrOptions.noiseCancellation;
|
|
29
|
+
this.frameSizeMs = sampleRateOrOptions.frameSizeMs;
|
|
30
30
|
} else {
|
|
31
31
|
this.sampleRate = sampleRateOrOptions ?? 48e3;
|
|
32
32
|
this.numChannels = numChannels ?? 1;
|
|
@@ -36,6 +36,7 @@ class AudioStreamSource {
|
|
|
36
36
|
trackHandle: track.ffi_handle.handle,
|
|
37
37
|
sampleRate: this.sampleRate,
|
|
38
38
|
numChannels: this.numChannels,
|
|
39
|
+
frameSizeMs: this.frameSizeMs,
|
|
39
40
|
...this.ncOptions ? {
|
|
40
41
|
audioFilterModuleId: this.ncOptions.moduleId,
|
|
41
42
|
audioFilterOptions: JSON.stringify(this.ncOptions.options)
|
package/dist/audio_stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/audio_stream.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { UnderlyingSource } from 'node:stream/web';\nimport { AudioFrame } from './audio_frame.js';\nimport type { FfiEvent } from './ffi_client.js';\nimport { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';\nimport type { NewAudioStreamResponse } from './proto/audio_frame_pb.js';\nimport { AudioStreamType, NewAudioStreamRequest } from './proto/audio_frame_pb.js';\nimport type { Track } from './track.js';\n\nexport interface AudioStreamOptions {\n noiseCancellation?: NoiseCancellationOptions;\n sampleRate?: number;\n numChannels?: number;\n frameSizeMs?: number;\n}\n\nexport interface NoiseCancellationOptions {\n moduleId: string;\n options: Record<string, any>;\n}\n\nclass AudioStreamSource implements UnderlyingSource<AudioFrame> {\n private controller?: ReadableStreamDefaultController<AudioFrame>;\n private ffiHandle: FfiHandle;\n private sampleRate: number;\n private numChannels: number;\n private ncOptions?: NoiseCancellationOptions;\n private frameSizeMs?: number;\n\n constructor(\n track: Track,\n sampleRateOrOptions?: number | AudioStreamOptions,\n numChannels?: number,\n ) {\n if (sampleRateOrOptions !== undefined && typeof sampleRateOrOptions !== 'number') {\n this.sampleRate = sampleRateOrOptions.sampleRate ?? 48000;\n this.numChannels = sampleRateOrOptions.numChannels ?? 1;\n this.ncOptions = sampleRateOrOptions.noiseCancellation;\n this.frameSizeMs = sampleRateOrOptions.frameSizeMs;\n } else {\n this.sampleRate = (sampleRateOrOptions as number) ?? 48000;\n this.numChannels = numChannels ?? 1;\n }\n\n const req = new NewAudioStreamRequest({\n type: AudioStreamType.AUDIO_STREAM_NATIVE,\n trackHandle: track.ffi_handle.handle,\n sampleRate: this.sampleRate,\n numChannels: this.numChannels,\n frameSizeMs: this.frameSizeMs,\n ...(this.ncOptions\n ? {\n audioFilterModuleId: this.ncOptions.moduleId,\n audioFilterOptions: JSON.stringify(this.ncOptions.options),\n }\n : {}),\n });\n\n const res = FfiClient.instance.request<NewAudioStreamResponse>({\n message: {\n case: 'newAudioStream',\n value: req,\n },\n });\n\n this.ffiHandle = new FfiHandle(res.stream!.handle!.id!);\n\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 != 'audioStreamEvent' ||\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 frame = AudioFrame.fromOwnedInfo(streamEvent.value.frame!);\n this.controller.enqueue(frame);\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<AudioFrame>) {\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 AudioStream extends ReadableStream<AudioFrame> {\n constructor(track: Track);\n constructor(track: Track, sampleRate: number);\n constructor(track: Track, sampleRate: number, numChannels: number);\n constructor(track: Track, options: AudioStreamOptions);\n constructor(\n track: Track,\n sampleRateOrOptions?: number | AudioStreamOptions,\n numChannels?: number,\n ) {\n super(new AudioStreamSource(track, sampleRateOrOptions, numChannels));\n }\n}\n"],"mappings":"AAIA,SAAS,kBAAkB;AAE3B,SAAS,WAAW,gBAAgB,iBAAiB;AAErD,SAAS,iBAAiB,6BAA6B;AAevD,MAAM,kBAA0D;AAAA,EAQ9D,YACE,OACA,qBACA,aACA;AAqCF,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,QAAQ,WAAW,cAAc,YAAY,MAAM,KAAM;AAC/D,eAAK,WAAW,QAAQ,KAAK;AAC7B;AAAA,QACF,KAAK;AACH,oBAAU,SAAS,IAAI,eAAe,UAAU,KAAK,OAAO;AAC5D,eAAK,WAAW,MAAM;AACtB;AAAA,MACJ;AAAA,IACF;AA3DE,QAAI,wBAAwB,UAAa,OAAO,wBAAwB,UAAU;AAChF,WAAK,aAAa,oBAAoB,cAAc;AACpD,WAAK,cAAc,oBAAoB,eAAe;AACtD,WAAK,YAAY,oBAAoB;AACrC,WAAK,cAAc,oBAAoB;AAAA,IACzC,OAAO;AACL,WAAK,aAAc,uBAAkC;AACrD,WAAK,cAAc,eAAe;AAAA,IACpC;AAEA,UAAM,MAAM,IAAI,sBAAsB;AAAA,MACpC,MAAM,gBAAgB;AAAA,MACtB,aAAa,MAAM,WAAW;AAAA,MAC9B,YAAY,KAAK;AAAA,MACjB,aAAa,KAAK;AAAA,MAClB,aAAa,KAAK;AAAA,MAClB,GAAI,KAAK,YACL;AAAA,QACE,qBAAqB,KAAK,UAAU;AAAA,QACpC,oBAAoB,KAAK,UAAU,KAAK,UAAU,OAAO;AAAA,MAC3D,IACA,CAAC;AAAA,IACP,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;AAEtD,cAAU,SAAS,GAAG,eAAe,UAAU,KAAK,OAAO;AAAA,EAC7D;AAAA,EA2BA,MAAM,YAAyD;AAC7D,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,eAA2B;AAAA,EAK1D,YACE,OACA,qBACA,aACA;AACA,UAAM,IAAI,kBAAkB,OAAO,qBAAqB,WAAW,CAAC;AAAA,EACtE;AACF;","names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from '../stream_reader-
|
|
1
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from '../stream_reader-Ch2zvjU3.cjs';
|
|
2
2
|
export { ByteStreamWriter, TextStreamWriter } from './stream_writer.cjs';
|
|
3
|
-
import 'node:stream/web';
|
|
4
3
|
import '../proto/room_pb.cjs';
|
|
5
4
|
import '@bufbuild/protobuf';
|
|
6
5
|
import '../proto/participant_pb.cjs';
|
|
@@ -9,3 +8,4 @@ import '../proto/track_pb.cjs';
|
|
|
9
8
|
import '../proto/stats_pb.cjs';
|
|
10
9
|
import '../proto/e2ee_pb.cjs';
|
|
11
10
|
import '../proto/video_frame_pb.cjs';
|
|
11
|
+
import '../proto/data_stream_pb.cjs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from '../stream_reader-
|
|
1
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from '../stream_reader-DRyR29vo.js';
|
|
2
2
|
export { ByteStreamWriter, TextStreamWriter } from './stream_writer.js';
|
|
3
|
-
import 'node:stream/web';
|
|
4
3
|
import '../proto/room_pb.js';
|
|
5
4
|
import '@bufbuild/protobuf';
|
|
6
5
|
import '../proto/participant_pb.js';
|
|
@@ -9,3 +8,4 @@ import '../proto/track_pb.js';
|
|
|
9
8
|
import '../proto/stats_pb.js';
|
|
10
9
|
import '../proto/e2ee_pb.js';
|
|
11
10
|
import '../proto/video_frame_pb.js';
|
|
11
|
+
import '../proto/data_stream_pb.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data_streams/stream_reader.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/data_streams/stream_reader.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../log.js';\nimport type { DataStream_Chunk } from '../proto/room_pb.js';\nimport { bigIntToNumber } from '../utils.js';\nimport type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from './types.js';\n\nabstract class BaseStreamReader<T extends BaseStreamInfo> {\n protected reader: ReadableStream<DataStream_Chunk>;\n\n protected totalByteSize?: number;\n\n protected _info: T;\n\n protected bytesReceived: number;\n\n get info() {\n return this._info;\n }\n\n constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number) {\n this.reader = stream;\n this.totalByteSize = totalByteSize;\n this._info = info;\n this.bytesReceived = 0;\n }\n\n protected abstract handleChunkReceived(chunk: DataStream_Chunk): void;\n\n onProgress?: (progress: number | undefined) => void;\n\n abstract readAll(): Promise<string | Array<Uint8Array>>;\n}\n\n/**\n * A class to read chunks from a ReadableStream and provide them in a structured format.\n */\nexport class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {\n protected handleChunkReceived(chunk: DataStream_Chunk) {\n this.bytesReceived += chunk.content!.byteLength;\n const currentProgress = this.totalByteSize\n ? this.bytesReceived / this.totalByteSize\n : undefined;\n this.onProgress?.(currentProgress);\n }\n\n [Symbol.asyncIterator]() {\n const reader = this.reader.getReader();\n\n return {\n next: async (): Promise<IteratorResult<Uint8Array>> => {\n try {\n const { done, value } = await reader.read();\n if (done) {\n return { done: true, value: undefined as any };\n } else {\n this.handleChunkReceived(value);\n return { done: false, value: value.content! };\n }\n } catch (error) {\n log.error('error processing stream update', error);\n return { done: true, value: undefined };\n }\n },\n\n return(): IteratorResult<Uint8Array> {\n reader.releaseLock();\n return { done: true, value: undefined };\n },\n };\n }\n\n async readAll(): Promise<Array<Uint8Array>> {\n const chunks: Set<Uint8Array> = new Set();\n for await (const chunk of this) {\n chunks.add(chunk);\n }\n return Array.from(chunks);\n }\n}\n\n/**\n * A class to read chunks from a ReadableStream and provide them in a structured format.\n */\nexport class TextStreamReader extends BaseStreamReader<TextStreamInfo> {\n private receivedChunks: Map<number, DataStream_Chunk>;\n\n /**\n * A TextStreamReader instance can be used as an AsyncIterator that returns the entire string\n * that has been received up to the current point in time.\n */\n constructor(\n info: TextStreamInfo,\n stream: ReadableStream<DataStream_Chunk>,\n totalChunkCount?: number,\n ) {\n super(info, stream, totalChunkCount);\n this.receivedChunks = new Map();\n }\n\n protected handleChunkReceived(chunk: DataStream_Chunk) {\n const index = bigIntToNumber(chunk.chunkIndex!);\n const previousChunkAtIndex = this.receivedChunks.get(index!);\n if (previousChunkAtIndex && previousChunkAtIndex.version! > chunk.version!) {\n // we have a newer version already, dropping the old one\n return;\n }\n this.receivedChunks.set(index, chunk);\n const currentProgress = this.totalByteSize\n ? this.receivedChunks.size / this.totalByteSize\n : undefined;\n this.onProgress?.(currentProgress);\n }\n\n /**\n * Async iterator implementation to allow usage of `for await...of` syntax.\n * Yields structured chunks from the stream.\n *\n */\n [Symbol.asyncIterator]() {\n const reader = this.reader.getReader();\n const decoder = new TextDecoder();\n\n return {\n next: async (): Promise<IteratorResult<string>> => {\n try {\n const { done, value } = await reader.read();\n if (done) {\n return { done: true, value: undefined };\n } else {\n this.handleChunkReceived(value);\n return {\n done: false,\n value: decoder.decode(value.content!),\n };\n }\n } catch (error) {\n log.error('error processing stream update', error);\n return { done: true, value: undefined };\n }\n },\n\n return(): IteratorResult<string> {\n reader.releaseLock();\n return { done: true, value: undefined };\n },\n };\n }\n\n async readAll(): Promise<string> {\n let finalString: string = '';\n for await (const chunk of this) {\n finalString += chunk;\n }\n return finalString;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB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names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import 'node:stream/web';
|
|
2
1
|
import '../proto/room_pb.cjs';
|
|
3
|
-
export { B as ByteStreamReader, T as TextStreamReader } from '../stream_reader-
|
|
2
|
+
export { B as ByteStreamReader, T as TextStreamReader } from '../stream_reader-Ch2zvjU3.cjs';
|
|
4
3
|
import '@bufbuild/protobuf';
|
|
5
4
|
import '../proto/participant_pb.cjs';
|
|
6
5
|
import '../proto/handle_pb.cjs';
|
|
@@ -8,3 +7,4 @@ import '../proto/track_pb.cjs';
|
|
|
8
7
|
import '../proto/stats_pb.cjs';
|
|
9
8
|
import '../proto/e2ee_pb.cjs';
|
|
10
9
|
import '../proto/video_frame_pb.cjs';
|
|
10
|
+
import '../proto/data_stream_pb.cjs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import 'node:stream/web';
|
|
2
1
|
import '../proto/room_pb.js';
|
|
3
|
-
export { B as ByteStreamReader, T as TextStreamReader } from '../stream_reader-
|
|
2
|
+
export { B as ByteStreamReader, T as TextStreamReader } from '../stream_reader-DRyR29vo.js';
|
|
4
3
|
import '@bufbuild/protobuf';
|
|
5
4
|
import '../proto/participant_pb.js';
|
|
6
5
|
import '../proto/handle_pb.js';
|
|
@@ -8,3 +7,4 @@ import '../proto/track_pb.js';
|
|
|
8
7
|
import '../proto/stats_pb.js';
|
|
9
8
|
import '../proto/e2ee_pb.js';
|
|
10
9
|
import '../proto/video_frame_pb.js';
|
|
10
|
+
import '../proto/data_stream_pb.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream_reader.d.ts","sourceRoot":"","sources":["../../src/data_streams/stream_reader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream_reader.d.ts","sourceRoot":"","sources":["../../src/data_streams/stream_reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,c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,EAAE,gBAAgB;IAcrD;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC;oBAKF,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;kBAkBrC,cAAc,CAAC,MAAM,CAAC;;IAO9B,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAOjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data_streams/stream_reader.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/data_streams/stream_reader.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../log.js';\nimport type { DataStream_Chunk } from '../proto/room_pb.js';\nimport { bigIntToNumber } from '../utils.js';\nimport type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from './types.js';\n\nabstract class BaseStreamReader<T extends BaseStreamInfo> {\n protected reader: ReadableStream<DataStream_Chunk>;\n\n protected totalByteSize?: number;\n\n protected _info: T;\n\n protected bytesReceived: number;\n\n get info() {\n return this._info;\n }\n\n constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number) {\n this.reader = stream;\n this.totalByteSize = totalByteSize;\n this._info = info;\n this.bytesReceived = 0;\n }\n\n protected abstract handleChunkReceived(chunk: DataStream_Chunk): void;\n\n onProgress?: (progress: number | undefined) => void;\n\n abstract readAll(): Promise<string | Array<Uint8Array>>;\n}\n\n/**\n * A class to read chunks from a ReadableStream and provide them in a structured format.\n */\nexport class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {\n protected handleChunkReceived(chunk: DataStream_Chunk) {\n this.bytesReceived += chunk.content!.byteLength;\n const currentProgress = this.totalByteSize\n ? this.bytesReceived / this.totalByteSize\n : undefined;\n this.onProgress?.(currentProgress);\n }\n\n [Symbol.asyncIterator]() {\n const reader = this.reader.getReader();\n\n return {\n next: async (): Promise<IteratorResult<Uint8Array>> => {\n try {\n const { done, value } = await reader.read();\n if (done) {\n return { done: true, value: undefined as any };\n } else {\n this.handleChunkReceived(value);\n return { done: false, value: value.content! };\n }\n } catch (error) {\n log.error('error processing stream update', error);\n return { done: true, value: undefined };\n }\n },\n\n return(): IteratorResult<Uint8Array> {\n reader.releaseLock();\n return { done: true, value: undefined };\n },\n };\n }\n\n async readAll(): Promise<Array<Uint8Array>> {\n const chunks: Set<Uint8Array> = new Set();\n for await (const chunk of this) {\n chunks.add(chunk);\n }\n return Array.from(chunks);\n }\n}\n\n/**\n * A class to read chunks from a ReadableStream and provide them in a structured format.\n */\nexport class TextStreamReader extends BaseStreamReader<TextStreamInfo> {\n private receivedChunks: Map<number, DataStream_Chunk>;\n\n /**\n * A TextStreamReader instance can be used as an AsyncIterator that returns the entire string\n * that has been received up to the current point in time.\n */\n constructor(\n info: TextStreamInfo,\n stream: ReadableStream<DataStream_Chunk>,\n totalChunkCount?: number,\n ) {\n super(info, stream, totalChunkCount);\n this.receivedChunks = new Map();\n }\n\n protected handleChunkReceived(chunk: DataStream_Chunk) {\n const index = bigIntToNumber(chunk.chunkIndex!);\n const previousChunkAtIndex = this.receivedChunks.get(index!);\n if (previousChunkAtIndex && previousChunkAtIndex.version! > chunk.version!) {\n // we have a newer version already, dropping the old one\n return;\n }\n this.receivedChunks.set(index, chunk);\n const currentProgress = this.totalByteSize\n ? this.receivedChunks.size / this.totalByteSize\n : undefined;\n this.onProgress?.(currentProgress);\n }\n\n /**\n * Async iterator implementation to allow usage of `for await...of` syntax.\n * Yields structured chunks from the stream.\n *\n */\n [Symbol.asyncIterator]() {\n const reader = this.reader.getReader();\n const decoder = new TextDecoder();\n\n return {\n next: async (): Promise<IteratorResult<string>> => {\n try {\n const { done, value } = await reader.read();\n if (done) {\n return { done: true, value: undefined };\n } else {\n this.handleChunkReceived(value);\n return {\n done: false,\n value: decoder.decode(value.content!),\n };\n }\n } catch (error) {\n log.error('error processing stream update', error);\n return { done: true, value: undefined };\n }\n },\n\n return(): IteratorResult<string> {\n reader.releaseLock();\n return { done: true, value: undefined };\n },\n };\n }\n\n async readAll(): Promise<string> {\n let finalString: string = '';\n for await (const chunk of this) {\n finalString += chunk;\n }\n return finalString;\n }\n}\n"],"mappings":"AAGA,SAAS,WAAW;AAEpB,SAAS,sBAAsB;AAG/B,MAAe,iBAA2C;AAAA,EASxD,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,MAAS,QAA0C,eAAwB;AACrF,SAAK,SAAS;AACd,SAAK,gBAAgB;AACrB,SAAK,QAAQ;AACb,SAAK,gBAAgB;AAAA,EACvB;AAOF;AAKO,MAAM,yBAAyB,iBAAiC;AAAA,EAC3D,oBAAoB,OAAyB;AAvCzD;AAwCI,SAAK,iBAAiB,MAAM,QAAS;AACrC,UAAM,kBAAkB,KAAK,gBACzB,KAAK,gBAAgB,KAAK,gBAC1B;AACJ,eAAK,eAAL,8BAAkB;AAAA,EACpB;AAAA,EAEA,CAAC,OAAO,aAAa,IAAI;AACvB,UAAM,SAAS,KAAK,OAAO,UAAU;AAErC,WAAO;AAAA,MACL,MAAM,YAAiD;AACrD,YAAI;AACF,gBAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,cAAI,MAAM;AACR,mBAAO,EAAE,MAAM,MAAM,OAAO,OAAiB;AAAA,UAC/C,OAAO;AACL,iBAAK,oBAAoB,KAAK;AAC9B,mBAAO,EAAE,MAAM,OAAO,OAAO,MAAM,QAAS;AAAA,UAC9C;AAAA,QACF,SAAS,OAAO;AACd,cAAI,MAAM,kCAAkC,KAAK;AACjD,iBAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,QACxC;AAAA,MACF;AAAA,MAEA,SAAqC;AACnC,eAAO,YAAY;AACnB,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAAA,IACF;AAAA,EACF;AAAA,EAE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eAAO,YAAY;AACnB,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAA2B;AAC/B,QAAI,cAAsB;AAC1B,qBAAiB,SAAS,MAAM;AAC9B,qBAAe;AAAA,IACjB;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data_streams/stream_writer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/data_streams/stream_writer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from './types.js';\n\nclass BaseStreamWriter<T, InfoType extends BaseStreamInfo> {\n protected writableStream: WritableStream<T>;\n\n protected defaultWriter: WritableStreamDefaultWriter<T>;\n\n protected onClose?: () => void;\n\n readonly info: InfoType;\n\n constructor(writableStream: WritableStream<T>, info: InfoType, onClose?: () => void) {\n this.writableStream = writableStream;\n this.defaultWriter = writableStream.getWriter();\n this.onClose = onClose;\n this.info = info;\n }\n\n write(chunk: T): Promise<void> {\n return this.defaultWriter.write(chunk);\n }\n\n async close() {\n await this.defaultWriter.close();\n this.defaultWriter.releaseLock();\n this.onClose?.();\n }\n}\n\nexport class TextStreamWriter extends BaseStreamWriter<string, TextStreamInfo> {}\n\nexport class ByteStreamWriter extends BaseStreamWriter<Uint8Array, ByteStreamInfo> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,MAAM,iBAAqD;AAAA,EASzD,YAAY,gBAAmC,MAAgB,SAAsB;AACnF,SAAK,iBAAiB;AACtB,SAAK,gBAAgB,eAAe,UAAU;AAC9C,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,MAAM,OAAyB;AAC7B,WAAO,KAAK,cAAc,MAAM,KAAK;AAAA,EACvC;AAAA,EAEA,MAAM,QAAQ;AAzBhB;AA0BI,UAAM,KAAK,cAAc,MAAM;AAC/B,SAAK,cAAc,YAAY;AAC/B,eAAK,YAAL;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,iBAAyC;AAAC;AAEzE,MAAM,yBAAyB,iBAA6C;AAAC;","names":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as BaseStreamInfo, c as TextStreamInfo, b as ByteStreamInfo } from '../stream_reader-
|
|
2
|
-
import { WritableStream } from 'node:stream/web';
|
|
1
|
+
import { a as BaseStreamInfo, c as TextStreamInfo, b as ByteStreamInfo } from '../stream_reader-Ch2zvjU3.cjs';
|
|
3
2
|
import '../proto/room_pb.cjs';
|
|
4
3
|
import '@bufbuild/protobuf';
|
|
5
4
|
import '../proto/participant_pb.cjs';
|
|
@@ -8,6 +7,7 @@ import '../proto/track_pb.cjs';
|
|
|
8
7
|
import '../proto/stats_pb.cjs';
|
|
9
8
|
import '../proto/e2ee_pb.cjs';
|
|
10
9
|
import '../proto/video_frame_pb.cjs';
|
|
10
|
+
import '../proto/data_stream_pb.cjs';
|
|
11
11
|
|
|
12
12
|
declare class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
|
|
13
13
|
protected writableStream: WritableStream<T>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as BaseStreamInfo, c as TextStreamInfo, b as ByteStreamInfo } from '../stream_reader-
|
|
2
|
-
import { WritableStream } from 'node:stream/web';
|
|
1
|
+
import { a as BaseStreamInfo, c as TextStreamInfo, b as ByteStreamInfo } from '../stream_reader-DRyR29vo.js';
|
|
3
2
|
import '../proto/room_pb.js';
|
|
4
3
|
import '@bufbuild/protobuf';
|
|
5
4
|
import '../proto/participant_pb.js';
|
|
@@ -8,6 +7,7 @@ import '../proto/track_pb.js';
|
|
|
8
7
|
import '../proto/stats_pb.js';
|
|
9
8
|
import '../proto/e2ee_pb.js';
|
|
10
9
|
import '../proto/video_frame_pb.js';
|
|
10
|
+
import '../proto/data_stream_pb.js';
|
|
11
11
|
|
|
12
12
|
declare class BaseStreamWriter<T, InfoType extends BaseStreamInfo> {
|
|
13
13
|
protected writableStream: WritableStream<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream_writer.d.ts","sourceRoot":"","sources":["../../src/data_streams/stream_writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"stream_writer.d.ts","sourceRoot":"","sources":["../../src/data_streams/stream_writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjF,cAAM,gBAAgB,CAAC,CAAC,EAAE,QAAQ,SAAS,cAAc;IACvD,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAE5C,SAAS,CAAC,aAAa,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;IAExD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAE/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;gBAEZ,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,IAAI;IAOnF,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxB,KAAK;CAKZ;AAED,qBAAa,gBAAiB,SAAQ,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC;CAAG;AAEjF,qBAAa,gBAAiB,SAAQ,gBAAgB,CAAC,UAAU,EAAE,cAAc,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data_streams/stream_writer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/data_streams/stream_writer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { BaseStreamInfo, ByteStreamInfo, TextStreamInfo } from './types.js';\n\nclass BaseStreamWriter<T, InfoType extends BaseStreamInfo> {\n protected writableStream: WritableStream<T>;\n\n protected defaultWriter: WritableStreamDefaultWriter<T>;\n\n protected onClose?: () => void;\n\n readonly info: InfoType;\n\n constructor(writableStream: WritableStream<T>, info: InfoType, onClose?: () => void) {\n this.writableStream = writableStream;\n this.defaultWriter = writableStream.getWriter();\n this.onClose = onClose;\n this.info = info;\n }\n\n write(chunk: T): Promise<void> {\n return this.defaultWriter.write(chunk);\n }\n\n async close() {\n await this.defaultWriter.close();\n this.defaultWriter.releaseLock();\n this.onClose?.();\n }\n}\n\nexport class TextStreamWriter extends BaseStreamWriter<string, TextStreamInfo> {}\n\nexport class ByteStreamWriter extends BaseStreamWriter<Uint8Array, ByteStreamInfo> {}\n"],"mappings":"AAKA,MAAM,iBAAqD;AAAA,EASzD,YAAY,gBAAmC,MAAgB,SAAsB;AACnF,SAAK,iBAAiB;AACtB,SAAK,gBAAgB,eAAe,UAAU;AAC9C,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,MAAM,OAAyB;AAC7B,WAAO,KAAK,cAAc,MAAM,KAAK;AAAA,EACvC;AAAA,EAEA,MAAM,QAAQ;AAzBhB;AA0BI,UAAM,KAAK,cAAc,MAAM;AAC/B,SAAK,cAAc,YAAY;AAC/B,eAAK,YAAL;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,iBAAyC;AAAC;AAEzE,MAAM,yBAAyB,iBAA6C;AAAC;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../proto/room_pb.cjs';
|
|
2
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions } from '../stream_reader-
|
|
2
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions } from '../stream_reader-Ch2zvjU3.cjs';
|
|
3
3
|
import '@bufbuild/protobuf';
|
|
4
4
|
import '../proto/participant_pb.cjs';
|
|
5
5
|
import '../proto/handle_pb.cjs';
|
|
@@ -7,4 +7,4 @@ import '../proto/track_pb.cjs';
|
|
|
7
7
|
import '../proto/stats_pb.cjs';
|
|
8
8
|
import '../proto/e2ee_pb.cjs';
|
|
9
9
|
import '../proto/video_frame_pb.cjs';
|
|
10
|
-
import '
|
|
10
|
+
import '../proto/data_stream_pb.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../proto/room_pb.js';
|
|
2
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions } from '../stream_reader-
|
|
2
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions } from '../stream_reader-DRyR29vo.js';
|
|
3
3
|
import '@bufbuild/protobuf';
|
|
4
4
|
import '../proto/participant_pb.js';
|
|
5
5
|
import '../proto/handle_pb.js';
|
|
@@ -7,4 +7,4 @@ import '../proto/track_pb.js';
|
|
|
7
7
|
import '../proto/stats_pb.js';
|
|
8
8
|
import '../proto/e2ee_pb.js';
|
|
9
9
|
import '../proto/video_frame_pb.js';
|
|
10
|
-
import '
|
|
10
|
+
import '../proto/data_stream_pb.js';
|
package/dist/ffi_client.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ import './proto/track_pb.cjs';
|
|
|
10
10
|
import './proto/stats_pb.cjs';
|
|
11
11
|
import './proto/e2ee_pb.cjs';
|
|
12
12
|
import './proto/video_frame_pb.cjs';
|
|
13
|
+
import './proto/data_stream_pb.cjs';
|
|
13
14
|
import './proto/audio_frame_pb.cjs';
|
|
14
15
|
import './proto/rpc_pb.cjs';
|
|
15
16
|
import './proto/track_publication_pb.cjs';
|
package/dist/ffi_client.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import './proto/track_pb.js';
|
|
|
10
10
|
import './proto/stats_pb.js';
|
|
11
11
|
import './proto/e2ee_pb.js';
|
|
12
12
|
import './proto/video_frame_pb.js';
|
|
13
|
+
import './proto/data_stream_pb.js';
|
|
13
14
|
import './proto/audio_frame_pb.js';
|
|
14
15
|
import './proto/rpc_pb.js';
|
|
15
16
|
import './proto/track_publication_pb.js';
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { AudioResampler, AudioResamplerQuality } from './audio_resampler.cjs';
|
|
|
3
3
|
export { AudioSource } from './audio_source.cjs';
|
|
4
4
|
export { AudioStream, NoiseCancellationOptions } from './audio_stream.cjs';
|
|
5
5
|
export { AudioFilter } from './audio_filter.cjs';
|
|
6
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from './stream_reader-
|
|
6
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from './stream_reader-Ch2zvjU3.cjs';
|
|
7
7
|
export { ByteStreamWriter, TextStreamWriter } from './data_streams/stream_writer.cjs';
|
|
8
8
|
export { E2EEManager, E2EEOptions, FrameCryptor, KeyProvider, KeyProviderOptions } from './e2ee.cjs';
|
|
9
9
|
import './ffi_client.cjs';
|
|
@@ -26,10 +26,10 @@ export { livekitDispose as dispose } from './napi/native.d.cjs';
|
|
|
26
26
|
import './proto/audio_frame_pb.cjs';
|
|
27
27
|
import '@bufbuild/protobuf';
|
|
28
28
|
import './proto/handle_pb.cjs';
|
|
29
|
-
import 'node:stream/web';
|
|
30
29
|
import '@livekit/typed-emitter';
|
|
31
30
|
import './proto/ffi_pb.cjs';
|
|
32
31
|
import './proto/rpc_pb.cjs';
|
|
33
32
|
import './proto/track_publication_pb.cjs';
|
|
33
|
+
import './proto/data_stream_pb.cjs';
|
|
34
34
|
import 'node:fs';
|
|
35
35
|
import './proto/stats_pb.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';
|
|
|
3
3
|
export { AudioSource } from './audio_source.js';
|
|
4
4
|
export { AudioStream, NoiseCancellationOptions } from './audio_stream.js';
|
|
5
5
|
export { AudioFilter } from './audio_filter.js';
|
|
6
|
-
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from './stream_reader-
|
|
6
|
+
export { a as BaseStreamInfo, f as ByteStreamHandler, b as ByteStreamInfo, e as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, g as TextStreamHandler, c as TextStreamInfo, d as TextStreamOptions, T as TextStreamReader } from './stream_reader-DRyR29vo.js';
|
|
7
7
|
export { ByteStreamWriter, TextStreamWriter } from './data_streams/stream_writer.js';
|
|
8
8
|
export { E2EEManager, E2EEOptions, FrameCryptor, KeyProvider, KeyProviderOptions } from './e2ee.js';
|
|
9
9
|
import './ffi_client.js';
|
|
@@ -26,10 +26,10 @@ export { livekitDispose as dispose } from './napi/native.d.js';
|
|
|
26
26
|
import './proto/audio_frame_pb.js';
|
|
27
27
|
import '@bufbuild/protobuf';
|
|
28
28
|
import './proto/handle_pb.js';
|
|
29
|
-
import 'node:stream/web';
|
|
30
29
|
import '@livekit/typed-emitter';
|
|
31
30
|
import './proto/ffi_pb.js';
|
|
32
31
|
import './proto/rpc_pb.js';
|
|
33
32
|
import './proto/track_publication_pb.js';
|
|
33
|
+
import './proto/data_stream_pb.js';
|
|
34
34
|
import 'node:fs';
|
|
35
35
|
import './proto/stats_pb.js';
|
package/dist/participant.cjs
CHANGED
|
@@ -30,8 +30,6 @@ var import_ffi_client = require("./ffi_client.cjs");
|
|
|
30
30
|
var import_log = require("./log.cjs");
|
|
31
31
|
var import_participant_pb = require("./proto/participant_pb.cjs");
|
|
32
32
|
var import_room_pb = require("./proto/room_pb.cjs");
|
|
33
|
-
var import_room_pb2 = require("./proto/room_pb.cjs");
|
|
34
|
-
var import_room_pb3 = require("./proto/room_pb.cjs");
|
|
35
33
|
var import_rpc_pb = require("./proto/rpc_pb.cjs");
|
|
36
34
|
var import_rpc = require("./rpc.cjs");
|
|
37
35
|
var import_track_publication = require("./track_publication.cjs");
|
|
@@ -75,7 +73,7 @@ class LocalParticipant extends Participant {
|
|
|
75
73
|
this.trackPublications = /* @__PURE__ */ new Map();
|
|
76
74
|
}
|
|
77
75
|
async publishData(data, options) {
|
|
78
|
-
const req = new
|
|
76
|
+
const req = new import_room_pb.PublishDataRequest({
|
|
79
77
|
localParticipantHandle: this.ffi_handle.handle,
|
|
80
78
|
dataPtr: import_ffi_client.FfiClient.instance.retrievePtr(data),
|
|
81
79
|
dataLen: BigInt(data.byteLength),
|
|
@@ -94,7 +92,7 @@ class LocalParticipant extends Participant {
|
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
async publishDtmf(code, digit) {
|
|
97
|
-
const req = new
|
|
95
|
+
const req = new import_room_pb.PublishSipDtmfRequest({
|
|
98
96
|
localParticipantHandle: this.ffi_handle.handle,
|
|
99
97
|
code,
|
|
100
98
|
digit
|
|
@@ -110,11 +108,11 @@ class LocalParticipant extends Participant {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
async publishTranscription(transcription) {
|
|
113
|
-
const req = new
|
|
111
|
+
const req = new import_room_pb.PublishTranscriptionRequest({
|
|
114
112
|
localParticipantHandle: this.ffi_handle.handle,
|
|
115
113
|
participantIdentity: transcription.participantIdentity,
|
|
116
114
|
segments: transcription.segments.map(
|
|
117
|
-
(s) => new
|
|
115
|
+
(s) => new import_room_pb.TranscriptionSegment({
|
|
118
116
|
id: s.id,
|
|
119
117
|
text: s.text,
|
|
120
118
|
startTime: s.startTime,
|
|
@@ -136,7 +134,7 @@ class LocalParticipant extends Participant {
|
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
136
|
async updateMetadata(metadata) {
|
|
139
|
-
const req = new
|
|
137
|
+
const req = new import_room_pb.SetLocalMetadataRequest({
|
|
140
138
|
localParticipantHandle: this.ffi_handle.handle,
|
|
141
139
|
metadata
|
|
142
140
|
});
|
|
@@ -317,7 +315,7 @@ class LocalParticipant extends Participant {
|
|
|
317
315
|
const fileStats = await (0, import_promises.stat)(path);
|
|
318
316
|
const file = await (0, import_promises.open)(path);
|
|
319
317
|
try {
|
|
320
|
-
const stream = file.readableWebStream(
|
|
318
|
+
const stream = file.readableWebStream();
|
|
321
319
|
const streamId = crypto.randomUUID();
|
|
322
320
|
const destinationIdentities = options == null ? void 0 : options.destinationIdentities;
|
|
323
321
|
const writer = await this.streamBytes({
|
|
@@ -382,7 +380,7 @@ class LocalParticipant extends Participant {
|
|
|
382
380
|
*
|
|
383
381
|
*/
|
|
384
382
|
async sendChatMessage(text, destinationIdentities, senderIdentity) {
|
|
385
|
-
const req = new
|
|
383
|
+
const req = new import_room_pb.SendChatMessageRequest({
|
|
386
384
|
localParticipantHandle: this.ffi_handle.handle,
|
|
387
385
|
message: text,
|
|
388
386
|
destinationIdentities,
|
|
@@ -412,10 +410,10 @@ class LocalParticipant extends Participant {
|
|
|
412
410
|
* @experimental
|
|
413
411
|
*/
|
|
414
412
|
async editChatMessage(editText, originalMessage, destinationIdentities, senderIdentity) {
|
|
415
|
-
const req = new
|
|
413
|
+
const req = new import_room_pb.EditChatMessageRequest({
|
|
416
414
|
localParticipantHandle: this.ffi_handle.handle,
|
|
417
415
|
editText,
|
|
418
|
-
originalMessage: new
|
|
416
|
+
originalMessage: new import_room_pb.ChatMessage({
|
|
419
417
|
...originalMessage,
|
|
420
418
|
timestamp: BigInt(originalMessage.timestamp),
|
|
421
419
|
editTimestamp: originalMessage.editTimestamp ? BigInt(originalMessage.editTimestamp) : void 0
|
|
@@ -444,7 +442,7 @@ class LocalParticipant extends Participant {
|
|
|
444
442
|
}
|
|
445
443
|
}
|
|
446
444
|
async updateName(name) {
|
|
447
|
-
const req = new
|
|
445
|
+
const req = new import_room_pb.SetLocalNameRequest({
|
|
448
446
|
localParticipantHandle: this.ffi_handle.handle,
|
|
449
447
|
name
|
|
450
448
|
});
|
|
@@ -456,7 +454,7 @@ class LocalParticipant extends Participant {
|
|
|
456
454
|
});
|
|
457
455
|
}
|
|
458
456
|
async setAttributes(attributes) {
|
|
459
|
-
const req = new
|
|
457
|
+
const req = new import_room_pb.SetLocalAttributesRequest({
|
|
460
458
|
localParticipantHandle: this.ffi_handle.handle,
|
|
461
459
|
attributes: Object.entries(attributes).map(([key, value]) => ({ key, value }))
|
|
462
460
|
});
|
|
@@ -468,7 +466,7 @@ class LocalParticipant extends Participant {
|
|
|
468
466
|
});
|
|
469
467
|
}
|
|
470
468
|
async publishTrack(track, options) {
|
|
471
|
-
const req = new
|
|
469
|
+
const req = new import_room_pb.PublishTrackRequest({
|
|
472
470
|
localParticipantHandle: this.ffi_handle.handle,
|
|
473
471
|
trackHandle: track.ffi_handle.handle,
|
|
474
472
|
options
|
|
@@ -491,7 +489,7 @@ class LocalParticipant extends Participant {
|
|
|
491
489
|
}
|
|
492
490
|
}
|
|
493
491
|
async unpublishTrack(trackSid, stopOnUnpublish) {
|
|
494
|
-
const req = new
|
|
492
|
+
const req = new import_room_pb.UnpublishTrackRequest({
|
|
495
493
|
localParticipantHandle: this.ffi_handle.handle,
|
|
496
494
|
trackSid,
|
|
497
495
|
stopOnUnpublish: stopOnUnpublish ?? true
|