@livekit/rtc-node 0.6.2 → 0.8.0

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 (58) hide show
  1. package/dist/audio_stream.d.ts +3 -1
  2. package/dist/audio_stream.d.ts.map +1 -1
  3. package/dist/audio_stream.js +5 -1
  4. package/dist/audio_stream.js.map +1 -1
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/napi/native.d.ts +8 -5
  10. package/dist/participant.d.ts +2 -0
  11. package/dist/participant.d.ts.map +1 -1
  12. package/dist/participant.js +25 -1
  13. package/dist/participant.js.map +1 -1
  14. package/dist/proto/audio_frame_pb.d.ts +59 -0
  15. package/dist/proto/audio_frame_pb.d.ts.map +1 -1
  16. package/dist/proto/audio_frame_pb.js +83 -0
  17. package/dist/proto/audio_frame_pb.js.map +1 -1
  18. package/dist/proto/ffi_pb.d.ts +73 -25
  19. package/dist/proto/ffi_pb.d.ts.map +1 -1
  20. package/dist/proto/ffi_pb.js +33 -25
  21. package/dist/proto/ffi_pb.js.map +1 -1
  22. package/dist/proto/participant_pb.d.ts +29 -0
  23. package/dist/proto/participant_pb.d.ts.map +1 -1
  24. package/dist/proto/participant_pb.js +39 -0
  25. package/dist/proto/participant_pb.js.map +1 -1
  26. package/dist/proto/room_pb.d.ts +115 -15
  27. package/dist/proto/room_pb.d.ts.map +1 -1
  28. package/dist/proto/room_pb.js +142 -16
  29. package/dist/proto/room_pb.js.map +1 -1
  30. package/dist/proto/track_pb.d.ts +80 -0
  31. package/dist/proto/track_pb.d.ts.map +1 -1
  32. package/dist/proto/track_pb.js +134 -0
  33. package/dist/proto/track_pb.js.map +1 -1
  34. package/dist/proto/video_frame_pb.d.ts +53 -0
  35. package/dist/proto/video_frame_pb.d.ts.map +1 -1
  36. package/dist/proto/video_frame_pb.js +75 -0
  37. package/dist/proto/video_frame_pb.js.map +1 -1
  38. package/dist/room.d.ts +5 -3
  39. package/dist/room.d.ts.map +1 -1
  40. package/dist/room.js +6 -1
  41. package/dist/room.js.map +1 -1
  42. package/dist/transcription.d.ts +14 -0
  43. package/dist/transcription.d.ts.map +1 -0
  44. package/dist/transcription.js +2 -0
  45. package/dist/transcription.js.map +1 -0
  46. package/package.json +6 -6
  47. package/src/audio_stream.ts +7 -1
  48. package/src/index.ts +3 -2
  49. package/src/napi/native.d.ts +8 -5
  50. package/src/participant.ts +36 -0
  51. package/src/proto/audio_frame_pb.ts +111 -0
  52. package/src/proto/ffi_pb.ts +103 -47
  53. package/src/proto/participant_pb.ts +44 -0
  54. package/src/proto/room_pb.ts +180 -30
  55. package/src/proto/track_pb.ts +164 -0
  56. package/src/proto/video_frame_pb.ts +101 -0
  57. package/src/room.ts +9 -3
  58. package/src/transcription.ts +17 -0
@@ -150,6 +150,100 @@ proto3.util.setEnumType(DataPacketKind, "livekit.proto.DataPacketKind", [
150
150
  { no: 1, name: "KIND_RELIABLE" },
151
151
  ]);
152
152
 
