livekit-client 1.13.2 → 1.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.
- 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 +87 -16
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +137 -31
- 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/utils.d.ts +3 -0
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +6 -2
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +5 -3
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +7 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrack.d.ts +7 -0
- package/dist/src/room/track/RemoteTrack.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -1
- package/dist/ts4.2/src/e2ee/utils.d.ts +3 -0
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +6 -2
- package/dist/ts4.2/src/room/participant/Participant.d.ts +5 -3
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +7 -0
- package/dist/ts4.2/src/room/track/RemoteTrack.d.ts +7 -0
- package/dist/ts4.2/src/room/utils.d.ts +1 -1
- package/package.json +15 -15
- package/src/e2ee/utils.ts +52 -0
- package/src/e2ee/worker/FrameCryptor.ts +49 -27
- package/src/room/RTCEngine.ts +3 -2
- package/src/room/Room.ts +3 -3
- package/src/room/participant/LocalParticipant.ts +9 -7
- package/src/room/participant/Participant.ts +7 -5
- package/src/room/track/LocalTrack.ts +14 -0
- package/src/room/track/RemoteTrack.ts +14 -0
- package/src/room/track/options.ts +1 -1
- package/src/room/utils.ts +2 -2
@@ -145,8 +145,8 @@ export default class LocalParticipant extends Participant {
|
|
145
145
|
|
146
146
|
this.engine
|
147
147
|
.on(EngineEvent.Connected, this.handleReconnected)
|
148
|
-
.on(EngineEvent.
|
149
|
-
.on(EngineEvent.
|
148
|
+
.on(EngineEvent.SignalRestarted, this.handleReconnected)
|
149
|
+
.on(EngineEvent.SignalResumed, this.handleReconnected)
|
150
150
|
.on(EngineEvent.Restarting, this.handleReconnecting)
|
151
151
|
.on(EngineEvent.Resuming, this.handleReconnecting)
|
152
152
|
.on(EngineEvent.Disconnected, this.handleDisconnected);
|
@@ -174,21 +174,23 @@ export default class LocalParticipant extends Participant {
|
|
174
174
|
|
175
175
|
/**
|
176
176
|
* Sets and updates the metadata of the local participant.
|
177
|
-
*
|
177
|
+
* The change does not take immediate effect.
|
178
|
+
* If successful, a `ParticipantEvent.MetadataChanged` event will be emitted on the local participant.
|
179
|
+
* Note: this requires `canUpdateOwnMetadata` permission.
|
178
180
|
* @param metadata
|
179
181
|
*/
|
180
182
|
setMetadata(metadata: string): void {
|
181
|
-
super.setMetadata(metadata);
|
182
183
|
this.engine.client.sendUpdateLocalMetadata(metadata, this.name ?? '');
|
183
184
|
}
|
184
185
|
|
185
186
|
/**
|
186
187
|
* Sets and updates the name of the local participant.
|
187
|
-
*
|
188
|
+
* The change does not take immediate effect.
|
189
|
+
* If successful, a `ParticipantEvent.ParticipantNameChanged` event will be emitted on the local participant.
|
190
|
+
* Note: this requires `canUpdateOwnMetadata` permission.
|
188
191
|
* @param metadata
|
189
192
|
*/
|
190
193
|
setName(name: string): void {
|
191
|
-
super.setName(name);
|
192
194
|
this.engine.client.sendUpdateLocalMetadata(this.metadata ?? '', name);
|
193
195
|
}
|
194
196
|
|
@@ -649,7 +651,7 @@ export default class LocalParticipant extends Participant {
|
|
649
651
|
disableDtx: !(opts.dtx ?? true),
|
650
652
|
encryption: this.encryptionType,
|
651
653
|
stereo: isStereo,
|
652
|
-
disableRed: !(opts.red ?? true),
|
654
|
+
disableRed: this.isE2EEEnabled || !(opts.red ?? true),
|
653
655
|
});
|
654
656
|
|
655
657
|
// compute encodings and layers for video
|
@@ -169,8 +169,8 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
|
|
169
169
|
}
|
170
170
|
this.identity = info.identity;
|
171
171
|
this.sid = info.sid;
|
172
|
-
this.
|
173
|
-
this.
|
172
|
+
this._setName(info.name);
|
173
|
+
this._setMetadata(info.metadata);
|
174
174
|
if (info.permission) {
|
175
175
|
this.setPermissions(info.permission);
|
176
176
|
}
|
@@ -180,8 +180,10 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
|
|
180
180
|
return true;
|
181
181
|
}
|
182
182
|
|
183
|
-
/**
|
184
|
-
|
183
|
+
/**
|
184
|
+
* Updates metadata from server
|
185
|
+
**/
|
186
|
+
private _setMetadata(md: string) {
|
185
187
|
const changed = this.metadata !== md;
|
186
188
|
const prevMetadata = this.metadata;
|
187
189
|
this.metadata = md;
|
@@ -191,7 +193,7 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
|
|
191
193
|
}
|
192
194
|
}
|
193
195
|
|
194
|
-
|
196
|
+
private _setName(name: string) {
|
195
197
|
const changed = this.name !== name;
|
196
198
|
this.name = name;
|
197
199
|
|
@@ -372,6 +372,20 @@ export default abstract class LocalTrack extends Track {
|
|
372
372
|
}
|
373
373
|
}
|
374
374
|
|
375
|
+
/**
|
376
|
+
* Gets the RTCStatsReport for the LocalTrack's underlying RTCRtpSender
|
377
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport
|
378
|
+
*
|
379
|
+
* @returns Promise<RTCStatsReport> | undefined
|
380
|
+
*/
|
381
|
+
async getRTCStatsReport(): Promise<RTCStatsReport | undefined> {
|
382
|
+
if (!this.sender?.getStats) {
|
383
|
+
return;
|
384
|
+
}
|
385
|
+
const statsReport = await this.sender.getStats();
|
386
|
+
return statsReport;
|
387
|
+
}
|
388
|
+
|
375
389
|
/**
|
376
390
|
* Sets a processor on this track.
|
377
391
|
* See https://github.com/livekit/track-processors-js for example usage
|
@@ -51,6 +51,20 @@ export default abstract class RemoteTrack extends Track {
|
|
51
51
|
super.disable();
|
52
52
|
}
|
53
53
|
|
54
|
+
/**
|
55
|
+
* Gets the RTCStatsReport for the RemoteTrack's underlying RTCRtpReceiver
|
56
|
+
* See https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport
|
57
|
+
*
|
58
|
+
* @returns Promise<RTCStatsReport> | undefined
|
59
|
+
*/
|
60
|
+
async getRTCStatsReport(): Promise<RTCStatsReport | undefined> {
|
61
|
+
if (!this.receiver?.getStats) {
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
const statsReport = await this.receiver.getStats();
|
65
|
+
return statsReport;
|
66
|
+
}
|
67
|
+
|
54
68
|
/* @internal */
|
55
69
|
startMonitor() {
|
56
70
|
if (!this.monitorInterval) {
|
@@ -345,7 +345,7 @@ export const VideoPresets43 = {
|
|
345
345
|
h120: new VideoPreset(160, 120, 70_000, 20),
|
346
346
|
h180: new VideoPreset(240, 180, 125_000, 20),
|
347
347
|
h240: new VideoPreset(320, 240, 140_000, 20),
|
348
|
-
h360: new VideoPreset(480, 360,
|
348
|
+
h360: new VideoPreset(480, 360, 330_000, 20),
|
349
349
|
h480: new VideoPreset(640, 480, 500_000, 20),
|
350
350
|
h540: new VideoPreset(720, 540, 600_000, 25),
|
351
351
|
h720: new VideoPreset(960, 720, 1_300_000, 30),
|
package/src/room/utils.ts
CHANGED