@livekit/rtc-node 0.13.2 → 0.13.4
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/data_streams/index.cjs +25 -0
- package/dist/data_streams/index.cjs.map +1 -0
- package/dist/data_streams/index.d.cts +11 -0
- package/dist/data_streams/index.d.ts +11 -0
- package/dist/data_streams/index.d.ts.map +1 -0
- package/dist/data_streams/index.js +3 -0
- package/dist/data_streams/index.js.map +1 -0
- package/dist/data_streams/stream_reader.cjs +145 -0
- package/dist/data_streams/stream_reader.cjs.map +1 -0
- package/dist/data_streams/stream_reader.d.cts +10 -0
- package/dist/data_streams/stream_reader.d.ts +10 -0
- package/dist/data_streams/stream_reader.d.ts.map +1 -0
- package/dist/data_streams/stream_reader.js +120 -0
- package/dist/data_streams/stream_reader.js.map +1 -0
- package/dist/data_streams/stream_writer.cjs +51 -0
- package/dist/data_streams/stream_writer.cjs.map +1 -0
- package/dist/data_streams/stream_writer.d.cts +26 -0
- package/dist/data_streams/stream_writer.d.ts +26 -0
- package/dist/data_streams/stream_writer.d.ts.map +1 -0
- package/dist/data_streams/stream_writer.js +26 -0
- package/dist/data_streams/stream_writer.js.map +1 -0
- package/dist/data_streams/types.cjs +17 -0
- package/dist/data_streams/types.cjs.map +1 -0
- package/dist/data_streams/types.d.cts +10 -0
- package/dist/data_streams/types.d.ts +10 -0
- package/dist/data_streams/types.d.ts.map +1 -0
- package/dist/data_streams/types.js +1 -0
- package/dist/data_streams/types.js.map +1 -0
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/log.cjs +42 -0
- package/dist/log.cjs.map +1 -0
- package/dist/log.d.cts +7 -0
- package/dist/log.d.ts +7 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +18 -0
- package/dist/log.js.map +1 -0
- package/dist/napi/native.d.cjs.map +1 -1
- package/dist/napi/native.d.ts +5 -5
- package/dist/native.d.ts +5 -5
- package/dist/participant.cjs +260 -16
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +40 -6
- package/dist/participant.d.ts +40 -6
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +263 -5
- package/dist/participant.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +14 -3
- package/dist/proto/ffi_pb.cjs.map +1 -1
- package/dist/proto/ffi_pb.d.cts +81 -7
- package/dist/proto/ffi_pb.d.ts +81 -7
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +15 -4
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +488 -30
- package/dist/proto/room_pb.cjs.map +1 -1
- package/dist/proto/room_pb.d.cts +412 -50
- package/dist/proto/room_pb.d.ts +412 -50
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +471 -29
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/video_frame_pb.cjs.map +1 -1
- package/dist/proto/video_frame_pb.d.cts +3 -0
- package/dist/proto/video_frame_pb.d.ts +3 -0
- package/dist/proto/video_frame_pb.d.ts.map +1 -1
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +202 -45
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +21 -3
- package/dist/room.d.ts +21 -3
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +203 -45
- package/dist/room.js.map +1 -1
- package/dist/types-BWsKf9LP.d.cts +93 -0
- package/dist/types-Ca3IVRvo.d.ts +93 -0
- package/dist/utils.cjs +51 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +7 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +25 -0
- package/dist/utils.js.map +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_frame.cjs +2 -0
- package/dist/video_frame.cjs.map +1 -1
- package/dist/video_frame.d.ts.map +1 -1
- package/dist/video_frame.js +2 -0
- package/dist/video_frame.js.map +1 -1
- package/package.json +9 -7
- package/src/data_streams/index.ts +7 -0
- package/src/data_streams/stream_reader.ts +166 -0
- package/src/data_streams/stream_writer.ts +36 -0
- package/src/data_streams/types.ts +61 -0
- package/src/index.ts +1 -0
- package/src/log.ts +25 -0
- package/src/napi/native.d.ts +5 -5
- package/src/participant.ts +351 -29
- package/src/proto/ffi_pb.ts +86 -1
- package/src/proto/room_pb.ts +788 -68
- package/src/proto/video_frame_pb.ts +3 -0
- package/src/room.ts +251 -68
- package/src/utils.ts +33 -0
- package/src/version.ts +1 -1
- package/src/video_frame.ts +2 -0
package/dist/index.cjs
CHANGED
|
@@ -15,9 +15,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
21
22
|
AudioFrame: () => import_audio_frame.AudioFrame,
|
|
22
23
|
AudioResampler: () => import_audio_resampler.AudioResampler,
|
|
23
24
|
AudioResamplerQuality: () => import_audio_resampler.AudioResamplerQuality,
|
|
@@ -63,7 +64,7 @@ __export(src_exports, {
|
|
|
63
64
|
combineAudioFrames: () => import_audio_frame.combineAudioFrames,
|
|
64
65
|
dispose: () => import_ffi_client.dispose
|
|
65
66
|
});
|
|
66
|
-
module.exports = __toCommonJS(
|
|
67
|
+
module.exports = __toCommonJS(index_exports);
|
|
67
68
|
var import_room = require("./room.cjs");
|
|
68
69
|
var import_participant = require("./participant.cjs");
|
|
69
70
|
var import_track = require("./track.cjs");
|
|
@@ -76,6 +77,7 @@ var import_audio_source = require("./audio_source.cjs");
|
|
|
76
77
|
var import_video_source = require("./video_source.cjs");
|
|
77
78
|
var import_track_publication = require("./track_publication.cjs");
|
|
78
79
|
var import_e2ee = require("./e2ee.cjs");
|
|
80
|
+
__reExport(index_exports, require("./data_streams/index.cjs"), module.exports);
|
|
79
81
|
var import_room_pb = require("./proto/room_pb.cjs");
|
|
80
82
|
var import_rpc = require("./rpc.cjs");
|
|
81
83
|
var import_e2ee_pb = require("./proto/e2ee_pb.cjs");
|
|
@@ -128,6 +130,7 @@ var import_ffi_client = require("./ffi_client.cjs");
|
|
|
128
130
|
VideoSource,
|
|
129
131
|
VideoStream,
|
|
130
132
|
combineAudioFrames,
|
|
131
|
-
dispose
|
|
133
|
+
dispose,
|
|
134
|
+
...require("./data_streams/index.cjs")
|
|
132
135
|
});
|
|
133
136
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';\nexport { Participant, RemoteParticipant, LocalParticipant } from './participant.js';\nexport {\n Track,\n type LocalTrack,\n type RemoteTrack,\n type VideoTrack,\n LocalAudioTrack,\n LocalVideoTrack,\n RemoteAudioTrack,\n RemoteVideoTrack,\n type AudioTrack,\n} from './track.js';\nexport { VideoFrame } from './video_frame.js';\nexport { AudioFrame, combineAudioFrames } from './audio_frame.js';\nexport { AudioStream } from './audio_stream.js';\nexport { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';\nexport { VideoStream, type VideoFrameEvent } from './video_stream.js';\nexport { AudioSource } from './audio_source.js';\nexport { VideoSource } from './video_source.js';\nexport {\n TrackPublication,\n RemoteTrackPublication,\n LocalTrackPublication,\n} from './track_publication.js';\nexport type { Transcription, TranscriptionSegment } from './transcription.js';\nexport { E2EEManager, KeyProvider, FrameCryptor } from './e2ee.js';\nexport type { E2EEOptions, KeyProviderOptions } from './e2ee.js';\nexport {\n ConnectionQuality,\n IceServer,\n IceTransportType,\n DataPacketKind,\n ContinualGatheringPolicy,\n TrackPublishOptions,\n ConnectionState,\n} from './proto/room_pb.js';\nexport { RpcError, type RpcInvocationData, type PerformRpcParams } from './rpc.js';\nexport { EncryptionType, EncryptionState } from './proto/e2ee_pb.js';\nexport { StreamState, TrackKind, TrackSource } from './proto/track_pb.js';\nexport { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_pb.js';\nexport { ParticipantKind } from './proto/participant_pb.js';\nexport { dispose } from './ffi_client.js';\nexport type { ChatMessage } from './types.js';\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';\nexport { Participant, RemoteParticipant, LocalParticipant } from './participant.js';\nexport {\n Track,\n type LocalTrack,\n type RemoteTrack,\n type VideoTrack,\n LocalAudioTrack,\n LocalVideoTrack,\n RemoteAudioTrack,\n RemoteVideoTrack,\n type AudioTrack,\n} from './track.js';\nexport { VideoFrame } from './video_frame.js';\nexport { AudioFrame, combineAudioFrames } from './audio_frame.js';\nexport { AudioStream } from './audio_stream.js';\nexport { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';\nexport { VideoStream, type VideoFrameEvent } from './video_stream.js';\nexport { AudioSource } from './audio_source.js';\nexport { VideoSource } from './video_source.js';\nexport {\n TrackPublication,\n RemoteTrackPublication,\n LocalTrackPublication,\n} from './track_publication.js';\nexport type { Transcription, TranscriptionSegment } from './transcription.js';\nexport { E2EEManager, KeyProvider, FrameCryptor } from './e2ee.js';\nexport type { E2EEOptions, KeyProviderOptions } from './e2ee.js';\nexport * from './data_streams/index.js';\nexport {\n ConnectionQuality,\n IceServer,\n IceTransportType,\n DataPacketKind,\n ContinualGatheringPolicy,\n TrackPublishOptions,\n ConnectionState,\n} from './proto/room_pb.js';\nexport { RpcError, type RpcInvocationData, type PerformRpcParams } from './rpc.js';\nexport { EncryptionType, EncryptionState } from './proto/e2ee_pb.js';\nexport { StreamState, TrackKind, TrackSource } from './proto/track_pb.js';\nexport { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_pb.js';\nexport { ParticipantKind } from './proto/participant_pb.js';\nexport { dispose } from './ffi_client.js';\nexport type { ChatMessage } from './types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAuF;AACvF,yBAAiE;AACjE,mBAUO;AACP,yBAA2B;AAC3B,yBAA+C;AAC/C,0BAA4B;AAC5B,6BAAsD;AACtD,0BAAkD;AAClD,0BAA4B;AAC5B,0BAA4B;AAC5B,+BAIO;AAEP,kBAAuD;AAEvD,0BAAc,oCAhCd;AAiCA,qBAQO;AACP,iBAAwE;AACxE,qBAAgD;AAChD,sBAAoD;AACpD,4BAA2D;AAC3D,4BAAgC;AAChC,wBAAwB;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,8 @@ export { VideoSource } from './video_source.cjs';
|
|
|
11
11
|
export { LocalTrackPublication, RemoteTrackPublication, TrackPublication } from './track_publication.cjs';
|
|
12
12
|
export { Transcription, TranscriptionSegment } from './transcription.cjs';
|
|
13
13
|
export { E2EEManager, E2EEOptions, FrameCryptor, KeyProvider, KeyProviderOptions } from './e2ee.cjs';
|
|
14
|
+
export { a as BaseStreamInfo, g as ByteStreamHandler, b as ByteStreamInfo, f as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, d as TextStreamChunk, h as TextStreamHandler, c as TextStreamInfo, e as TextStreamOptions, T as TextStreamReader } from './types-BWsKf9LP.cjs';
|
|
15
|
+
export { ByteStreamWriter, TextStreamWriter } from './data_streams/stream_writer.cjs';
|
|
14
16
|
export { ConnectionQuality, ConnectionState, ContinualGatheringPolicy, DataPacketKind, IceServer, IceTransportType, TrackPublishOptions } from './proto/room_pb.cjs';
|
|
15
17
|
export { PerformRpcParams, RpcError, RpcInvocationData } from './rpc.cjs';
|
|
16
18
|
export { EncryptionState, EncryptionType } from './proto/e2ee_pb.cjs';
|
|
@@ -20,9 +22,11 @@ export { ParticipantKind } from './proto/participant_pb.cjs';
|
|
|
20
22
|
export { livekitDispose as dispose } from './napi/native.d.cjs';
|
|
21
23
|
export { ChatMessage } from './types.cjs';
|
|
22
24
|
import '@livekit/typed-emitter';
|
|
25
|
+
import 'node:fs';
|
|
23
26
|
import './proto/audio_frame_pb.cjs';
|
|
24
27
|
import '@bufbuild/protobuf';
|
|
25
28
|
import './proto/handle_pb.cjs';
|
|
26
29
|
import '@livekit/mutex';
|
|
30
|
+
import 'node:stream/web';
|
|
27
31
|
import './proto/stats_pb.cjs';
|
|
28
32
|
import './proto/rpc_pb.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export { VideoSource } from './video_source.js';
|
|
|
11
11
|
export { LocalTrackPublication, RemoteTrackPublication, TrackPublication } from './track_publication.js';
|
|
12
12
|
export { Transcription, TranscriptionSegment } from './transcription.js';
|
|
13
13
|
export { E2EEManager, E2EEOptions, FrameCryptor, KeyProvider, KeyProviderOptions } from './e2ee.js';
|
|
14
|
+
export { a as BaseStreamInfo, g as ByteStreamHandler, b as ByteStreamInfo, f as ByteStreamOptions, B as ByteStreamReader, D as DataStreamOptions, S as StreamController, d as TextStreamChunk, h as TextStreamHandler, c as TextStreamInfo, e as TextStreamOptions, T as TextStreamReader } from './types-Ca3IVRvo.js';
|
|
15
|
+
export { ByteStreamWriter, TextStreamWriter } from './data_streams/stream_writer.js';
|
|
14
16
|
export { ConnectionQuality, ConnectionState, ContinualGatheringPolicy, DataPacketKind, IceServer, IceTransportType, TrackPublishOptions } from './proto/room_pb.js';
|
|
15
17
|
export { PerformRpcParams, RpcError, RpcInvocationData } from './rpc.js';
|
|
16
18
|
export { EncryptionState, EncryptionType } from './proto/e2ee_pb.js';
|
|
@@ -20,9 +22,11 @@ export { ParticipantKind } from './proto/participant_pb.js';
|
|
|
20
22
|
export { livekitDispose as dispose } from './napi/native.d.js';
|
|
21
23
|
export { ChatMessage } from './types.js';
|
|
22
24
|
import '@livekit/typed-emitter';
|
|
25
|
+
import 'node:fs';
|
|
23
26
|
import './proto/audio_frame_pb.js';
|
|
24
27
|
import '@bufbuild/protobuf';
|
|
25
28
|
import './proto/handle_pb.js';
|
|
26
29
|
import '@livekit/mutex';
|
|
30
|
+
import 'node:stream/web';
|
|
27
31
|
import './proto/stats_pb.js';
|
|
28
32
|
import './proto/rpc_pb.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,KAAK,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,KAAK,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';\nexport { Participant, RemoteParticipant, LocalParticipant } from './participant.js';\nexport {\n Track,\n type LocalTrack,\n type RemoteTrack,\n type VideoTrack,\n LocalAudioTrack,\n LocalVideoTrack,\n RemoteAudioTrack,\n RemoteVideoTrack,\n type AudioTrack,\n} from './track.js';\nexport { VideoFrame } from './video_frame.js';\nexport { AudioFrame, combineAudioFrames } from './audio_frame.js';\nexport { AudioStream } from './audio_stream.js';\nexport { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';\nexport { VideoStream, type VideoFrameEvent } from './video_stream.js';\nexport { AudioSource } from './audio_source.js';\nexport { VideoSource } from './video_source.js';\nexport {\n TrackPublication,\n RemoteTrackPublication,\n LocalTrackPublication,\n} from './track_publication.js';\nexport type { Transcription, TranscriptionSegment } from './transcription.js';\nexport { E2EEManager, KeyProvider, FrameCryptor } from './e2ee.js';\nexport type { E2EEOptions, KeyProviderOptions } from './e2ee.js';\nexport {\n ConnectionQuality,\n IceServer,\n IceTransportType,\n DataPacketKind,\n ContinualGatheringPolicy,\n TrackPublishOptions,\n ConnectionState,\n} from './proto/room_pb.js';\nexport { RpcError, type RpcInvocationData, type PerformRpcParams } from './rpc.js';\nexport { EncryptionType, EncryptionState } from './proto/e2ee_pb.js';\nexport { StreamState, TrackKind, TrackSource } from './proto/track_pb.js';\nexport { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_pb.js';\nexport { ParticipantKind } from './proto/participant_pb.js';\nexport { dispose } from './ffi_client.js';\nexport type { ChatMessage } from './types.js';\n"],"mappings":"AAIA,SAAS,MAAM,WAAW,oBAA6D;AACvF,SAAS,aAAa,mBAAmB,wBAAwB;AACjE;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,YAAY,0BAA0B;AAC/C,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,6BAA6B;AACtD,SAAS,mBAAyC;AAClD,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,aAAa,aAAa,oBAAoB;AAEvD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAA+D;AACxE,SAAS,gBAAgB,uBAAuB;AAChD,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,iBAAiB,eAAe,kBAAkB;AAC3D,SAAS,uBAAuB;AAChC,SAAS,eAAe;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\nexport { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';\nexport { Participant, RemoteParticipant, LocalParticipant } from './participant.js';\nexport {\n Track,\n type LocalTrack,\n type RemoteTrack,\n type VideoTrack,\n LocalAudioTrack,\n LocalVideoTrack,\n RemoteAudioTrack,\n RemoteVideoTrack,\n type AudioTrack,\n} from './track.js';\nexport { VideoFrame } from './video_frame.js';\nexport { AudioFrame, combineAudioFrames } from './audio_frame.js';\nexport { AudioStream } from './audio_stream.js';\nexport { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';\nexport { VideoStream, type VideoFrameEvent } from './video_stream.js';\nexport { AudioSource } from './audio_source.js';\nexport { VideoSource } from './video_source.js';\nexport {\n TrackPublication,\n RemoteTrackPublication,\n LocalTrackPublication,\n} from './track_publication.js';\nexport type { Transcription, TranscriptionSegment } from './transcription.js';\nexport { E2EEManager, KeyProvider, FrameCryptor } from './e2ee.js';\nexport type { E2EEOptions, KeyProviderOptions } from './e2ee.js';\nexport * from './data_streams/index.js';\nexport {\n ConnectionQuality,\n IceServer,\n IceTransportType,\n DataPacketKind,\n ContinualGatheringPolicy,\n TrackPublishOptions,\n ConnectionState,\n} from './proto/room_pb.js';\nexport { RpcError, type RpcInvocationData, type PerformRpcParams } from './rpc.js';\nexport { EncryptionType, EncryptionState } from './proto/e2ee_pb.js';\nexport { StreamState, TrackKind, TrackSource } from './proto/track_pb.js';\nexport { VideoBufferType, VideoRotation, VideoCodec } from './proto/video_frame_pb.js';\nexport { ParticipantKind } from './proto/participant_pb.js';\nexport { dispose } from './ffi_client.js';\nexport type { ChatMessage } from './types.js';\n"],"mappings":"AAIA,SAAS,MAAM,WAAW,oBAA6D;AACvF,SAAS,aAAa,mBAAmB,wBAAwB;AACjE;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,YAAY,0BAA0B;AAC/C,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB,6BAA6B;AACtD,SAAS,mBAAyC;AAClD,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,aAAa,aAAa,oBAAoB;AAEvD,cAAc;AACd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAA+D;AACxE,SAAS,gBAAgB,uBAAuB;AAChD,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,iBAAiB,eAAe,kBAAkB;AAC3D,SAAS,uBAAuB;AAChC,SAAS,eAAe;","names":[]}
|
package/dist/log.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var log_exports = {};
|
|
20
|
+
__export(log_exports, {
|
|
21
|
+
log: () => log
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(log_exports);
|
|
24
|
+
var import_pino = require("pino");
|
|
25
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
26
|
+
const defaultOptions = { name: "lk-rtc" };
|
|
27
|
+
const devOptions = {
|
|
28
|
+
...defaultOptions,
|
|
29
|
+
transport: {
|
|
30
|
+
target: "pino-pretty",
|
|
31
|
+
options: {
|
|
32
|
+
colorize: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const log = (0, import_pino.pino)(isProduction ? defaultOptions : devOptions);
|
|
37
|
+
log.level = isProduction ? "info" : "debug";
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
log
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=log.cjs.map
|
package/dist/log.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { LevelWithSilent, LoggerOptions } from 'pino';\nimport { pino } from 'pino';\n\nconst isProduction = process.env.NODE_ENV === 'production';\n\nconst defaultOptions: LoggerOptions = { name: 'lk-rtc' };\n\nconst devOptions: LoggerOptions = {\n ...defaultOptions,\n transport: {\n target: 'pino-pretty',\n options: {\n colorize: true,\n },\n },\n};\n\nconst log = pino(isProduction ? defaultOptions : devOptions);\nlog.level = isProduction ? 'info' : 'debug';\n\nexport type LogLevel = LevelWithSilent;\nexport { log };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAqB;AAErB,MAAM,eAAe,QAAQ,IAAI,aAAa;AAE9C,MAAM,iBAAgC,EAAE,MAAM,SAAS;AAEvD,MAAM,aAA4B;AAAA,EAChC,GAAG;AAAA,EACH,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,MAAM,UAAM,kBAAK,eAAe,iBAAiB,UAAU;AAC3D,IAAI,QAAQ,eAAe,SAAS;","names":[]}
|
package/dist/log.d.cts
ADDED
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,MAAM,CAAC;AAiB3D,QAAA,MAAM,GAAG,uCAAmD,CAAC;AAG7D,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { pino } from "pino";
|
|
2
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
3
|
+
const defaultOptions = { name: "lk-rtc" };
|
|
4
|
+
const devOptions = {
|
|
5
|
+
...defaultOptions,
|
|
6
|
+
transport: {
|
|
7
|
+
target: "pino-pretty",
|
|
8
|
+
options: {
|
|
9
|
+
colorize: true
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const log = pino(isProduction ? defaultOptions : devOptions);
|
|
14
|
+
log.level = isProduction ? "info" : "debug";
|
|
15
|
+
export {
|
|
16
|
+
log
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/log.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { LevelWithSilent, LoggerOptions } from 'pino';\nimport { pino } from 'pino';\n\nconst isProduction = process.env.NODE_ENV === 'production';\n\nconst defaultOptions: LoggerOptions = { name: 'lk-rtc' };\n\nconst devOptions: LoggerOptions = {\n ...defaultOptions,\n transport: {\n target: 'pino-pretty',\n options: {\n colorize: true,\n },\n },\n};\n\nconst log = pino(isProduction ? defaultOptions : devOptions);\nlog.level = isProduction ? 'info' : 'debug';\n\nexport type LogLevel = LevelWithSilent;\nexport { log };\n"],"mappings":"AAIA,SAAS,YAAY;AAErB,MAAM,eAAe,QAAQ,IAAI,aAAa;AAE9C,MAAM,iBAAgC,EAAE,MAAM,SAAS;AAEvD,MAAM,aAA4B;AAAA,EAChC,GAAG;AAAA,EACH,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,MAAM,MAAM,KAAK,eAAe,iBAAiB,UAAU;AAC3D,IAAI,QAAQ,eAAe,SAAS;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/napi/native.d.ts"],"sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n\n/* auto-generated by NAPI-RS */\n\nexport function livekitInitialize(\n callback: (data: Uint8Array) => void,\n captureLogs: boolean,\n sdkVersion: string,\n): void;\nexport function livekitFfiRequest(data: Uint8Array): Uint8Array;\nexport function livekitRetrievePtr(handle: Uint8Array): bigint;\nexport function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;\nexport function livekitDispose(): Promise<void>;\nexport declare class FfiHandle {\n constructor(handle: bigint);\n dispose(): void;\n get handle(): bigint;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/napi/native.d.ts"],"sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n\n/* auto-generated by NAPI-RS */\n\nexport declare function livekitInitialize(\n callback: (data: Uint8Array) => void,\n captureLogs: boolean,\n sdkVersion: string,\n): void;\nexport declare function livekitFfiRequest(data: Uint8Array): Uint8Array;\nexport declare function livekitRetrievePtr(handle: Uint8Array): bigint;\nexport declare function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;\nexport declare function livekitDispose(): Promise<void>;\nexport declare class FfiHandle {\n constructor(handle: bigint);\n dispose(): void;\n get handle(): bigint;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/napi/native.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
export function livekitInitialize(
|
|
6
|
+
export declare function livekitInitialize(
|
|
7
7
|
callback: (data: Uint8Array) => void,
|
|
8
8
|
captureLogs: boolean,
|
|
9
9
|
sdkVersion: string,
|
|
10
10
|
): void;
|
|
11
|
-
export function livekitFfiRequest(data: Uint8Array): Uint8Array;
|
|
12
|
-
export function livekitRetrievePtr(handle: Uint8Array): bigint;
|
|
13
|
-
export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
14
|
-
export function livekitDispose(): Promise<void>;
|
|
11
|
+
export declare function livekitFfiRequest(data: Uint8Array): Uint8Array;
|
|
12
|
+
export declare function livekitRetrievePtr(handle: Uint8Array): bigint;
|
|
13
|
+
export declare function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
14
|
+
export declare function livekitDispose(): Promise<void>;
|
|
15
15
|
export declare class FfiHandle {
|
|
16
16
|
constructor(handle: bigint);
|
|
17
17
|
dispose(): void;
|
package/dist/native.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
export function livekitInitialize(
|
|
6
|
+
export declare function livekitInitialize(
|
|
7
7
|
callback: (data: Uint8Array) => void,
|
|
8
8
|
captureLogs: boolean,
|
|
9
9
|
sdkVersion: string,
|
|
10
10
|
): void;
|
|
11
|
-
export function livekitFfiRequest(data: Uint8Array): Uint8Array;
|
|
12
|
-
export function livekitRetrievePtr(handle: Uint8Array): bigint;
|
|
13
|
-
export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
14
|
-
export function livekitDispose(): Promise<void>;
|
|
11
|
+
export declare function livekitFfiRequest(data: Uint8Array): Uint8Array;
|
|
12
|
+
export declare function livekitRetrievePtr(handle: Uint8Array): bigint;
|
|
13
|
+
export declare function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
|
|
14
|
+
export declare function livekitDispose(): Promise<void>;
|
|
15
15
|
export declare class FfiHandle {
|
|
16
16
|
constructor(handle: bigint);
|
|
17
17
|
dispose(): void;
|
package/dist/participant.cjs
CHANGED
|
@@ -23,13 +23,20 @@ __export(participant_exports, {
|
|
|
23
23
|
RemoteParticipant: () => RemoteParticipant
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(participant_exports);
|
|
26
|
+
var import_mutex = require("@livekit/mutex");
|
|
27
|
+
var import_promises = require("node:fs/promises");
|
|
28
|
+
var import_data_streams = require("./data_streams/index.cjs");
|
|
26
29
|
var import_ffi_client = require("./ffi_client.cjs");
|
|
30
|
+
var import_log = require("./log.cjs");
|
|
27
31
|
var import_participant_pb = require("./proto/participant_pb.cjs");
|
|
28
32
|
var import_room_pb = require("./proto/room_pb.cjs");
|
|
29
33
|
var import_room_pb2 = require("./proto/room_pb.cjs");
|
|
34
|
+
var import_room_pb3 = require("./proto/room_pb.cjs");
|
|
30
35
|
var import_rpc_pb = require("./proto/rpc_pb.cjs");
|
|
31
36
|
var import_rpc = require("./rpc.cjs");
|
|
32
37
|
var import_track_publication = require("./track_publication.cjs");
|
|
38
|
+
var import_utils = require("./utils.cjs");
|
|
39
|
+
const STREAM_CHUNK_SIZE = 15e3;
|
|
33
40
|
class Participant {
|
|
34
41
|
constructor(owned_info) {
|
|
35
42
|
this.trackPublications = /* @__PURE__ */ new Map();
|
|
@@ -43,16 +50,16 @@ class Participant {
|
|
|
43
50
|
return this.info.name;
|
|
44
51
|
}
|
|
45
52
|
get identity() {
|
|
46
|
-
return this.info.identity;
|
|
53
|
+
return this.info.identity ?? "";
|
|
47
54
|
}
|
|
48
55
|
get metadata() {
|
|
49
|
-
return this.info.metadata;
|
|
56
|
+
return this.info.metadata ?? "";
|
|
50
57
|
}
|
|
51
58
|
get attributes() {
|
|
52
|
-
return this.info.attributes;
|
|
59
|
+
return this.info.attributes ?? {};
|
|
53
60
|
}
|
|
54
61
|
get kind() {
|
|
55
|
-
return this.info.kind;
|
|
62
|
+
return this.info.kind ?? import_participant_pb.ParticipantKind.STANDARD;
|
|
56
63
|
}
|
|
57
64
|
get disconnectReason() {
|
|
58
65
|
if (this.info.disconnectReason === import_participant_pb.DisconnectReason.UNKNOWN_REASON) {
|
|
@@ -68,7 +75,7 @@ class LocalParticipant extends Participant {
|
|
|
68
75
|
this.trackPublications = /* @__PURE__ */ new Map();
|
|
69
76
|
}
|
|
70
77
|
async publishData(data, options) {
|
|
71
|
-
const req = new
|
|
78
|
+
const req = new import_room_pb3.PublishDataRequest({
|
|
72
79
|
localParticipantHandle: this.ffi_handle.handle,
|
|
73
80
|
dataPtr: import_ffi_client.FfiClient.instance.retrievePtr(data),
|
|
74
81
|
dataLen: BigInt(data.byteLength),
|
|
@@ -87,7 +94,7 @@ class LocalParticipant extends Participant {
|
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
async publishDtmf(code, digit) {
|
|
90
|
-
const req = new
|
|
97
|
+
const req = new import_room_pb3.PublishSipDtmfRequest({
|
|
91
98
|
localParticipantHandle: this.ffi_handle.handle,
|
|
92
99
|
code,
|
|
93
100
|
digit
|
|
@@ -103,11 +110,11 @@ class LocalParticipant extends Participant {
|
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
async publishTranscription(transcription) {
|
|
106
|
-
const req = new
|
|
113
|
+
const req = new import_room_pb3.PublishTranscriptionRequest({
|
|
107
114
|
localParticipantHandle: this.ffi_handle.handle,
|
|
108
115
|
participantIdentity: transcription.participantIdentity,
|
|
109
116
|
segments: transcription.segments.map(
|
|
110
|
-
(s) => new
|
|
117
|
+
(s) => new import_room_pb3.TranscriptionSegment({
|
|
111
118
|
id: s.id,
|
|
112
119
|
text: s.text,
|
|
113
120
|
startTime: s.startTime,
|
|
@@ -129,7 +136,7 @@ class LocalParticipant extends Participant {
|
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
async updateMetadata(metadata) {
|
|
132
|
-
const req = new
|
|
139
|
+
const req = new import_room_pb3.SetLocalMetadataRequest({
|
|
133
140
|
localParticipantHandle: this.ffi_handle.handle,
|
|
134
141
|
metadata
|
|
135
142
|
});
|
|
@@ -140,6 +147,243 @@ class LocalParticipant extends Participant {
|
|
|
140
147
|
return ev.message.case == "setLocalMetadata" && ev.message.value.asyncId == res.asyncId;
|
|
141
148
|
});
|
|
142
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns a `StreamWriter` instance that allows to write individual chunks of text to a stream.
|
|
152
|
+
* Well suited for TTS and/or streaming LLM output. If you want to simply send a text then use sendText() instead
|
|
153
|
+
*/
|
|
154
|
+
async streamText(options) {
|
|
155
|
+
const senderIdentity = this.identity;
|
|
156
|
+
const streamId = (options == null ? void 0 : options.streamId) ?? crypto.randomUUID();
|
|
157
|
+
const destinationIdentities = options == null ? void 0 : options.destinationIdentities;
|
|
158
|
+
const info = {
|
|
159
|
+
streamId,
|
|
160
|
+
mimeType: "text/plain",
|
|
161
|
+
topic: (options == null ? void 0 : options.topic) ?? "",
|
|
162
|
+
timestamp: Date.now()
|
|
163
|
+
};
|
|
164
|
+
const headerReq = new import_room_pb.SendStreamHeaderRequest({
|
|
165
|
+
senderIdentity,
|
|
166
|
+
destinationIdentities,
|
|
167
|
+
localParticipantHandle: this.ffi_handle.handle,
|
|
168
|
+
header: new import_room_pb.DataStream_Header({
|
|
169
|
+
streamId,
|
|
170
|
+
mimeType: info.mimeType,
|
|
171
|
+
topic: info.topic,
|
|
172
|
+
timestamp: (0, import_utils.numberToBigInt)(info.timestamp),
|
|
173
|
+
attributes: options == null ? void 0 : options.attributes,
|
|
174
|
+
contentHeader: {
|
|
175
|
+
case: "textHeader",
|
|
176
|
+
value: new import_room_pb.DataStream_TextHeader({
|
|
177
|
+
operationType: import_room_pb.DataStream_OperationType.CREATE,
|
|
178
|
+
version: 0,
|
|
179
|
+
replyToStreamId: "",
|
|
180
|
+
generated: false
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
await this.sendStreamHeader(headerReq);
|
|
186
|
+
let chunkId = 0;
|
|
187
|
+
const localHandle = this.ffi_handle.handle;
|
|
188
|
+
const sendTrailer = this.sendStreamTrailer;
|
|
189
|
+
const sendChunk = this.sendStreamChunk;
|
|
190
|
+
const writableStream = new WritableStream({
|
|
191
|
+
// Implement the sink
|
|
192
|
+
write([textChunk, overrideChunkId]) {
|
|
193
|
+
var _a;
|
|
194
|
+
const textInBytes = new TextEncoder().encode(textChunk);
|
|
195
|
+
if (textInBytes.byteLength > STREAM_CHUNK_SIZE) {
|
|
196
|
+
(_a = this.abort) == null ? void 0 : _a.call(this);
|
|
197
|
+
throw new Error("chunk size too large");
|
|
198
|
+
}
|
|
199
|
+
return new Promise(async (resolve) => {
|
|
200
|
+
const chunkRequest = new import_room_pb.SendStreamChunkRequest({
|
|
201
|
+
senderIdentity,
|
|
202
|
+
localParticipantHandle: localHandle,
|
|
203
|
+
destinationIdentities,
|
|
204
|
+
chunk: new import_room_pb.DataStream_Chunk({
|
|
205
|
+
content: textInBytes,
|
|
206
|
+
streamId,
|
|
207
|
+
chunkIndex: (0, import_utils.numberToBigInt)(overrideChunkId ?? chunkId)
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
await sendChunk(chunkRequest);
|
|
211
|
+
if (!overrideChunkId) {
|
|
212
|
+
chunkId += 1;
|
|
213
|
+
resolve();
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
async close() {
|
|
218
|
+
const trailerReq = new import_room_pb.SendStreamTrailerRequest({
|
|
219
|
+
senderIdentity,
|
|
220
|
+
localParticipantHandle: localHandle,
|
|
221
|
+
destinationIdentities,
|
|
222
|
+
trailer: new import_room_pb.DataStream_Trailer({
|
|
223
|
+
streamId,
|
|
224
|
+
reason: ""
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
await sendTrailer(trailerReq);
|
|
228
|
+
},
|
|
229
|
+
abort(err) {
|
|
230
|
+
import_log.log.error("Sink error:", err);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
const writer = new import_data_streams.TextStreamWriter(writableStream, info);
|
|
234
|
+
return writer;
|
|
235
|
+
}
|
|
236
|
+
async sendText(text, options) {
|
|
237
|
+
const writer = await this.streamText(options);
|
|
238
|
+
for (const chunk in (0, import_utils.splitUtf8)(text, STREAM_CHUNK_SIZE)) {
|
|
239
|
+
await writer.write(chunk);
|
|
240
|
+
}
|
|
241
|
+
await writer.close();
|
|
242
|
+
return writer.info;
|
|
243
|
+
}
|
|
244
|
+
async streamBytes(options) {
|
|
245
|
+
const senderIdentity = this.identity;
|
|
246
|
+
const streamId = (options == null ? void 0 : options.streamId) ?? crypto.randomUUID();
|
|
247
|
+
const destinationIdentities = options == null ? void 0 : options.destinationIdentities;
|
|
248
|
+
const info = {
|
|
249
|
+
streamId,
|
|
250
|
+
mimeType: (options == null ? void 0 : options.mimeType) ?? "application/octet-stream",
|
|
251
|
+
topic: (options == null ? void 0 : options.topic) ?? "",
|
|
252
|
+
timestamp: Date.now(),
|
|
253
|
+
attributes: options == null ? void 0 : options.attributes,
|
|
254
|
+
totalSize: options == null ? void 0 : options.totalSize,
|
|
255
|
+
name: (options == null ? void 0 : options.name) ?? "unknown"
|
|
256
|
+
};
|
|
257
|
+
const headerReq = new import_room_pb.SendStreamHeaderRequest({
|
|
258
|
+
senderIdentity,
|
|
259
|
+
destinationIdentities,
|
|
260
|
+
localParticipantHandle: this.ffi_handle.handle,
|
|
261
|
+
header: new import_room_pb.DataStream_Header({
|
|
262
|
+
streamId,
|
|
263
|
+
mimeType: info.mimeType,
|
|
264
|
+
topic: info.topic,
|
|
265
|
+
timestamp: (0, import_utils.numberToBigInt)(info.timestamp),
|
|
266
|
+
attributes: info.attributes,
|
|
267
|
+
totalLength: (0, import_utils.numberToBigInt)(info.totalSize),
|
|
268
|
+
contentHeader: {
|
|
269
|
+
case: "byteHeader",
|
|
270
|
+
value: new import_room_pb.DataStream_ByteHeader({
|
|
271
|
+
name: info.name
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
await this.sendStreamHeader(headerReq);
|
|
277
|
+
let chunkId = 0;
|
|
278
|
+
const localHandle = this.ffi_handle.handle;
|
|
279
|
+
const sendTrailer = this.sendStreamTrailer;
|
|
280
|
+
const sendChunk = this.sendStreamChunk;
|
|
281
|
+
const writeMutex = new import_mutex.Mutex();
|
|
282
|
+
const writableStream = new WritableStream({
|
|
283
|
+
async write([chunk]) {
|
|
284
|
+
const unlock = await writeMutex.lock();
|
|
285
|
+
let byteOffset = 0;
|
|
286
|
+
try {
|
|
287
|
+
while (byteOffset < chunk.byteLength) {
|
|
288
|
+
const subChunk = chunk.slice(byteOffset, byteOffset + STREAM_CHUNK_SIZE);
|
|
289
|
+
const chunkRequest = new import_room_pb.SendStreamChunkRequest({
|
|
290
|
+
senderIdentity,
|
|
291
|
+
localParticipantHandle: localHandle,
|
|
292
|
+
destinationIdentities,
|
|
293
|
+
chunk: new import_room_pb.DataStream_Chunk({
|
|
294
|
+
content: subChunk,
|
|
295
|
+
streamId,
|
|
296
|
+
chunkIndex: (0, import_utils.numberToBigInt)(chunkId)
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
await sendChunk(chunkRequest);
|
|
300
|
+
chunkId += 1;
|
|
301
|
+
byteOffset += subChunk.byteLength;
|
|
302
|
+
}
|
|
303
|
+
} finally {
|
|
304
|
+
unlock();
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
async close() {
|
|
308
|
+
const trailerReq = new import_room_pb.SendStreamTrailerRequest({
|
|
309
|
+
senderIdentity,
|
|
310
|
+
localParticipantHandle: localHandle,
|
|
311
|
+
destinationIdentities,
|
|
312
|
+
trailer: new import_room_pb.DataStream_Trailer({
|
|
313
|
+
streamId,
|
|
314
|
+
reason: ""
|
|
315
|
+
})
|
|
316
|
+
});
|
|
317
|
+
await sendTrailer(trailerReq);
|
|
318
|
+
},
|
|
319
|
+
abort(err) {
|
|
320
|
+
import_log.log.error("Sink error:", err);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
const byteWriter = new import_data_streams.ByteStreamWriter(writableStream, info);
|
|
324
|
+
return byteWriter;
|
|
325
|
+
}
|
|
326
|
+
/** Sends a file provided as PathLike to specified recipients */
|
|
327
|
+
async sendFile(path, options) {
|
|
328
|
+
const fileStats = await (0, import_promises.stat)(path);
|
|
329
|
+
const file = await (0, import_promises.open)(path);
|
|
330
|
+
try {
|
|
331
|
+
const stream = file.readableWebStream({ type: "bytes" });
|
|
332
|
+
const streamId = crypto.randomUUID();
|
|
333
|
+
const destinationIdentities = options == null ? void 0 : options.destinationIdentities;
|
|
334
|
+
const writer = await this.streamBytes({
|
|
335
|
+
streamId,
|
|
336
|
+
name: options == null ? void 0 : options.name,
|
|
337
|
+
totalSize: fileStats.size,
|
|
338
|
+
destinationIdentities,
|
|
339
|
+
topic: options == null ? void 0 : options.topic,
|
|
340
|
+
mimeType: options == null ? void 0 : options.mimeType,
|
|
341
|
+
attributes: options == null ? void 0 : options.attributes
|
|
342
|
+
});
|
|
343
|
+
for await (const chunk of stream) {
|
|
344
|
+
await writer.write(chunk);
|
|
345
|
+
}
|
|
346
|
+
await writer.close();
|
|
347
|
+
} finally {
|
|
348
|
+
await file.close();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
async sendStreamHeader(req) {
|
|
352
|
+
const type = "sendStreamHeader";
|
|
353
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
354
|
+
message: { case: type, value: req }
|
|
355
|
+
});
|
|
356
|
+
const cb = await import_ffi_client.FfiClient.instance.waitFor((ev) => {
|
|
357
|
+
return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
|
|
358
|
+
});
|
|
359
|
+
if (cb.error) {
|
|
360
|
+
throw new Error(cb.error);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
async sendStreamChunk(req) {
|
|
364
|
+
const type = "sendStreamChunk";
|
|
365
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
366
|
+
message: { case: type, value: req }
|
|
367
|
+
});
|
|
368
|
+
const cb = await import_ffi_client.FfiClient.instance.waitFor((ev) => {
|
|
369
|
+
return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
|
|
370
|
+
});
|
|
371
|
+
if (cb.error) {
|
|
372
|
+
throw new Error(cb.error);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async sendStreamTrailer(req) {
|
|
376
|
+
const type = "sendStreamTrailer";
|
|
377
|
+
const res = import_ffi_client.FfiClient.instance.request({
|
|
378
|
+
message: { case: type, value: req }
|
|
379
|
+
});
|
|
380
|
+
const cb = await import_ffi_client.FfiClient.instance.waitFor((ev) => {
|
|
381
|
+
return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
|
|
382
|
+
});
|
|
383
|
+
if (cb.error) {
|
|
384
|
+
throw new Error(cb.error);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
143
387
|
/**
|
|
144
388
|
* Sends a chat message to participants in the room
|
|
145
389
|
*
|
|
@@ -149,7 +393,7 @@ class LocalParticipant extends Participant {
|
|
|
149
393
|
*
|
|
150
394
|
*/
|
|
151
395
|
async sendChatMessage(text, destinationIdentities, senderIdentity) {
|
|
152
|
-
const req = new
|
|
396
|
+
const req = new import_room_pb3.SendChatMessageRequest({
|
|
153
397
|
localParticipantHandle: this.ffi_handle.handle,
|
|
154
398
|
message: text,
|
|
155
399
|
destinationIdentities,
|
|
@@ -179,10 +423,10 @@ class LocalParticipant extends Participant {
|
|
|
179
423
|
* @experimental
|
|
180
424
|
*/
|
|
181
425
|
async editChatMessage(editText, originalMessage, destinationIdentities, senderIdentity) {
|
|
182
|
-
const req = new
|
|
426
|
+
const req = new import_room_pb3.EditChatMessageRequest({
|
|
183
427
|
localParticipantHandle: this.ffi_handle.handle,
|
|
184
428
|
editText,
|
|
185
|
-
originalMessage: new
|
|
429
|
+
originalMessage: new import_room_pb2.ChatMessage({
|
|
186
430
|
...originalMessage,
|
|
187
431
|
timestamp: BigInt(originalMessage.timestamp),
|
|
188
432
|
editTimestamp: originalMessage.editTimestamp ? BigInt(originalMessage.editTimestamp) : void 0
|
|
@@ -211,7 +455,7 @@ class LocalParticipant extends Participant {
|
|
|
211
455
|
}
|
|
212
456
|
}
|
|
213
457
|
async updateName(name) {
|
|
214
|
-
const req = new
|
|
458
|
+
const req = new import_room_pb3.SetLocalNameRequest({
|
|
215
459
|
localParticipantHandle: this.ffi_handle.handle,
|
|
216
460
|
name
|
|
217
461
|
});
|
|
@@ -223,7 +467,7 @@ class LocalParticipant extends Participant {
|
|
|
223
467
|
});
|
|
224
468
|
}
|
|
225
469
|
async setAttributes(attributes) {
|
|
226
|
-
const req = new
|
|
470
|
+
const req = new import_room_pb3.SetLocalAttributesRequest({
|
|
227
471
|
localParticipantHandle: this.ffi_handle.handle,
|
|
228
472
|
attributes: Object.entries(attributes).map(([key, value]) => ({ key, value }))
|
|
229
473
|
});
|
|
@@ -235,7 +479,7 @@ class LocalParticipant extends Participant {
|
|
|
235
479
|
});
|
|
236
480
|
}
|
|
237
481
|
async publishTrack(track, options) {
|
|
238
|
-
const req = new
|
|
482
|
+
const req = new import_room_pb3.PublishTrackRequest({
|
|
239
483
|
localParticipantHandle: this.ffi_handle.handle,
|
|
240
484
|
trackHandle: track.ffi_handle.handle,
|
|
241
485
|
options
|
|
@@ -258,7 +502,7 @@ class LocalParticipant extends Participant {
|
|
|
258
502
|
}
|
|
259
503
|
}
|
|
260
504
|
async unpublishTrack(trackSid, stopOnUnpublish) {
|
|
261
|
-
const req = new
|
|
505
|
+
const req = new import_room_pb3.UnpublishTrackRequest({
|
|
262
506
|
localParticipantHandle: this.ffi_handle.handle,
|
|
263
507
|
trackSid,
|
|
264
508
|
stopOnUnpublish: stopOnUnpublish ?? true
|