@livekit/rtc-node 0.6.0 → 0.6.2

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.
@@ -8,7 +8,7 @@ export function livekitFfiRequest(data: Uint8Array): Uint8Array;
8
8
  export function livekitRetrievePtr(handle: Uint8Array): bigint;
9
9
  export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
10
10
  export function livekitDispose(): Promise<void>;
11
- export class FfiHandle {
11
+ export declare class FfiHandle {
12
12
  constructor(handle: bigint);
13
13
  dispose(): void;
14
14
  get handle(): bigint;
@@ -112,6 +112,7 @@ export class LocalParticipant extends Participant {
112
112
 
113
113
  async publishDtmf(code: number, digit: string) {
114
114
  const req = new PublishSipDtmfRequest({
115
+ localParticipantHandle: this.ffi_handle.handle,
115
116
  code,
116
117
  digit,
117
118
  });
@@ -2379,6 +2379,12 @@ export class RoomEvent extends Message<RoomEvent> {
2379
2379
  */
2380
2380
  value: DataPacketReceived;
2381
2381
  case: "dataPacketReceived";
2382
+ } | {
2383
+ /**
2384
+ * @generated from field: livekit.proto.TranscriptionReceived transcription_received = 28;
2385
+ */
2386
+ value: TranscriptionReceived;
2387
+ case: "transcriptionReceived";
2382
2388
  } | { case: undefined; value?: undefined } = { case: undefined };
2383
2389
 
2384
2390
  constructor(data?: PartialMessage<RoomEvent>) {
@@ -2415,6 +2421,7 @@ export class RoomEvent extends Message<RoomEvent> {
2415
2421
  { no: 25, name: "e2ee_state_changed", kind: "message", T: E2eeStateChanged, oneof: "message" },
2416
2422
  { no: 26, name: "eos", kind: "message", T: RoomEOS, oneof: "message" },
2417
2423
  { no: 27, name: "data_packet_received", kind: "message", T: DataPacketReceived, oneof: "message" },
2424
+ { no: 28, name: "transcription_received", kind: "message", T: TranscriptionReceived, oneof: "message" },
2418
2425
  ]);
2419
2426
 
2420
2427
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RoomEvent {
@@ -3198,14 +3205,14 @@ export class ParticipantAttributesChanged extends Message<ParticipantAttributesC
3198
3205
  participantIdentity = "";
3199
3206
 
3200
3207
  /**
3201
- * @generated from field: map<string, string> old_attributes = 2;
3208
+ * @generated from field: map<string, string> attributes = 2;
3202
3209
  */
3203
- oldAttributes: { [key: string]: string } = {};
3210
+ attributes: { [key: string]: string } = {};
3204
3211
 
3205
3212
  /**
3206
- * @generated from field: map<string, string> attributes = 3;
3213
+ * @generated from field: map<string, string> changed_attributes = 3;
3207
3214
  */
3208
- attributes: { [key: string]: string } = {};
3215
+ changedAttributes: { [key: string]: string } = {};
3209
3216
 
3210
3217
  constructor(data?: PartialMessage<ParticipantAttributesChanged>) {
3211
3218
  super();
@@ -3216,8 +3223,8 @@ export class ParticipantAttributesChanged extends Message<ParticipantAttributesC
3216
3223
  static readonly typeName = "livekit.proto.ParticipantAttributesChanged";
3217
3224
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
3218
3225
  { no: 1, name: "participant_identity", kind: "scalar", T: 9 /* ScalarType.STRING */ },
3219
- { no: 2, name: "old_attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
3220
- { no: 3, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
3226
+ { no: 2, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
3227
+ { no: 3, name: "changed_attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
3221
3228
  ]);
3222
3229
 
3223
3230
  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ParticipantAttributesChanged {
@@ -3473,6 +3480,55 @@ export class DataPacketReceived extends Message<DataPacketReceived> {
3473
3480
  }
3474
3481
  }
3475
3482
 
3483
+ /**
3484
+ * @generated from message livekit.proto.TranscriptionReceived
3485
+ */
3486
+ export class TranscriptionReceived extends Message<TranscriptionReceived> {
3487
+ /**
3488
+ * @generated from field: optional string participant_identity = 1;
3489
+ */
3490
+ participantIdentity?: string;
3491
+
3492
+ /**
3493
+ * @generated from field: optional string track_sid = 2;
3494
+ */
3495
+ trackSid?: string;
3496
+
3497
+ /**
3498
+ * @generated from field: repeated livekit.proto.TranscriptionSegment segments = 3;
3499
+ */
3500
+ segments: TranscriptionSegment[] = [];
3501
+
3502
+ constructor(data?: PartialMessage<TranscriptionReceived>) {
3503
+ super();
3504
+ proto3.util.initPartial(data, this);
3505
+ }
3506
+
3507
+ static readonly runtime: typeof proto3 = proto3;
3508
+ static readonly typeName = "livekit.proto.TranscriptionReceived";
3509
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
3510
+ { no: 1, name: "participant_identity", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
3511
+ { no: 2, name: "track_sid", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
3512
+ { no: 3, name: "segments", kind: "message", T: TranscriptionSegment, repeated: true },
3513
+ ]);
3514
+
3515
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TranscriptionReceived {
3516
+ return new TranscriptionReceived().fromBinary(bytes, options);
3517
+ }
3518
+
3519
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TranscriptionReceived {
3520
+ return new TranscriptionReceived().fromJson(jsonValue, options);
3521
+ }
3522
+
3523
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TranscriptionReceived {
3524
+ return new TranscriptionReceived().fromJsonString(jsonString, options);
3525
+ }
3526
+
3527
+ static equals(a: TranscriptionReceived | PlainMessage<TranscriptionReceived> | undefined, b: TranscriptionReceived | PlainMessage<TranscriptionReceived> | undefined): boolean {
3528
+ return proto3.util.equals(TranscriptionReceived, a, b);
3529
+ }
3530
+ }
3531
+
3476
3532
  /**
3477
3533
  * @generated from message livekit.proto.ConnectionStateChanged
3478
3534
  */
package/src/room.ts CHANGED
@@ -31,7 +31,6 @@ import type { RemoteTrack } from './track.js';
31
31
  import { RemoteAudioTrack, RemoteVideoTrack } from './track.js';
32
32
  import type { LocalTrackPublication, TrackPublication } from './track_publication.js';
33
33
  import { RemoteTrackPublication } from './track_publication.js';
34
- import { diffAttributes } from './utils.js';
35
34
 
36
35
  export interface RtcConfiguration {
37
36
  iceTransportType: IceTransportType;
@@ -251,9 +250,10 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
251
250
  this.emit(RoomEvent.ParticipantNameChanged, participant.name, participant);
252
251
  } else if (ev.case == 'participantAttributesChanged') {
253
252
  const participant = this.retrieveParticipantByIdentity(ev.value.participantIdentity);
254
- const changedAttributes = diffAttributes(participant.info.attributes, ev.value.attributes);
255
253
  participant.info.attributes = ev.value.attributes;
256
- this.emit(RoomEvent.ParticipantAttributesChanged, changedAttributes, participant);
254
+ if (Object.keys(ev.value.changedAttributes).length > 0) {
255
+ this.emit(RoomEvent.ParticipantAttributesChanged, ev.value.changedAttributes, participant);
256
+ }
257
257
  } else if (ev.case == 'connectionQualityChanged') {
258
258
  const participant = this.retrieveParticipantByIdentity(ev.value.participantIdentity);
259
259
  this.emit(RoomEvent.ConnectionQualityChanged, ev.value.quality, participant);
@@ -42,8 +42,10 @@ export class VideoFrame {
42
42
  case VideoBufferType.ABGR:
43
43
  case VideoBufferType.BGRA:
44
44
  info.stride = this.width * 4;
45
+ break;
45
46
  case VideoBufferType.RGB24:
46
47
  info.stride = this.width * 3;
48
+ break;
47
49
  }
48
50
 
49
51
  info.components.push(...getPlaneInfos(this.dataPtr, this.type, this.width, this.height));
package/dist/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function diffAttributes(oldValues: Record<string, string> | undefined, newValues: Record<string, string> | undefined): Record<string, string>;
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC7C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,0BAkB9C"}
package/dist/utils.js DELETED
@@ -1,20 +0,0 @@
1
- // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- export function diffAttributes(oldValues, newValues) {
5
- if (oldValues === undefined) {
6
- oldValues = {};
7
- }
8
- if (newValues === undefined) {
9
- newValues = {};
10
- }
11
- const allKeys = [...Object.keys(newValues), ...Object.keys(oldValues)];
12
- const diff = {};
13
- for (const key of allKeys) {
14
- if (oldValues[key] !== newValues[key]) {
15
- diff[key] = newValues[key] ?? '';
16
- }
17
- }
18
- return diff;
19
- }
20
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,sCAAsC;AAEtC,MAAM,UAAU,cAAc,CAC5B,SAA6C,EAC7C,SAA6C;IAE7C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,SAAS,GAAG,EAAE,CAAC;IACjB,CAAC;IACD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,SAAS,GAAG,EAAE,CAAC;IACjB,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACvE,MAAM,IAAI,GAA2B,EAAE,CAAC;IAExC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/src/utils.ts DELETED
@@ -1,25 +0,0 @@
1
- // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
-
5
- export function diffAttributes(
6
- oldValues: Record<string, string> | undefined,
7
- newValues: Record<string, string> | undefined,
8
- ) {
9
- if (oldValues === undefined) {
10
- oldValues = {};
11
- }
12
- if (newValues === undefined) {
13
- newValues = {};
14
- }
15
- const allKeys = [...Object.keys(newValues), ...Object.keys(oldValues)];
16
- const diff: Record<string, string> = {};
17
-
18
- for (const key of allKeys) {
19
- if (oldValues[key] !== newValues[key]) {
20
- diff[key] = newValues[key] ?? '';
21
- }
22
- }
23
-
24
- return diff;
25
- }