@livekit/rtc-node 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio_resampler.d.ts +1 -1
- package/dist/audio_resampler.d.ts.map +1 -1
- package/dist/audio_resampler.js +8 -8
- package/dist/audio_resampler.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.ts +8 -5
- package/dist/participant.d.ts +15 -1
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +56 -1
- package/dist/participant.js.map +1 -1
- package/dist/proto/ffi_pb.d.ts +25 -1
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +5 -1
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/room_pb.d.ts +168 -0
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +220 -0
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/room.d.ts +3 -0
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +13 -0
- package/dist/room.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -6
- package/src/audio_resampler.ts +10 -10
- package/src/index.ts +2 -1
- package/src/napi/native.d.ts +8 -5
- package/src/participant.ts +78 -1
- package/src/proto/ffi_pb.ts +29 -1
- package/src/proto/room_pb.ts +319 -0
- package/src/room.ts +14 -1
- package/src/types.ts +10 -0
package/src/room.ts
CHANGED
|
@@ -32,6 +32,7 @@ import type { LocalTrack, RemoteTrack } from './track.js';
|
|
|
32
32
|
import { RemoteAudioTrack, RemoteVideoTrack } from './track.js';
|
|
33
33
|
import type { LocalTrackPublication, TrackPublication } from './track_publication.js';
|
|
34
34
|
import { RemoteTrackPublication } from './track_publication.js';
|
|
35
|
+
import type { ChatMessage } from './types.js';
|
|
35
36
|
|
|
36
37
|
export interface RtcConfiguration {
|
|
37
38
|
iceTransportType: IceTransportType;
|
|
@@ -262,6 +263,17 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
|
|
|
262
263
|
} else if (ev.case == 'connectionQualityChanged') {
|
|
263
264
|
const participant = this.retrieveParticipantByIdentity(ev.value.participantIdentity);
|
|
264
265
|
this.emit(RoomEvent.ConnectionQualityChanged, ev.value.quality, participant);
|
|
266
|
+
} else if (ev.case == 'chatMessage') {
|
|
267
|
+
const participant = this.retrieveParticipantByIdentity(ev.value.participantIdentity);
|
|
268
|
+
const { id, message: messageText, timestamp, editTimestamp, generated } = ev.value.message;
|
|
269
|
+
const message: ChatMessage = {
|
|
270
|
+
id,
|
|
271
|
+
message: messageText,
|
|
272
|
+
timestamp: Number(timestamp),
|
|
273
|
+
editTimestamp: Number(editTimestamp),
|
|
274
|
+
generated,
|
|
275
|
+
};
|
|
276
|
+
this.emit(RoomEvent.ChatMessage, message, participant);
|
|
265
277
|
} else if (ev.case == 'dataPacketReceived') {
|
|
266
278
|
// Can be undefined if the data is sent from a Server SDK
|
|
267
279
|
const participant = this.remoteParticipants.get(ev.value.participantIdentity);
|
|
@@ -285,7 +297,6 @@ export class Room extends (EventEmitter as new () => TypedEmitter<RoomCallbacks>
|
|
|
285
297
|
const { code, digit } = dataPacket.value;
|
|
286
298
|
this.emit(RoomEvent.DtmfReceived, code, digit, participant);
|
|
287
299
|
break;
|
|
288
|
-
|
|
289
300
|
default:
|
|
290
301
|
break;
|
|
291
302
|
}
|
|
@@ -376,6 +387,7 @@ export type RoomCallbacks = {
|
|
|
376
387
|
kind?: DataPacketKind,
|
|
377
388
|
topic?: string,
|
|
378
389
|
) => void;
|
|
390
|
+
chatMessage: (message: ChatMessage, participant?: Participant) => void;
|
|
379
391
|
dtmfReceived: (code: number, digit: string, participant: RemoteParticipant) => void;
|
|
380
392
|
encryptionError: (error: Error) => void;
|
|
381
393
|
connectionStateChanged: (state: ConnectionState) => void;
|
|
@@ -405,6 +417,7 @@ export enum RoomEvent {
|
|
|
405
417
|
ParticipantAttributesChanged = 'participantAttributesChanged',
|
|
406
418
|
ConnectionQualityChanged = 'connectionQualityChanged',
|
|
407
419
|
DataReceived = 'dataReceived',
|
|
420
|
+
ChatMessage = 'chatMessage',
|
|
408
421
|
DtmfReceived = 'dtmfReceived',
|
|
409
422
|
EncryptionError = 'encryptionError',
|
|
410
423
|
ConnectionStateChanged = 'connectionStateChanged',
|