153
+ /**
154
+ * @generated from enum livekit.proto.DisconnectReason
155
+ */
156
+ export enum DisconnectReason {
157
+ /**
158
+ * @generated from enum value: UNKNOWN_REASON = 0;
159
+ */
160
+ UNKNOWN_REASON = 0,
161
+
162
+ /**
163
+ * the client initiated the disconnect
164
+ *
165
+ * @generated from enum value: CLIENT_INITIATED = 1;
166
+ */
167
+ CLIENT_INITIATED = 1,
168
+
169
+ /**
170
+ * another participant with the same identity has joined the room
171
+ *
172
+ * @generated from enum value: DUPLICATE_IDENTITY = 2;
173
+ */
174
+ DUPLICATE_IDENTITY = 2,
175
+
176
+ /**
177
+ * the server instance is shutting down
178
+ *
179
+ * @generated from enum value: SERVER_SHUTDOWN = 3;
180
+ */
181
+ SERVER_SHUTDOWN = 3,
182
+
183
+ /**
184
+ * RoomService.RemoveParticipant was called
185
+ *
186
+ * @generated from enum value: PARTICIPANT_REMOVED = 4;
187
+ */
188
+ PARTICIPANT_REMOVED = 4,
189
+
190
+ /**
191
+ * RoomService.DeleteRoom was called
192
+ *
193
+ * @generated from enum value: ROOM_DELETED = 5;
194
+ */
195
+ ROOM_DELETED = 5,
196
+
197
+ /**
198
+ * the client is attempting to resume a session, but server is not aware of it
199
+ *
200
+ * @generated from enum value: STATE_MISMATCH = 6;
201
+ */
202
+ STATE_MISMATCH = 6,
203
+
204
+ /**
205
+ * client was unable to connect fully
206
+ *
207
+ * @generated from enum value: JOIN_FAILURE = 7;
208
+ */
209
+ JOIN_FAILURE = 7,
210
+
211
+ /**
212
+ * Cloud-only, the server requested Participant to migrate the connection elsewhere
213
+ *
214
+ * @generated from enum value: MIGRATION = 8;
215
+ */
216
+ MIGRATION = 8,
217
+
218
+ /**
219
+ * the signal websocket was closed unexpectedly
220
+ *
221
+ * @generated from enum value: SIGNAL_CLOSE = 9;
222
+ */
223
+ SIGNAL_CLOSE = 9,
224
+
225
+ /**
226
+ * the room was closed, due to all Standard and Ingress participants having left
227
+ *
228
+ * @generated from enum value: ROOM_CLOSED = 10;
229
+ */
230
+ ROOM_CLOSED = 10,
231
+ }
232
+ // Retrieve enum metadata with: proto3.getEnumType(DisconnectReason)
233
+ proto3.util.setEnumType(DisconnectReason, "livekit.proto.DisconnectReason", [
234
+ { no: 0, name: "UNKNOWN_REASON" },
235
+ { no: 1, name: "CLIENT_INITIATED" },
236
+ { no: 2, name: "DUPLICATE_IDENTITY" },
237
+ { no: 3, name: "SERVER_SHUTDOWN" },
238
+ { no: 4, name: "PARTICIPANT_REMOVED" },
239
+ { no: 5, name: "ROOM_DELETED" },
240
+ { no: 6, name: "STATE_MISMATCH" },
241
+ { no: 7, name: "JOIN_FAILURE" },
242
+ { no: 8, name: "MIGRATION" },
243
+ { no: 9, name: "SIGNAL_CLOSE" },
244
+ { no: 10, name: "ROOM_CLOSED" },
245
+ ]);
246
+
153
247
  /**
154
248
  * Connect to a new LiveKit room
155
249
  *
@@ -1857,6 +1951,11 @@ export class TrackPublishOptions extends Message<TrackPublishOptions> {
1857
1951
  */
1858
1952
  source = TrackSource.SOURCE_UNKNOWN;
1859
1953
 
