@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.
Files changed (114) hide show
  1. package/dist/data_streams/index.cjs +25 -0
  2. package/dist/data_streams/index.cjs.map +1 -0
  3. package/dist/data_streams/index.d.cts +11 -0
  4. package/dist/data_streams/index.d.ts +11 -0
  5. package/dist/data_streams/index.d.ts.map +1 -0
  6. package/dist/data_streams/index.js +3 -0
  7. package/dist/data_streams/index.js.map +1 -0
  8. package/dist/data_streams/stream_reader.cjs +145 -0
  9. package/dist/data_streams/stream_reader.cjs.map +1 -0
  10. package/dist/data_streams/stream_reader.d.cts +10 -0
  11. package/dist/data_streams/stream_reader.d.ts +10 -0
  12. package/dist/data_streams/stream_reader.d.ts.map +1 -0
  13. package/dist/data_streams/stream_reader.js +120 -0
  14. package/dist/data_streams/stream_reader.js.map +1 -0
  15. package/dist/data_streams/stream_writer.cjs +51 -0
  16. package/dist/data_streams/stream_writer.cjs.map +1 -0
  17. package/dist/data_streams/stream_writer.d.cts +26 -0
  18. package/dist/data_streams/stream_writer.d.ts +26 -0
  19. package/dist/data_streams/stream_writer.d.ts.map +1 -0
  20. package/dist/data_streams/stream_writer.js +26 -0
  21. package/dist/data_streams/stream_writer.js.map +1 -0
  22. package/dist/data_streams/types.cjs +17 -0
  23. package/dist/data_streams/types.cjs.map +1 -0
  24. package/dist/data_streams/types.d.cts +10 -0
  25. package/dist/data_streams/types.d.ts +10 -0
  26. package/dist/data_streams/types.d.ts.map +1 -0
  27. package/dist/data_streams/types.js +1 -0
  28. package/dist/data_streams/types.js.map +1 -0
  29. package/dist/index.cjs +7 -4
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +4 -0
  32. package/dist/index.d.ts +4 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/log.cjs +42 -0
  37. package/dist/log.cjs.map +1 -0
  38. package/dist/log.d.cts +7 -0
  39. package/dist/log.d.ts +7 -0
  40. package/dist/log.d.ts.map +1 -0
  41. package/dist/log.js +18 -0
  42. package/dist/log.js.map +1 -0
  43. package/dist/napi/native.d.cjs.map +1 -1
  44. package/dist/napi/native.d.ts +5 -5
  45. package/dist/native.d.ts +5 -5
  46. package/dist/participant.cjs +260 -16
  47. package/dist/participant.cjs.map +1 -1
  48. package/dist/participant.d.cts +40 -6
  49. package/dist/participant.d.ts +40 -6
  50. package/dist/participant.d.ts.map +1 -1
  51. package/dist/participant.js +263 -5
  52. package/dist/participant.js.map +1 -1
  53. package/dist/proto/ffi_pb.cjs +14 -3
  54. package/dist/proto/ffi_pb.cjs.map +1 -1
  55. package/dist/proto/ffi_pb.d.cts +81 -7
  56. package/dist/proto/ffi_pb.d.ts +81 -7
  57. package/dist/proto/ffi_pb.d.ts.map +1 -1
  58. package/dist/proto/ffi_pb.js +15 -4
  59. package/dist/proto/ffi_pb.js.map +1 -1
  60. package/dist/proto/room_pb.cjs +488 -30
  61. package/dist/proto/room_pb.cjs.map +1 -1
  62. package/dist/proto/room_pb.d.cts +412 -50
  63. package/dist/proto/room_pb.d.ts +412 -50
  64. package/dist/proto/room_pb.d.ts.map +1 -1
  65. package/dist/proto/room_pb.js +471 -29
  66. package/dist/proto/room_pb.js.map +1 -1
  67. package/dist/proto/video_frame_pb.cjs.map +1 -1
  68. package/dist/proto/video_frame_pb.d.cts +3 -0
  69. package/dist/proto/video_frame_pb.d.ts +3 -0
  70. package/dist/proto/video_frame_pb.d.ts.map +1 -1
  71. package/dist/proto/video_frame_pb.js.map +1 -1
  72. package/dist/room.cjs +202 -45
  73. package/dist/room.cjs.map +1 -1
  74. package/dist/room.d.cts +21 -3
  75. package/dist/room.d.ts +21 -3
  76. package/dist/room.d.ts.map +1 -1
  77. package/dist/room.js +203 -45
  78. package/dist/room.js.map +1 -1
  79. package/dist/types-BWsKf9LP.d.cts +93 -0
  80. package/dist/types-Ca3IVRvo.d.ts +93 -0
  81. package/dist/utils.cjs +51 -0
  82. package/dist/utils.cjs.map +1 -0
  83. package/dist/utils.d.cts +7 -0
  84. package/dist/utils.d.ts +7 -0
  85. package/dist/utils.d.ts.map +1 -0
  86. package/dist/utils.js +25 -0
  87. package/dist/utils.js.map +1 -0
  88. package/dist/version.cjs +1 -1
  89. package/dist/version.cjs.map +1 -1
  90. package/dist/version.d.cts +1 -1
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.js +1 -1
  93. package/dist/version.js.map +1 -1
  94. package/dist/video_frame.cjs +2 -0
  95. package/dist/video_frame.cjs.map +1 -1
  96. package/dist/video_frame.d.ts.map +1 -1
  97. package/dist/video_frame.js +2 -0
  98. package/dist/video_frame.js.map +1 -1
  99. package/package.json +9 -7
  100. package/src/data_streams/index.ts +7 -0
  101. package/src/data_streams/stream_reader.ts +166 -0
  102. package/src/data_streams/stream_writer.ts +36 -0
  103. package/src/data_streams/types.ts +61 -0
  104. package/src/index.ts +1 -0
  105. package/src/log.ts +25 -0
  106. package/src/napi/native.d.ts +5 -5
  107. package/src/participant.ts +351 -29
  108. package/src/proto/ffi_pb.ts +86 -1
  109. package/src/proto/room_pb.ts +788 -68
  110. package/src/proto/video_frame_pb.ts +3 -0
  111. package/src/room.ts +251 -68
  112. package/src/utils.ts +33 -0
  113. package/src/version.ts +1 -1
  114. package/src/video_frame.ts +2 -0
