livekit-client 2.5.7 → 2.5.9
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +53 -20
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +39 -3
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +25 -5
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +3 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +5 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +7 -0
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +25 -5
- package/dist/ts4.2/src/room/Room.d.ts +3 -1
- package/dist/ts4.2/src/room/events.d.ts +5 -1
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +7 -0
- package/package.json +7 -7
- package/src/e2ee/worker/FrameCryptor.test.ts +311 -113
- package/src/e2ee/worker/FrameCryptor.ts +10 -5
- package/src/e2ee/worker/ParticipantKeyHandler.test.ts +169 -5
- package/src/e2ee/worker/ParticipantKeyHandler.ts +50 -20
- package/src/e2ee/worker/__snapshots__/ParticipantKeyHandler.test.ts.snap +356 -0
- package/src/room/Room.ts +8 -0
- package/src/room/events.ts +5 -0
- package/src/room/participant/LocalParticipant.ts +26 -1
- package/src/room/track/LocalTrackPublication.ts +1 -1
package/src/room/Room.ts
CHANGED
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
JoinResponse,
|
8
8
|
LeaveRequest,
|
9
9
|
LeaveRequest_Action,
|
10
|
+
MetricsBatch,
|
10
11
|
ParticipantInfo,
|
11
12
|
ParticipantInfo_State,
|
12
13
|
ParticipantPermission,
|
@@ -1546,6 +1547,8 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1546
1547
|
this.handleSipDtmf(participant, packet.value.value);
|
1547
1548
|
} else if (packet.value.case === 'chatMessage') {
|
1548
1549
|
this.handleChatMessage(participant, packet.value.value);
|
1550
|
+
} else if (packet.value.case === 'metrics') {
|
1551
|
+
this.handleMetrics(packet.value.value, participant);
|
1549
1552
|
}
|
1550
1553
|
};
|
1551
1554
|
|
@@ -1595,6 +1598,10 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
1595
1598
|
this.emit(RoomEvent.ChatMessage, msg, participant);
|
1596
1599
|
};
|
1597
1600
|
|
1601
|
+
private handleMetrics = (metrics: MetricsBatch, participant?: Participant) => {
|
1602
|
+
this.emit(RoomEvent.MetricsReceived, metrics, participant);
|
1603
|
+
};
|
1604
|
+
|
1598
1605
|
private handleAudioPlaybackStarted = () => {
|
1599
1606
|
if (this.canPlaybackAudio) {
|
1600
1607
|
return;
|
@@ -2295,4 +2302,5 @@ export type RoomEventCallbacks = {
|
|
2295
2302
|
activeDeviceChanged: (kind: MediaDeviceKind, deviceId: string) => void;
|
2296
2303
|
chatMessage: (message: ChatMessage, participant?: RemoteParticipant | LocalParticipant) => void;
|
2297
2304
|
localTrackSubscribed: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
2305
|
+
metricsReceived: (metrics: MetricsBatch, participant?: Participant) => void;
|
2298
2306
|
};
|
package/src/room/events.ts
CHANGED
@@ -330,6 +330,11 @@ export enum RoomEvent {
|
|
330
330
|
* fired when the first remote participant has subscribed to the localParticipant's track
|
331
331
|
*/
|
332
332
|
LocalTrackSubscribed = 'localTrackSubscribed',
|
333
|
+
|
334
|
+
/**
|
335
|
+
* fired when the client receives connection metrics from other participants
|
336
|
+
*/
|
337
|
+
MetricsReceived = 'metricsReceived',
|
333
338
|
}
|
334
339
|
|
335
340
|
export enum ParticipantEvent {
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
RequestResponse,
|
11
11
|
RequestResponse_Reason,
|
12
12
|
SimulcastCodec,
|
13
|
+
SipDTMF,
|
13
14
|
SubscribedQualityUpdate,
|
14
15
|
TrackInfo,
|
15
16
|
TrackUnpublishedResponse,
|
@@ -281,7 +282,10 @@ export default class LocalParticipant extends Participant {
|
|
281
282
|
(!name || this.name === name) &&
|
282
283
|
(!metadata || this.metadata === metadata) &&
|
283
284
|
(!attributes ||
|
284
|
-
Object.entries(attributes).every(
|
285
|
+
Object.entries(attributes).every(
|
286
|
+
([key, value]) =>
|
287
|
+
this.attributes[key] === value || (value === '' && !this.attributes[key]),
|
288
|
+
))
|
285
289
|
) {
|
286
290
|
this.pendingSignalRequests.delete(requestId);
|
287
291
|
resolve();
|
@@ -1349,6 +1353,27 @@ export default class LocalParticipant extends Participant {
|
|
1349
1353
|
await this.engine.sendDataPacket(packet, kind);
|
1350
1354
|
}
|
1351
1355
|
|
1356
|
+
/**
|
1357
|
+
* Publish SIP DTMF message to the room.
|
1358
|
+
*
|
1359
|
+
* @param code DTMF code
|
1360
|
+
* @param digit DTMF digit
|
1361
|
+
*/
|
1362
|
+
async publishDtmf(code: number, digit: string): Promise<void> {
|
1363
|
+
const packet = new DataPacket({
|
1364
|
+
kind: DataPacket_Kind.RELIABLE,
|
1365
|
+
value: {
|
1366
|
+
case: 'sipDtmf',
|
1367
|
+
value: new SipDTMF({
|
1368
|
+
code: code,
|
1369
|
+
digit: digit,
|
1370
|
+
}),
|
1371
|
+
},
|
1372
|
+
});
|
1373
|
+
|
1374
|
+
await this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
1375
|
+
}
|
1376
|
+
|
1352
1377
|
async sendChatMessage(text: string): Promise<ChatMessage> {
|
1353
1378
|
const msg = {
|
1354
1379
|
id: crypto.randomUUID(),
|
@@ -99,7 +99,7 @@ export default class LocalTrackPublication extends TrackPublication {
|
|
99
99
|
features.add(AudioTrackFeature.TF_STEREO);
|
100
100
|
}
|
101
101
|
if (!this.options?.dtx) {
|
102
|
-
features.add(AudioTrackFeature.
|
102
|
+
features.add(AudioTrackFeature.TF_NO_DTX);
|
103
103
|
}
|
104
104
|
if (this.track.enhancedNoiseCancellation) {
|
105
105
|
features.add(AudioTrackFeature.TF_ENHANCED_NOISE_CANCELLATION);
|