1954
+ /**
1955
+ * @generated from field: string stream = 8;
1956
+ */
1957
+ stream = "";
1958
+
1860
1959
  constructor(data?: PartialMessage<TrackPublishOptions>) {
1861
1960
  super();
1862
1961
  proto3.util.initPartial(data, this);
@@ -1872,6 +1971,7 @@ export class TrackPublishOptions extends Message<TrackPublishOptions> {
1872
1971
  { no: 5, name: "red", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
1873
1972
  { no: 6, name: "simulcast", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
1874
1973
  { no: 7, name: "source", kind: "enum", T: proto3.getEnumType(TrackSource) },
1974
+ { no: 8, name: "stream", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1875
1975
  ]);
1876
1976
 
1877
1977
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TrackPublishOptions {
@@ -2251,91 +2351,97 @@ export class RoomEvent extends Message<RoomEvent> {
2251
2351
  case: "localTrackUnpublished";
2252
2352
  } | {
2253
2353
  /**
2254
- * @generated from field: livekit.proto.TrackPublished track_published = 6;
2354
+ * @generated from field: livekit.proto.LocalTrackSubscribed local_track_subscribed = 6;
2355
+ */
2356
+ value: LocalTrackSubscribed;
2357
+ case: "localTrackSubscribed";
2358
+ } | {
2359
+ /**
2360
+ * @generated from field: livekit.proto.TrackPublished track_published = 7;
2255
2361
  */
2256
2362
  value: TrackPublished;
2257
2363
  case: "trackPublished";
2258
2364
  } | {
2259
2365
  /**
2260
- * @generated from field: livekit.proto.TrackUnpublished track_unpublished = 7;
2366
+ * @generated from field: livekit.proto.TrackUnpublished track_unpublished = 8;
2261
2367
  */
2262
2368
  value: TrackUnpublished;
2263
2369
  case: "trackUnpublished";
2264
2370
  } | {
2265
2371
  /**
2266
- * @generated from field: livekit.proto.TrackSubscribed track_subscribed = 8;
2372
+ * @generated from field: livekit.proto.TrackSubscribed track_subscribed = 9;
2267
2373
  */
2268
2374
  value: TrackSubscribed;
2269
2375
  case: "trackSubscribed";
2270
2376
  } | {
2271
2377
  /**
2272
- * @generated from field: livekit.proto.TrackUnsubscribed track_unsubscribed = 9;
2378
+ * @generated from field: livekit.proto.TrackUnsubscribed track_unsubscribed = 10;
2273
2379
  */
2274
2380
  value: TrackUnsubscribed;
2275
2381
  case: "trackUnsubscribed";
2276
2382
  } | {
2277
2383
  /**
2278
- * @generated from field: livekit.proto.TrackSubscriptionFailed track_subscription_failed = 10;
2384
+ * @generated from field: livekit.proto.TrackSubscriptionFailed track_subscription_failed = 11;
2279
2385
  */
2280
2386
  value: TrackSubscriptionFailed;
2281
2387
  case: "trackSubscriptionFailed";
2282
2388
  } | {
2283
2389
  /**
2284
- * @generated from field: livekit.proto.TrackMuted track_muted = 11;
2390
+ * @generated from field: livekit.proto.TrackMuted track_muted = 12;
2285
2391
  */
2286
2392
  value: TrackMuted;
2287
2393
  case: "trackMuted";
2288
2394
  } | {
2289
2395
  /**
2290
- * @generated from field: livekit.proto.TrackUnmuted track_unmuted = 12;
2396
+ * @generated from field: livekit.proto.TrackUnmuted track_unmuted = 13;
2291
2397
  */
2292
2398
  value: TrackUnmuted;
2293
2399
  case: "trackUnmuted";
2294
2400
  } | {
2295
2401
  /**
2296
- * @generated from field: livekit.proto.ActiveSpeakersChanged active_speakers_changed = 13;
2402
+ * @generated from field: livekit.proto.ActiveSpeakersChanged active_speakers_changed = 14;
2297
2403
  */
2298
2404
  value: ActiveSpeakersChanged;
2299
2405
  case: "activeSpeakersChanged";
2300
2406
  } | {
2301
2407
  /**
2302
- * @generated from field: livekit.proto.RoomMetadataChanged room_metadata_changed = 14;
2408
+ * @generated from field: livekit.proto.RoomMetadataChanged room_metadata_changed = 15;
2303
2409
  */
2304
2410
  value: RoomMetadataChanged;
2305
2411
  case: "roomMetadataChanged";
2306
2412
  } | {
2307
2413
  /**
2308
- * @generated from field: livekit.proto.RoomSidChanged room_sid_changed = 15;
2414
+ * @generated from field: livekit.proto.RoomSidChanged room_sid_changed = 16;
2309
2415
  */
2310
2416
  value: RoomSidChanged;
2311
2417
  case: "roomSidChanged";
2312
2418
  } | {
2313
2419
  /**
2314
- * @generated from field: livekit.proto.ParticipantMetadataChanged participant_metadata_changed = 16;
2420
+ * @generated from field: livekit.proto.ParticipantMetadataChanged participant_metadata_changed = 17;
2315
2421
  */
2316
2422
  value: ParticipantMetadataChanged;
2317
2423
  case: "participantMetadataChanged";
2318
2424
  } | {
2319
2425
  /**
2320
- * @generated from field: livekit.proto.ParticipantNameChanged participant_name_changed = 17;
2426
+ * @generated from field: livekit.proto.ParticipantNameChanged participant_name_changed = 18;
2321
2427
  */
2322
2428
  value: ParticipantNameChanged;
2323
2429
  case: "participantNameChanged";
2324
2430
  } | {
2325
2431
  /**
2326
- * @generated from field: livekit.proto.ParticipantAttributesChanged participant_attributes_changed = 18;
2432
+ * @generated from field: livekit.proto.ParticipantAttributesChanged participant_attributes_changed = 19;
2327
2433
  */
2328
2434
  value: ParticipantAttributesChanged;
2329
2435
  case: "participantAttributesChanged";
2330
2436
  } | {
2331
2437
  /**
2332
- * @generated from field: livekit.proto.ConnectionQualityChanged connection_quality_changed = 19;
2438
+ * @generated from field: livekit.proto.ConnectionQualityChanged connection_quality_changed = 20;
2333
2439
  */
2334
2440
  value: ConnectionQualityChanged;
2335
2441
  case: "connectionQualityChanged";
2336
2442
  } | {
2337
2443
  /**
2338
- * @generated from field: livekit.proto.ConnectionStateChanged connection_state_changed = 20;
2444
+ * @generated from field: livekit.proto.ConnectionStateChanged connection_state_changed = 21;
2339
2445
  */
2340
2446
  value: ConnectionStateChanged;
2341
2447
  case: "connectionStateChanged";
@@ -2400,21 +2506,22 @@ export class RoomEvent extends Message<RoomEvent> {
2400
2506
  { no: 3, name: "participant_disconnected", kind: "message", T: ParticipantDisconnected, oneof: "message" },
2401
2507
  { no: 4, name: "local_track_published", kind: "message", T: LocalTrackPublished, oneof: "message" },
2402
2508
  { no: 5, name: "local_track_unpublished", kind: "message", T: LocalTrackUnpublished, oneof: "message" },
2403
- { no: 6, name: "track_published", kind: "message", T: TrackPublished, oneof: "message" },
2404
- { no: 7, name: "track_unpublished", kind: "message", T: TrackUnpublished, oneof: "message" },
2405
- { no: 8, name: "track_subscribed", kind: "message", T: TrackSubscribed, oneof: "message" },
2406
- { no: 9, name: "track_unsubscribed", kind: "message", T: TrackUnsubscribed, oneof: "message" },
2407
- { no: 10, name: "track_subscription_failed", kind: "message", T: TrackSubscriptionFailed, oneof: "message" },
2408
- { no: 11, name: "track_muted", kind: "message", T: TrackMuted, oneof: "message" },
2409
- { no: 12, name: "track_unmuted", kind: "message", T: TrackUnmuted, oneof: "message" },
2410
- { no: 13, name: "active_speakers_changed", kind: "message", T: ActiveSpeakersChanged, oneof: "message" },
2411
- { no: 14, name: "room_metadata_changed", kind: "message", T: RoomMetadataChanged, oneof: "message" },
2412
- { no: 15, name: "room_sid_changed", kind: "message", T: RoomSidChanged, oneof: "message" },
2413
- { no: 16, name: "participant_metadata_changed", kind: "message", T: ParticipantMetadataChanged, oneof: "message" },
2414
- { no: 17, name: "participant_name_changed", kind: "message", T: ParticipantNameChanged, oneof: "message" },
2415
- { no: 18, name: "participant_attributes_changed", kind: "message", T: ParticipantAttributesChanged, oneof: "message" },
2416
- { no: 19, name: "connection_quality_changed", kind: "message", T: ConnectionQualityChanged, oneof: "message" },
2417
- { no: 20, name: "connection_state_changed", kind: "message", T: ConnectionStateChanged, oneof: "message" },
2509
+ { no: 6, name: "local_track_subscribed", kind: "message", T: LocalTrackSubscribed, oneof: "message" },
2510
+ { no: 7, name: "track_published", kind: "message", T: TrackPublished, oneof: "message" },
2511
+ { no: 8, name: "track_unpublished", kind: "message", T: TrackUnpublished, oneof: "message" },
2512
+ { no: 9, name: "track_subscribed", kind: "message", T: TrackSubscribed, oneof: "message" },
2513
+ { no: 10, name: "track_unsubscribed", kind: "message", T: TrackUnsubscribed, oneof: "message" },
2514
+ { no: 11, name: "track_subscription_failed", kind: "message", T: TrackSubscriptionFailed, oneof: "message" },
2515
+ { no: 12, name: "track_muted", kind: "message", T: TrackMuted, oneof: "message" },
2516
+ { no: 13, name: "track_unmuted", kind: "message", T: TrackUnmuted, oneof: "message" },
2517
+ { no: 14, name: "active_speakers_changed", kind: "message", T: ActiveSpeakersChanged, oneof: "message" },
2518
+ { no: 15, name: "room_metadata_changed", kind: "message", T: RoomMetadataChanged, oneof: "message" },
2519
+ { no: 16, name: "room_sid_changed", kind: "message", T: RoomSidChanged, oneof: "message" },
2520
+ { no: 17, name: "participant_metadata_changed", kind: "message", T: ParticipantMetadataChanged, oneof: "message" },
2521
+ { no: 18, name: "participant_name_changed", kind: "message", T: ParticipantNameChanged, oneof: "message" },
2522
+ { no: 19, name: "participant_attributes_changed", kind: "message", T: ParticipantAttributesChanged, oneof: "message" },
2523
+ { no: 20, name: "connection_quality_changed", kind: "message", T: ConnectionQualityChanged, oneof: "message" },
2524
+ { no: 21, name: "connection_state_changed", kind: "message", T: ConnectionStateChanged, oneof: "message" },
2418
2525
  { no: 22, name: "disconnected", kind: "message", T: Disconnected, oneof: "message" },
2419
2526
  { no: 23, name: "reconnecting", kind: "message", T: Reconnecting, oneof: "message" },
2420
2527
  { no: 24, name: "reconnected", kind: "message", T: Reconnected, oneof: "message" },
@@ -2684,6 +2791,43 @@ export class LocalTrackUnpublished extends Message<LocalTrackUnpublished> {
2684
2791
  }
2685
2792
  }
2686
2793
 
2794
+ /**
2795
+ * @generated from message livekit.proto.LocalTrackSubscribed
2796
+ */
2797
+ export class LocalTrackSubscribed extends Message<LocalTrackSubscribed> {
2798
+ /**
2799
+ * @generated from field: string track_sid = 2;
2800
+ */
2801
+ trackSid = "";
2802
+
2803
+ constructor(data?: PartialMessage<LocalTrackSubscribed>) {
2804
+ super();
2805
+ proto3.util.initPartial(data, this);
2806
+ }
2807
+
2808
+ static readonly runtime: typeof proto3 = proto3;
2809
+ static readonly typeName = "livekit.proto.LocalTrackSubscribed";
2810
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
2811
+ { no: 2, name: "track_sid", kind: "scalar", T: 9 /* ScalarType.STRING */ },
2812
+ ]);
2813
+
2814
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): LocalTrackSubscribed {
2815
+ return new LocalTrackSubscribed().fromBinary(bytes, options);
2816
+ }
2817
+
2818
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): LocalTrackSubscribed {
2819
+ return new LocalTrackSubscribed().fromJson(jsonValue, options);
2820
+ }
2821
+
2822
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): LocalTrackSubscribed {
2823
+ return new LocalTrackSubscribed().fromJsonString(jsonString, options);
2824
+ }
2825
+
2826
+ static equals(a: LocalTrackSubscribed | PlainMessage<LocalTrackSubscribed> | undefined, b: LocalTrackSubscribed | PlainMessage<LocalTrackSubscribed> | undefined): boolean {
2827
+ return proto3.util.equals(LocalTrackSubscribed, a, b);
2828
+ }
2829
+ }
2830
+
2687
2831
  /**
2688
2832
  * @generated from message livekit.proto.TrackPublished
2689
2833
  */