@@ -1,33 +1,59 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
+ import { Mutex } from '@livekit/mutex';
5
+ import type { PathLike } from 'node:fs';
6
+ import { open, stat } from 'node:fs/promises';
7
+ import {
8
+ type ByteStreamInfo,
9
+ type ByteStreamOptions,
10
+ ByteStreamWriter,
11
+ type TextStreamInfo,
12
+ TextStreamWriter,
13
+ } from './data_streams/index.js';
4
14
  import { FfiClient, FfiHandle } from './ffi_client.js';
15
+ import { log } from './log.js';
5
16
  import {
6
17
  DisconnectReason,
7
18
  type OwnedParticipant,
8
19
  type ParticipantInfo,
9
- type ParticipantKind,
20
+ ParticipantKind,
10
21
  } from './proto/participant_pb.js';
11
- import type {
12
- PublishDataCallback,
13
- PublishDataResponse,
14
- PublishSipDtmfCallback,
15
- PublishSipDtmfResponse,
16
- PublishTrackCallback,
17
- PublishTrackResponse,
18
- PublishTranscriptionCallback,
19
- PublishTranscriptionResponse,
20
- SendChatMessageCallback,
21
- SendChatMessageResponse,
22
- SetLocalAttributesCallback,
23
- SetLocalAttributesResponse,
24
- SetLocalMetadataCallback,
25
- SetLocalMetadataResponse,
26
- SetLocalNameCallback,
27
- SetLocalNameResponse,
28
- TrackPublishOptions,
29
- UnpublishTrackCallback,
30
- UnpublishTrackResponse,
22
+ import {
23
+ DataStream_ByteHeader,
24
+ DataStream_Chunk,
25
+ DataStream_Header,
26
+ DataStream_OperationType,
27
+ DataStream_TextHeader,
28
+ DataStream_Trailer,
29
+ type PublishDataCallback,
30
+ type PublishDataResponse,
31
+ type PublishSipDtmfCallback,
32
+ type PublishSipDtmfResponse,
33
+ type PublishTrackCallback,
34
+ type PublishTrackResponse,
35
+ type PublishTranscriptionCallback,
36
+ type PublishTranscriptionResponse,
37
+ type SendChatMessageCallback,
38
+ type SendChatMessageResponse,
39
+ type SendStreamChunkCallback,
40
+ SendStreamChunkRequest,
41
+ type SendStreamChunkResponse,
42
+ type SendStreamHeaderCallback,
43
+ SendStreamHeaderRequest,
44
+ type SendStreamHeaderResponse,
45
+ type SendStreamTrailerCallback,
46
+ SendStreamTrailerRequest,
47
+ type SendStreamTrailerResponse,
48
+ type SetLocalAttributesCallback,
49
+ type SetLocalAttributesResponse,
50
+ type SetLocalMetadataCallback,
51
+ type SetLocalMetadataResponse,
52
+ type SetLocalNameCallback,
53
+ type SetLocalNameResponse,
54
+ type TrackPublishOptions,
55
+ type UnpublishTrackCallback,
56
+ type UnpublishTrackResponse,
31
57
  } from './proto/room_pb.js';
32
58
  import { ChatMessage as ChatMessageModel } from './proto/room_pb.js';
33
59
  import {
@@ -62,6 +88,9 @@ import type { RemoteTrackPublication, TrackPublication } from './track_publicati
62
88
  import { LocalTrackPublication } from './track_publication.js';
63
89
  import type { Transcription } from './transcription.js';
64
90
  import type { ChatMessage } from './types.js';
91
+ import { numberToBigInt, splitUtf8 } from './utils.js';
92
+
93
+ const STREAM_CHUNK_SIZE = 15_000;
65
94
 
66
95
  export abstract class Participant {
67
96
  /** @internal */
@@ -85,20 +114,20 @@ export abstract class Participant {
85
114
  return this.info.name;
86
115
  }
87
116
 
88
- get identity(): string | undefined {
89
- return this.info.identity;
117
+ get identity(): string {
118
+ return this.info.identity ?? '';
90
119
  }
91
120
 
92
- get metadata(): string | undefined {
93
- return this.info.metadata;
121
+ get metadata(): string {
122
+ return this.info.metadata ?? '';
94
123
  }
95
124
 
96
- get attributes(): Record<string, string> | undefined {
97
- return this.info.attributes;
125
+ get attributes(): Record<string, string> {
126
+ return this.info.attributes ?? {};
98
127
  }
99
128
 
100
- get kind(): ParticipantKind | undefined {
101
- return this.info.kind;
129
+ get kind(): ParticipantKind {
130
+ return this.info.kind ?? ParticipantKind.STANDARD;
102
131
  }
103
132
 
104
133
  get disconnectReason(): DisconnectReason | undefined {
@@ -219,6 +248,299 @@ export class LocalParticipant extends Participant {
219
248
  });
220
249
  }
221
250
 
251
+ /**
252
+ * Returns a `StreamWriter` instance that allows to write individual chunks of text to a stream.
253
+ * Well suited for TTS and/or streaming LLM output. If you want to simply send a text then use sendText() instead
254
+ */
255
+ async streamText(options?: {
256
+ topic?: string;
257
+ attributes?: Record<string, string>;
258
+ destinationIdentities?: Array<string>;
259
+ streamId?: string;
260
+ }): Promise<TextStreamWriter> {
261
+ const senderIdentity = this.identity;
262
+ const streamId = options?.streamId ?? crypto.randomUUID();
263
+ const destinationIdentities = options?.destinationIdentities;
264
+
265
+ const info: TextStreamInfo = {
266
+ streamId: streamId,
267
+ mimeType: 'text/plain',
268
+ topic: options?.topic ?? '',
269
+ timestamp: Date.now(),
270
+ };
271
+
272
+ const headerReq = new SendStreamHeaderRequest({
273
+ senderIdentity,
274
+ destinationIdentities,
275
+ localParticipantHandle: this.ffi_handle.handle,
276
+ header: new DataStream_Header({
277
+ streamId,
278
+ mimeType: info.mimeType,
279
+ topic: info.topic,
280
+ timestamp: numberToBigInt(info.timestamp),
281
+ attributes: options?.attributes,
282
+ contentHeader: {
283
+ case: 'textHeader',
284
+ value: new DataStream_TextHeader({
285
+ operationType: DataStream_OperationType.CREATE,
286
+ version: 0,
287
+ replyToStreamId: '',
288
+ generated: false,
289
+ }),
290
+ },
291
+ }),
292
+ });
293
+
294
+ await this.sendStreamHeader(headerReq);
295
+
296
+ let chunkId = 0;
297
+ const localHandle = this.ffi_handle.handle;
298
+ const sendTrailer = this.sendStreamTrailer;
299
+ const sendChunk = this.sendStreamChunk;
300
+
301
+ const writableStream = new WritableStream<[string, number?]>({
302
+ // Implement the sink
303
+ write([textChunk, overrideChunkId]) {
304
+ const textInBytes = new TextEncoder().encode(textChunk);
305
+
306
+ if (textInBytes.byteLength > STREAM_CHUNK_SIZE) {
307
+ this.abort?.();
308
+ throw new Error('chunk size too large');
309
+ }
310
+
311
+ return new Promise(async (resolve) => {
312
+ const chunkRequest = new SendStreamChunkRequest({
313
+ senderIdentity,
314
+ localParticipantHandle: localHandle,
315
+ destinationIdentities,
316
+ chunk: new DataStream_Chunk({
317
+ content: textInBytes,
318
+ streamId,
319
+ chunkIndex: numberToBigInt(overrideChunkId ?? chunkId),
320
+ }),
321
+ });
322
+
323
+ await sendChunk(chunkRequest);
324
+
325
+ if (!overrideChunkId) {
326
+ chunkId += 1;
327
+ resolve();
328
+ }
329
+ });
330
+ },
331
+ async close() {
332
+ const trailerReq = new SendStreamTrailerRequest({
333
+ senderIdentity,
334
+ localParticipantHandle: localHandle,
335
+ destinationIdentities,
336
+ trailer: new DataStream_Trailer({
337
+ streamId,
338
+ reason: '',
339
+ }),
340
+ });
341
+ await sendTrailer(trailerReq);
342
+ },
343
+ abort(err) {
344
+ log.error('Sink error:', err);
345
+ },
346
+ });
347
+
348
+ const writer = new TextStreamWriter(writableStream, info);
349
+
350
+ return writer;
351
+ }
352
+
353
+ async sendText(
354
+ text: string,
355
+ options?: {
356
+ topic?: string;
357
+ attributes?: Record<string, string>;
358
+ destinationIdentities?: Array<string>;
359
+ streamId?: string;
360
+ },
361
+ ) {
362
+ const writer = await this.streamText(options);
363
+
364
+ for (const chunk in splitUtf8(text, STREAM_CHUNK_SIZE)) {
365
+ await writer.write(chunk);
366
+ }
367
+ await writer.close();
368
+ return writer.info;
369
+ }
370
+
371
+ async streamBytes(options?: {
372
+ name?: string;
373
+ topic?: string;
374
+ attributes?: Record<string, string>;
375
+ destinationIdentities?: Array<string>;
376
+ streamId?: string;
377
+ mimeType?: string;
378
+ totalSize?: number;
379
+ }) {
380
+ const senderIdentity = this.identity;
381
+ const streamId = options?.streamId ?? crypto.randomUUID();
382
+ const destinationIdentities = options?.destinationIdentities;
383
+
384
+ const info: ByteStreamInfo = {
385
+ streamId: streamId,
386
+ mimeType: options?.mimeType ?? 'application/octet-stream',
387
+ topic: options?.topic ?? '',
388
+ timestamp: Date.now(),
389
+ attributes: options?.attributes,
390
+ totalSize: options?.totalSize,
391
+ name: options?.name ?? 'unknown',
392
+ };
393
+
394
+ const headerReq = new SendStreamHeaderRequest({
395
+ senderIdentity,
396
+ destinationIdentities,
397
+ localParticipantHandle: this.ffi_handle.handle,
398
+ header: new DataStream_Header({
399
+ streamId,
400
+ mimeType: info.mimeType,
401
+ topic: info.topic,
402
+ timestamp: numberToBigInt(info.timestamp),
403
+ attributes: info.attributes,
404
+ totalLength: numberToBigInt(info.totalSize),
405
+ contentHeader: {
406
+ case: 'byteHeader',
407
+ value: new DataStream_ByteHeader({
408
+ name: info.name,
409
+ }),
410
+ },
411
+ }),
412
+ });
413
+
414
+ await this.sendStreamHeader(headerReq);
415
+
416
+ let chunkId = 0;
417
+ const localHandle = this.ffi_handle.handle;
418
+ const sendTrailer = this.sendStreamTrailer;
419
+ const sendChunk = this.sendStreamChunk;
420
+ const writeMutex = new Mutex();
421
+
422
+ const writableStream = new WritableStream<[Uint8Array, number?]>({
423
+ async write([chunk]) {
424
+ const unlock = await writeMutex.lock();
425
+
426
+ let byteOffset = 0;
427
+ try {
428
+ while (byteOffset < chunk.byteLength) {
429
+ const subChunk = chunk.slice(byteOffset, byteOffset + STREAM_CHUNK_SIZE);
430
+ const chunkRequest = new SendStreamChunkRequest({
431
+ senderIdentity,
432
+ localParticipantHandle: localHandle,
433
+ destinationIdentities,
434
+ chunk: new DataStream_Chunk({
435
+ content: subChunk,
436
+ streamId,
437
+ chunkIndex: numberToBigInt(chunkId),
438
+ }),
439
+ });
440
+
441
+ await sendChunk(chunkRequest);
442
+ chunkId += 1;
443
+ byteOffset += subChunk.byteLength;
444
+ }
445
+ } finally {
446
+ unlock();
447
+ }
448
+ },
449
+ async close() {
450
+ const trailerReq = new SendStreamTrailerRequest({
451
+ senderIdentity,
452
+ localParticipantHandle: localHandle,
453
+ destinationIdentities,
454
+ trailer: new DataStream_Trailer({
455
+ streamId,
456
+ reason: '',
457
+ }),
458
+ });
459
+ await sendTrailer(trailerReq);
460
+ },
461
+ abort(err) {
462
+ log.error('Sink error:', err);
463
+ },
464
+ });
465
+
466
+ const byteWriter = new ByteStreamWriter(writableStream, info);
467
+
468
+ return byteWriter;
469
+ }
470
+
471
+ /** Sends a file provided as PathLike to specified recipients */
472
+ async sendFile(path: PathLike, options?: ByteStreamOptions) {
473
+ const fileStats = await stat(path);
474
+ const file = await open(path);
475
+ try {
476
+ const stream: ReadableStream<Uint8Array> = file.readableWebStream({ type: 'bytes' });
477
+ const streamId = crypto.randomUUID();
478
+ const destinationIdentities = options?.destinationIdentities;
479
+
480
+ const writer = await this.streamBytes({
481
+ streamId: streamId,
482
+ name: options?.name,
483
+ totalSize: fileStats.size,
484
+ destinationIdentities,
485
+ topic: options?.topic,
486
+ mimeType: options?.mimeType,
487
+ attributes: options?.attributes,
488
+ });
489
+
490
+ for await (const chunk of stream) {
491
+ await writer.write(chunk);
492
+ }
493
+ await writer.close();
494
+ } finally {
495
+ await file.close();
496
+ }
497
+ }
498
+
499
+ private async sendStreamHeader(req: SendStreamHeaderRequest) {
500
+ const type = 'sendStreamHeader';
501
+ const res = FfiClient.instance.request<SendStreamHeaderResponse>({
502
+ message: { case: type, value: req },
503
+ });
504
+
505
+ const cb = await FfiClient.instance.waitFor<SendStreamHeaderCallback>((ev) => {
506
+ return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
507
+ });
508
+
509
+ if (cb.error) {
510
+ throw new Error(cb.error);
511
+ }
512
+ }
513
+
514
+ private async sendStreamChunk(req: SendStreamChunkRequest) {
515
+ const type = 'sendStreamChunk';
516
+ const res = FfiClient.instance.request<SendStreamChunkResponse>({
517
+ message: { case: type, value: req },
518
+ });
519
+
520
+ const cb = await FfiClient.instance.waitFor<SendStreamChunkCallback>((ev) => {
521
+ return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
522
+ });
523
+
524
+ if (cb.error) {
525
+ throw new Error(cb.error);
526
+ }
527
+ }
528
+
529
+ private async sendStreamTrailer(req: SendStreamTrailerRequest) {
530
+ const type = 'sendStreamTrailer';
531
+ const res = FfiClient.instance.request<SendStreamTrailerResponse>({
532
+ message: { case: type, value: req },
533
+ });
534
+
535
+ const cb = await FfiClient.instance.waitFor<SendStreamTrailerCallback>((ev) => {
536
+ return ev.message.case == type && ev.message.value.asyncId == res.asyncId;
537
+ });
538
+
539
+ if (cb.error) {
540
+ throw new Error(cb.error);
541
+ }
542
+ }
543
+
222
544
  /**
223
545
  * Sends a chat message to participants in the room
224
546
  *
@@ -19,7 +19,7 @@
19
19
 
20
20
  import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
21
21
  import { Message, proto2 } from "@bufbuild/protobuf";
22
- import { ConnectCallback, ConnectRequest, ConnectResponse, DisconnectCallback, DisconnectRequest, DisconnectResponse, EditChatMessageRequest, GetSessionStatsCallback, GetSessionStatsRequest, GetSessionStatsResponse, PublishDataCallback, PublishDataRequest, PublishDataResponse, PublishSipDtmfCallback, PublishSipDtmfRequest, PublishSipDtmfResponse, PublishTrackCallback, PublishTrackRequest, PublishTrackResponse, PublishTranscriptionCallback, PublishTranscriptionRequest, PublishTranscriptionResponse, RoomEvent, SendChatMessageCallback, SendChatMessageRequest, SendChatMessageResponse, SetLocalAttributesCallback, SetLocalAttributesRequest, SetLocalAttributesResponse, SetLocalMetadataCallback, SetLocalMetadataRequest, SetLocalMetadataResponse, SetLocalNameCallback, SetLocalNameRequest, SetLocalNameResponse, SetSubscribedRequest, SetSubscribedResponse, UnpublishTrackCallback, UnpublishTrackRequest, UnpublishTrackResponse } from "./room_pb.js";
22
+ import { ConnectCallback, ConnectRequest, ConnectResponse, DisconnectCallback, DisconnectRequest, DisconnectResponse, EditChatMessageRequest, GetSessionStatsCallback, GetSessionStatsRequest, GetSessionStatsResponse, PublishDataCallback, PublishDataRequest, PublishDataResponse, PublishSipDtmfCallback, PublishSipDtmfRequest, PublishSipDtmfResponse, PublishTrackCallback, PublishTrackRequest, PublishTrackResponse, PublishTranscriptionCallback, PublishTranscriptionRequest, PublishTranscriptionResponse, RoomEvent, SendChatMessageCallback, SendChatMessageRequest, SendChatMessageResponse, SendStreamChunkCallback, SendStreamChunkRequest, SendStreamChunkResponse, SendStreamHeaderCallback, SendStreamHeaderRequest, SendStreamHeaderResponse, SendStreamTrailerCallback, SendStreamTrailerRequest, SendStreamTrailerResponse, SetDataChannelBufferedAmountLowThresholdRequest, SetDataChannelBufferedAmountLowThresholdResponse, SetLocalAttributesCallback, SetLocalAttributesRequest, SetLocalAttributesResponse, SetLocalMetadataCallback, SetLocalMetadataRequest, SetLocalMetadataResponse, SetLocalNameCallback, SetLocalNameRequest, SetLocalNameResponse, SetSubscribedRequest, SetSubscribedResponse, UnpublishTrackCallback, UnpublishTrackRequest, UnpublishTrackResponse } from "./room_pb.js";
23
23
  import { CreateAudioTrackRequest, CreateAudioTrackResponse, CreateVideoTrackRequest, CreateVideoTrackResponse, EnableRemoteTrackRequest, EnableRemoteTrackResponse, GetStatsCallback, GetStatsRequest, GetStatsResponse, LocalTrackMuteRequest, LocalTrackMuteResponse, TrackEvent } from "./track_pb.js";
24
24
  import { CaptureVideoFrameRequest, CaptureVideoFrameResponse, NewVideoSourceRequest, NewVideoSourceResponse, NewVideoStreamRequest, NewVideoStreamResponse, VideoConvertRequest, VideoConvertResponse, VideoStreamEvent, VideoStreamFromParticipantRequest, VideoStreamFromParticipantResponse } from "./video_frame_pb.js";
25
25
  import { AudioStreamEvent, AudioStreamFromParticipantRequest, AudioStreamFromParticipantResponse, CaptureAudioFrameCallback, CaptureAudioFrameRequest, CaptureAudioFrameResponse, ClearAudioBufferRequest, ClearAudioBufferResponse, FlushSoxResamplerRequest, FlushSoxResamplerResponse, NewAudioResamplerRequest, NewAudioResamplerResponse, NewAudioSourceRequest, NewAudioSourceResponse, NewAudioStreamRequest, NewAudioStreamResponse, NewSoxResamplerRequest, NewSoxResamplerResponse, PushSoxResamplerRequest, PushSoxResamplerResponse, RemixAndResampleRequest, RemixAndResampleResponse } from "./audio_frame_pb.js";
@@ -339,6 +339,34 @@ export class FfiRequest extends Message<FfiRequest> {
339
339
  */
340
340
  value: UpdateRemoteTrackPublicationDimensionRequest;
341
341
  case: "updateRemoteTrackPublicationDimension";
342
+ } | {
343
+ /**
344
+ * Data Streams
345
+ *
346
+ * @generated from field: livekit.proto.SendStreamHeaderRequest send_stream_header = 44;
347
+ */
348
+ value: SendStreamHeaderRequest;
349
+ case: "sendStreamHeader";
350
+ } | {
351
+ /**
352
+ * @generated from field: livekit.proto.SendStreamChunkRequest send_stream_chunk = 45;
353
+ */
354
+ value: SendStreamChunkRequest;
355
+ case: "sendStreamChunk";
356
+ } | {
357
+ /**
358
+ * @generated from field: livekit.proto.SendStreamTrailerRequest send_stream_trailer = 46;
359
+ */
360
+ value: SendStreamTrailerRequest;
361
+ case: "sendStreamTrailer";
362
+ } | {
363
+ /**
364
+ * Data Channel
365
+ *
366
+ * @generated from field: livekit.proto.SetDataChannelBufferedAmountLowThresholdRequest set_data_channel_buffered_amount_low_threshold = 47;
367
+ */
368
+ value: SetDataChannelBufferedAmountLowThresholdRequest;
369
+ case: "setDataChannelBufferedAmountLowThreshold";
342
370
  } | { case: undefined; value?: undefined } = { case: undefined };
343
371
 
344
372
  constructor(data?: PartialMessage<FfiRequest>) {
@@ -391,6 +419,10 @@ export class FfiRequest extends Message<FfiRequest> {
391
419
  { no: 41, name: "rpc_method_invocation_response", kind: "message", T: RpcMethodInvocationResponseRequest, oneof: "message" },
392
420
  { no: 42, name: "enable_remote_track_publication", kind: "message", T: EnableRemoteTrackPublicationRequest, oneof: "message" },
393
421
  { no: 43, name: "update_remote_track_publication_dimension", kind: "message", T: UpdateRemoteTrackPublicationDimensionRequest, oneof: "message" },
422
+ { no: 44, name: "send_stream_header", kind: "message", T: SendStreamHeaderRequest, oneof: "message" },
423
+ { no: 45, name: "send_stream_chunk", kind: "message", T: SendStreamChunkRequest, oneof: "message" },
424
+ { no: 46, name: "send_stream_trailer", kind: "message", T: SendStreamTrailerRequest, oneof: "message" },
425
+ { no: 47, name: "set_data_channel_buffered_amount_low_threshold", kind: "message", T: SetDataChannelBufferedAmountLowThresholdRequest, oneof: "message" },
394
426
  ]);
395
427
 
396
428
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiRequest {
@@ -677,6 +709,34 @@ export class FfiResponse extends Message<FfiResponse> {
677
709
  */
678
710
  value: UpdateRemoteTrackPublicationDimensionResponse;
679
711
  case: "updateRemoteTrackPublicationDimension";
712
+ } | {
713
+ /**
714
+ * Data Streams
715
+ *
716
+ * @generated from field: livekit.proto.SendStreamHeaderResponse send_stream_header = 43;
717
+ */
718
+ value: SendStreamHeaderResponse;
719
+ case: "sendStreamHeader";
720
+ } | {
721
+ /**
722
+ * @generated from field: livekit.proto.SendStreamChunkResponse send_stream_chunk = 44;
723
+ */
724
+ value: SendStreamChunkResponse;
725
+ case: "sendStreamChunk";
726
+ } | {
727
+ /**
728
+ * @generated from field: livekit.proto.SendStreamTrailerResponse send_stream_trailer = 45;
729
+ */
730
+ value: SendStreamTrailerResponse;
731
+ case: "sendStreamTrailer";
732
+ } | {
733
+ /**
734
+ * Data Channel
735
+ *
736
+ * @generated from field: livekit.proto.SetDataChannelBufferedAmountLowThresholdResponse set_data_channel_buffered_amount_low_threshold = 46;
737
+ */
738
+ value: SetDataChannelBufferedAmountLowThresholdResponse;
739
+ case: "setDataChannelBufferedAmountLowThreshold";
680
740
  } | { case: undefined; value?: undefined } = { case: undefined };
681
741
 
682
742
  constructor(data?: PartialMessage<FfiResponse>) {
@@ -728,6 +788,10 @@ export class FfiResponse extends Message<FfiResponse> {
728
788
  { no: 40, name: "rpc_method_invocation_response", kind: "message", T: RpcMethodInvocationResponseResponse, oneof: "message" },
729
789
  { no: 41, name: "enable_remote_track_publication", kind: "message", T: EnableRemoteTrackPublicationResponse, oneof: "message" },
730
790
  { no: 42, name: "update_remote_track_publication_dimension", kind: "message", T: UpdateRemoteTrackPublicationDimensionResponse, oneof: "message" },
791
+ { no: 43, name: "send_stream_header", kind: "message", T: SendStreamHeaderResponse, oneof: "message" },
792
+ { no: 44, name: "send_stream_chunk", kind: "message", T: SendStreamChunkResponse, oneof: "message" },
793
+ { no: 45, name: "send_stream_trailer", kind: "message", T: SendStreamTrailerResponse, oneof: "message" },
794
+ { no: 46, name: "set_data_channel_buffered_amount_low_threshold", kind: "message", T: SetDataChannelBufferedAmountLowThresholdResponse, oneof: "message" },
731
795
  ]);
732
796
 
733
797
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiResponse {
@@ -896,6 +960,24 @@ export class FfiEvent extends Message<FfiEvent> {
896
960
  */
897
961
  value: RpcMethodInvocationEvent;
898
962
  case: "rpcMethodInvocation";
963
+ } | {
964
+ /**
965
+ * @generated from field: livekit.proto.SendStreamHeaderCallback send_stream_header = 25;
966
+ */
967
+ value: SendStreamHeaderCallback;
968
+ case: "sendStreamHeader";
969
+ } | {
970
+ /**
971
+ * @generated from field: livekit.proto.SendStreamChunkCallback send_stream_chunk = 26;
972
+ */
973
+ value: SendStreamChunkCallback;
974
+ case: "sendStreamChunk";
975
+ } | {
976
+ /**
977
+ * @generated from field: livekit.proto.SendStreamTrailerCallback send_stream_trailer = 27;
978
+ */
979
+ value: SendStreamTrailerCallback;
980
+ case: "sendStreamTrailer";
899
981
  } | { case: undefined; value?: undefined } = { case: undefined };
900
982
 
901
983
  constructor(data?: PartialMessage<FfiEvent>) {
@@ -929,6 +1011,9 @@ export class FfiEvent extends Message<FfiEvent> {
929
1011
  { no: 22, name: "chat_message", kind: "message", T: SendChatMessageCallback, oneof: "message" },
930
1012
  { no: 23, name: "perform_rpc", kind: "message", T: PerformRpcCallback, oneof: "message" },
931
1013
  { no: 24, name: "rpc_method_invocation", kind: "message", T: RpcMethodInvocationEvent, oneof: "message" },
1014
+ { no: 25, name: "send_stream_header", kind: "message", T: SendStreamHeaderCallback, oneof: "message" },
1015
+ { no: 26, name: "send_stream_chunk", kind: "message", T: SendStreamChunkCallback, oneof: "message" },
1016
+ { no: 27, name: "send_stream_trailer", kind: "message", T: SendStreamTrailerCallback, oneof: "message" },
932
1017
  ]);
933
1018
 
934
1019
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FfiEvent {