@@ -3601,6 +3745,11 @@ export class Connected extends Message<Connected> {
3601
3745
  * @generated from message livekit.proto.Disconnected
3602
3746
  */
3603
3747
  export class Disconnected extends Message<Disconnected> {
3748
+ /**
3749
+ * @generated from field: livekit.proto.DisconnectReason reason = 1;
3750
+ */
3751
+ reason = DisconnectReason.UNKNOWN_REASON;
3752
+
3604
3753
  constructor(data?: PartialMessage<Disconnected>) {
3605
3754
  super();
3606
3755
  proto3.util.initPartial(data, this);
@@ -3609,6 +3758,7 @@ export class Disconnected extends Message<Disconnected> {
3609
3758
  static readonly runtime: typeof proto3 = proto3;
3610
3759
  static readonly typeName = "livekit.proto.Disconnected";
3611
3760
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
3761
+ { no: 1, name: "reason", kind: "enum", T: proto3.getEnumType(DisconnectReason) },
3612
3762
  ]);
3613
3763
 
3614
3764
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Disconnected {
@@ -681,3 +681,167 @@ export class OwnedTrack extends Message<OwnedTrack> {
681
681
  }
682
682
  }
683
683
 
684
+ /**
685
+ * Mute/UnMute a track
686
+ *
687
+ * @generated from message livekit.proto.LocalTrackMuteRequest
688
+ */
689
+ export class LocalTrackMuteRequest extends Message<LocalTrackMuteRequest> {
690
+ /**
691
+ * @generated from field: uint64 track_handle = 1;
692
+ */
693
+ trackHandle = protoInt64.zero;
694
+
695
+ /**
696
+ * @generated from field: bool mute = 2;
697
+ */
698
+ mute = false;
699
+
700
+ constructor(data?: PartialMessage<LocalTrackMuteRequest>) {
701
+ super();
702
+ proto3.util.initPartial(data, this);
703
+ }
704
+
705
+ static readonly runtime: typeof proto3 = proto3;
706
+ static readonly typeName = "livekit.proto.LocalTrackMuteRequest";
707
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
708
+ { no: 1, name: "track_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
709
+ { no: 2, name: "mute", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
710
+ ]);
711
+
712
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): LocalTrackMuteRequest {
713
+ return new LocalTrackMuteRequest().fromBinary(bytes, options);
714
+ }
715
+
716
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): LocalTrackMuteRequest {
717
+ return new LocalTrackMuteRequest().fromJson(jsonValue, options);
718
+ }
719
+
720
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): LocalTrackMuteRequest {
721
+ return new LocalTrackMuteRequest().fromJsonString(jsonString, options);
722
+ }
723
+
724
+ static equals(a: LocalTrackMuteRequest | PlainMessage<LocalTrackMuteRequest> | undefined, b: LocalTrackMuteRequest | PlainMessage<LocalTrackMuteRequest> | undefined): boolean {
725
+ return proto3.util.equals(LocalTrackMuteRequest, a, b);
726
+ }
727
+ }
728
+
729
+ /**
730
+ * @generated from message livekit.proto.LocalTrackMuteResponse
731
+ */
732
+ export class LocalTrackMuteResponse extends Message<LocalTrackMuteResponse> {
733
+ /**
734
+ * @generated from field: bool muted = 1;
735
+ */
736
+ muted = false;
737
+
738
+ constructor(data?: PartialMessage<LocalTrackMuteResponse>) {
739
+ super();
740
+ proto3.util.initPartial(data, this);
741
+ }
742
+
743
+ static readonly runtime: typeof proto3 = proto3;
744
+ static readonly typeName = "livekit.proto.LocalTrackMuteResponse";
745
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
746
+ { no: 1, name: "muted", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
747
+ ]);
748
+
749
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): LocalTrackMuteResponse {
750
+ return new LocalTrackMuteResponse().fromBinary(bytes, options);
751
+ }
752
+
753
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): LocalTrackMuteResponse {
754
+ return new LocalTrackMuteResponse().fromJson(jsonValue, options);
755
+ }
756
+
757
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): LocalTrackMuteResponse {
758
+ return new LocalTrackMuteResponse().fromJsonString(jsonString, options);
759
+ }
760
+
761
+ static equals(a: LocalTrackMuteResponse | PlainMessage<LocalTrackMuteResponse> | undefined, b: LocalTrackMuteResponse | PlainMessage<LocalTrackMuteResponse> | undefined): boolean {
762
+ return proto3.util.equals(LocalTrackMuteResponse, a, b);
763
+ }
764
+ }
765
+
766
+ /**
767
+ * Enable/Disable a remote track
768
+ *
769
+ * @generated from message livekit.proto.EnableRemoteTrackRequest
770
+ */
771
+ export class EnableRemoteTrackRequest extends Message<EnableRemoteTrackRequest> {
772
+ /**
773
+ * @generated from field: uint64 track_handle = 1;
774
+ */
775
+ trackHandle = protoInt64.zero;
776
+
777
+ /**
778
+ * @generated from field: bool enabled = 2;
779
+ */
780
+ enabled = false;
781
+
782
+ constructor(data?: PartialMessage<EnableRemoteTrackRequest>) {
783
+ super();
784
+ proto3.util.initPartial(data, this);
785
+ }
786
+
787
+ static readonly runtime: typeof proto3 = proto3;
788
+ static readonly typeName = "livekit.proto.EnableRemoteTrackRequest";
789
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
790
+ { no: 1, name: "track_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
791
+ { no: 2, name: "enabled", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
792
+ ]);
793
+
794
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EnableRemoteTrackRequest {
795
+ return new EnableRemoteTrackRequest().fromBinary(bytes, options);
796
+ }
797
+
798
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EnableRemoteTrackRequest {
799
+ return new EnableRemoteTrackRequest().fromJson(jsonValue, options);
800
+ }
801
+
802
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EnableRemoteTrackRequest {
803
+ return new EnableRemoteTrackRequest().fromJsonString(jsonString, options);
804
+ }
805
+
806
+ static equals(a: EnableRemoteTrackRequest | PlainMessage<EnableRemoteTrackRequest> | undefined, b: EnableRemoteTrackRequest | PlainMessage<EnableRemoteTrackRequest> | undefined): boolean {
807
+ return proto3.util.equals(EnableRemoteTrackRequest, a, b);
808
+ }
809
+ }
810
+
811
+ /**
812
+ * @generated from message livekit.proto.EnableRemoteTrackResponse
813
+ */
814
+ export class EnableRemoteTrackResponse extends Message<EnableRemoteTrackResponse> {
815
+ /**
816
+ * @generated from field: bool enabled = 1;
817
+ */
818
+ enabled = false;
819
+
820
+ constructor(data?: PartialMessage<EnableRemoteTrackResponse>) {
821
+ super();
822
+ proto3.util.initPartial(data, this);
823
+ }
824
+
825
+ static readonly runtime: typeof proto3 = proto3;
826
+ static readonly typeName = "livekit.proto.EnableRemoteTrackResponse";
827
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
828
+ { no: 1, name: "enabled", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
829
+ ]);
830
+
831
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EnableRemoteTrackResponse {
832
+ return new EnableRemoteTrackResponse().fromBinary(bytes, options);
833
+ }
834
+
835
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EnableRemoteTrackResponse {
836
+ return new EnableRemoteTrackResponse().fromJson(jsonValue, options);
837
+ }
838
+
839
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EnableRemoteTrackResponse {
840
+ return new EnableRemoteTrackResponse().fromJsonString(jsonString, options);
841
+ }
842
+
843
+ static equals(a: EnableRemoteTrackResponse | PlainMessage<EnableRemoteTrackResponse> | undefined, b: EnableRemoteTrackResponse | PlainMessage<EnableRemoteTrackResponse> | undefined): boolean {
844
+ return proto3.util.equals(EnableRemoteTrackResponse, a, b);
845
+ }
846
+ }
847
+
@@ -19,6 +19,7 @@
19
19
 
20
20
  import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
21
21
  import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
22
+ import { TrackSource } from "./track_pb.js";
22
23
  import { FfiOwnedHandle } from "./handle_pb.js";
23
24
 
24
25
  /**
@@ -298,6 +299,106 @@ export class NewVideoStreamResponse extends Message<NewVideoStreamResponse> {
298
299
  }
299
300
  }
300
301
 
302
+ /**
303
+ * Request a video stream from a participant
304
+ *
305
+ * @generated from message livekit.proto.VideoStreamFromParticipantRequest
306
+ */
307
+ export class VideoStreamFromParticipantRequest extends Message<VideoStreamFromParticipantRequest> {
308
+ /**
309
+ * @generated from field: uint64 participant_handle = 1;
310
+ */
311
+ participantHandle = protoInt64.zero;
312
+
313
+ /**
314
+ * @generated from field: livekit.proto.VideoStreamType type = 2;
315
+ */
316
+ type = VideoStreamType.VIDEO_STREAM_NATIVE;
317
+
318
+ /**
319
+ * @generated from field: livekit.proto.TrackSource track_source = 3;
320
+ */
321
+ trackSource = TrackSource.SOURCE_UNKNOWN;
322
+
323
+ /**
324
+ * @generated from field: optional livekit.proto.VideoBufferType format = 4;
325
+ */
326
+ format?: VideoBufferType;
327
+
328
+ /**
329
+ * @generated from field: bool normalize_stride = 5;
330
+ */
331
+ normalizeStride = false;
332
+
333
+ constructor(data?: PartialMessage<VideoStreamFromParticipantRequest>) {
334
+ super();
335
+ proto3.util.initPartial(data, this);
336
+ }
337
+
338
+ static readonly runtime: typeof proto3 = proto3;
339
+ static readonly typeName = "livekit.proto.VideoStreamFromParticipantRequest";
340
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
341
+ { no: 1, name: "participant_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
342
+ { no: 2, name: "type", kind: "enum", T: proto3.getEnumType(VideoStreamType) },
343
+ { no: 3, name: "track_source", kind: "enum", T: proto3.getEnumType(TrackSource) },
344
+ { no: 4, name: "format", kind: "enum", T: proto3.getEnumType(VideoBufferType), opt: true },
345
+ { no: 5, name: "normalize_stride", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
346
+ ]);
347
+
348
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): VideoStreamFromParticipantRequest {
349
+ return new VideoStreamFromParticipantRequest().fromBinary(bytes, options);
350
+ }
351
+
352
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): VideoStreamFromParticipantRequest {
353
+ return new VideoStreamFromParticipantRequest().fromJson(jsonValue, options);
354
+ }
355
+
356
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): VideoStreamFromParticipantRequest {
357
+ return new VideoStreamFromParticipantRequest().fromJsonString(jsonString, options);
358
+ }
359
+
360
+ static equals(a: VideoStreamFromParticipantRequest | PlainMessage<VideoStreamFromParticipantRequest> | undefined, b: VideoStreamFromParticipantRequest | PlainMessage<VideoStreamFromParticipantRequest> | undefined): boolean {
361
+ return proto3.util.equals(VideoStreamFromParticipantRequest, a, b);
362
+ }
363
+ }
364
+
365
+ /**
366
+ * @generated from message livekit.proto.VideoStreamFromParticipantResponse
367
+ */
368
+ export class VideoStreamFromParticipantResponse extends Message<VideoStreamFromParticipantResponse> {
369
+ /**
370
+ * @generated from field: livekit.proto.OwnedVideoStream stream = 1;
371
+ */
372
+ stream?: OwnedVideoStream;
373
+
374
+ constructor(data?: PartialMessage<VideoStreamFromParticipantResponse>) {
375
+ super();
376
+ proto3.util.initPartial(data, this);
377
+ }
378
+
379
+ static readonly runtime: typeof proto3 = proto3;
380
+ static readonly typeName = "livekit.proto.VideoStreamFromParticipantResponse";
381
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
382
+ { no: 1, name: "stream", kind: "message", T: OwnedVideoStream },
383
+ ]);
384
+
385
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): VideoStreamFromParticipantResponse {
386
+ return new VideoStreamFromParticipantResponse().fromBinary(bytes, options);
387
+ }
388
+
389
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): VideoStreamFromParticipantResponse {
390
+ return new VideoStreamFromParticipantResponse().fromJson(jsonValue, options);
391
+ }
392
+
393
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): VideoStreamFromParticipantResponse {
394
+ return new VideoStreamFromParticipantResponse().fromJsonString(jsonString, options);
395
+ }
396
+
397
+ static equals(a: VideoStreamFromParticipantResponse | PlainMessage<VideoStreamFromParticipantResponse> | undefined, b: VideoStreamFromParticipantResponse | PlainMessage<VideoStreamFromParticipantResponse> | undefined): boolean {
398
+ return proto3.util.equals(VideoStreamFromParticipantResponse, a, b);
399
+ }
400
+ }
401
+
301
402
  /**
302
403
  * Create a new VideoSource
303
404
  * VideoSource is used to send video frame to a track
package/src/room.ts CHANGED
@@ -16,6 +16,7 @@ import type {
16
16
  ConnectResponse,
17
17
  ConnectionQuality,
18
18
  DataPacketKind,
19
+ DisconnectReason,
19
20
  DisconnectResponse,
20
21
  IceServer,
21
22
  RoomInfo,
@@ -27,7 +28,7 @@ import {
27
28
  IceTransportType,
28
29
  } from './proto/room_pb.js';
29
30
  import { TrackKind } from './proto/track_pb.js';
30
- import type { RemoteTrack } from './track.js';
31
+ import type { LocalTrack, RemoteTrack } from './track.js';
31
32
  import { RemoteAudioTrack, RemoteVideoTrack } from './track.js';
32
33
  import type { LocalTrackPublication, TrackPublication } from './track_publication.js';
33
34
  import { RemoteTrackPublication } from './track_publication.js';
@@ -185,6 +186,9 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
185
186
  const publication = this.localParticipant.trackPublications.get(ev.value.publicationSid);
186
187
  this.localParticipant.trackPublications.delete(ev.value.publicationSid);
187
188
  this.emit(RoomEvent.LocalTrackUnpublished, publication, this.localParticipant);
189
+ } else if (ev.case == 'localTrackSubscribed') {
190
+ const publication = this.localParticipant.trackPublications.get(ev.value.trackSid);
191
+ this.emit(RoomEvent.LocalTrackSubscribed, publication.track);
188
192
  } else if (ev.case == 'trackPublished') {
189
193
  const participant = this.remoteParticipants.get(ev.value.participantIdentity);
190
194
  const publication = new RemoteTrackPublication(ev.value.publication);
@@ -295,7 +299,7 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
295
299
  /*} else if (ev.case == 'connected') {
296
300
  this.emit(RoomEvent.Connected);*/
297
301
  } else if (ev.case == 'disconnected') {
298
- this.emit(RoomEvent.Disconnected);
302
+ this.emit(RoomEvent.Disconnected, ev.value.reason);
299
303
  } else if (ev.case == 'reconnecting') {
300
304
  this.emit(RoomEvent.Reconnecting);
301
305
  } else if (ev.case == 'reconnected') {
@@ -336,6 +340,7 @@ export type RoomCallbacks = {
336
340
  publication: LocalTrackPublication,
337
341
  participant: LocalParticipant,
338
342
  ) => void;
343
+ localTrackSubscribed: (track: LocalTrack) => void;
339
344
  trackPublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
340
345
  trackUnpublished: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
341
346
  trackSubscribed: (
@@ -374,7 +379,7 @@ export type RoomCallbacks = {
374
379
  encryptionError: (error: Error) => void;
375
380
  connectionStateChanged: (state: ConnectionState) => void;
376
381
  connected: () => void;
377
- disconnected: (reason?: string) => void;
382
+ disconnected: (reason: DisconnectReason) => void;
378
383
  reconnecting: () => void;
379
384
  reconnected: () => void;
380
385
  };
@@ -384,6 +389,7 @@ export enum RoomEvent {
384
389
  ParticipantDisconnected = 'participantDisconnected',
385
390
  LocalTrackPublished = 'localTrackPublished',
386
391
  LocalTrackUnpublished = 'localTrackUnpublished',
392
+ LocalTrackSubscribed = 'localTrackSubscribed',
387
393
  TrackPublished = 'trackPublished',
388
394
  TrackUnpublished = 'trackUnpublished',
389
395
  TrackSubscribed = 'trackSubscribed',