livekit-client 2.0.2 → 2.0.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/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +52 -17
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +69 -40
- 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/KeyProvider.d.ts +1 -1
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +1 -0
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +2 -2
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -0
- 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/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +1 -0
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/Track.d.ts +2 -0
- package/dist/src/room/track/Track.d.ts.map +1 -1
- package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +1 -1
- package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +1 -0
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +2 -2
- package/dist/ts4.2/src/room/Room.d.ts +1 -0
- package/dist/ts4.2/src/room/events.d.ts +5 -1
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +1 -0
- package/dist/ts4.2/src/room/track/Track.d.ts +2 -0
- package/package.json +1 -1
- package/src/e2ee/KeyProvider.ts +6 -1
- package/src/e2ee/worker/FrameCryptor.ts +26 -0
- package/src/e2ee/worker/ParticipantKeyHandler.ts +9 -5
- package/src/e2ee/worker/e2ee.worker.ts +16 -17
- package/src/room/Room.ts +18 -4
- package/src/room/events.ts +4 -0
- package/src/room/track/LocalAudioTrack.ts +1 -0
- package/src/room/track/LocalTrack.ts +42 -33
- package/src/room/track/Track.ts +2 -0
@@ -9980,6 +9980,9 @@ class BaseKeyProvider extends eventsExports.EventEmitter {
|
|
9980
9980
|
participantIdentity,
|
9981
9981
|
keyIndex
|
9982
9982
|
};
|
9983
|
+
if (!this.options.sharedKey && !participantIdentity) {
|
9984
|
+
throw new Error('participant identity needs to be passed for encryption key if sharedKey option is false');
|
9985
|
+
}
|
9983
9986
|
this.keyInfoMap.set("".concat(participantIdentity !== null && participantIdentity !== void 0 ? participantIdentity : 'shared', "-").concat(keyIndex !== null && keyIndex !== void 0 ? keyIndex : 0), keyInfo);
|
9984
9987
|
this.emit(KeyProviderEvent.SetKey, keyInfo);
|
9985
9988
|
}
|
@@ -10595,6 +10598,10 @@ var TrackEvent;
|
|
10595
10598
|
* Fires on RemoteTrackPublication
|
10596
10599
|
*/
|
10597
10600
|
TrackEvent["SubscriptionFailed"] = "subscriptionFailed";
|
10601
|
+
/**
|
10602
|
+
* @internal
|
10603
|
+
*/
|
10604
|
+
TrackEvent["TrackProcessorUpdate"] = "trackProcessorUpdate";
|
10598
10605
|
})(TrackEvent || (TrackEvent = {}));
|
10599
10606
|
|
10600
10607
|
function r(r, e, n) {
|
@@ -10703,7 +10710,7 @@ function getMatch(exp, ua) {
|
|
10703
10710
|
return match && match.length >= id && match[id] || '';
|
10704
10711
|
}
|
10705
10712
|
|
10706
|
-
var version$1 = "2.0.
|
10713
|
+
var version$1 = "2.0.3";
|
10707
10714
|
|
10708
10715
|
const version = version$1;
|
10709
10716
|
const protocolVersion = 12;
|
@@ -14206,6 +14213,7 @@ class LocalTrack extends Track {
|
|
14206
14213
|
this.muteLock = new Mutex();
|
14207
14214
|
this.pauseUpstreamLock = new Mutex();
|
14208
14215
|
this.processorLock = new Mutex();
|
14216
|
+
this.restartLock = new Mutex();
|
14209
14217
|
this.setMediaStreamTrack(mediaTrack, true);
|
14210
14218
|
// added to satisfy TS compiler, constraints are synced with MediaStreamTrack
|
14211
14219
|
this._constraints = mediaTrack.getConstraints();
|
@@ -14383,40 +14391,45 @@ class LocalTrack extends Track {
|
|
14383
14391
|
}
|
14384
14392
|
restart(constraints) {
|
14385
14393
|
return __awaiter(this, void 0, void 0, function* () {
|
14386
|
-
|
14387
|
-
|
14388
|
-
|
14389
|
-
|
14390
|
-
|
14391
|
-
|
14392
|
-
|
14393
|
-
|
14394
|
-
|
14395
|
-
|
14396
|
-
|
14397
|
-
|
14398
|
-
|
14399
|
-
|
14394
|
+
const unlock = yield this.restartLock.lock();
|
14395
|
+
try {
|
14396
|
+
if (!constraints) {
|
14397
|
+
constraints = this._constraints;
|
14398
|
+
}
|
14399
|
+
this.log.debug('restarting track with constraints', Object.assign(Object.assign({}, this.logContext), {
|
14400
|
+
constraints
|
14401
|
+
}));
|
14402
|
+
const streamConstraints = {
|
14403
|
+
audio: false,
|
14404
|
+
video: false
|
14405
|
+
};
|
14406
|
+
if (this.kind === Track.Kind.Video) {
|
14407
|
+
streamConstraints.video = constraints;
|
14408
|
+
} else {
|
14409
|
+
streamConstraints.audio = constraints;
|
14410
|
+
}
|
14411
|
+
// these steps are duplicated from setMediaStreamTrack because we must stop
|
14412
|
+
// the previous tracks before new tracks can be acquired
|
14413
|
+
this.attachedElements.forEach(el => {
|
14414
|
+
detachTrack(this.mediaStreamTrack, el);
|
14415
|
+
});
|
14416
|
+
this._mediaStreamTrack.removeEventListener('ended', this.handleEnded);
|
14417
|
+
// on Safari, the old audio track must be stopped before attempting to acquire
|
14418
|
+
// the new track, otherwise the new track will stop with
|
14419
|
+
// 'A MediaStreamTrack ended due to a capture failure`
|
14420
|
+
this._mediaStreamTrack.stop();
|
14421
|
+
// create new track and attach
|
14422
|
+
const mediaStream = yield navigator.mediaDevices.getUserMedia(streamConstraints);
|
14423
|
+
const newTrack = mediaStream.getTracks()[0];
|
14424
|
+
newTrack.addEventListener('ended', this.handleEnded);
|
14425
|
+
this.log.debug('re-acquired MediaStreamTrack', this.logContext);
|
14426
|
+
yield this.setMediaStreamTrack(newTrack);
|
14427
|
+
this._constraints = constraints;
|
14428
|
+
this.emit(TrackEvent.Restarted, this);
|
14429
|
+
return this;
|
14430
|
+
} finally {
|
14431
|
+
unlock();
|
14400
14432
|
}
|
14401
|
-
// these steps are duplicated from setMediaStreamTrack because we must stop
|
14402
|
-
// the previous tracks before new tracks can be acquired
|
14403
|
-
this.attachedElements.forEach(el => {
|
14404
|
-
detachTrack(this.mediaStreamTrack, el);
|
14405
|
-
});
|
14406
|
-
this._mediaStreamTrack.removeEventListener('ended', this.handleEnded);
|
14407
|
-
// on Safari, the old audio track must be stopped before attempting to acquire
|
14408
|
-
// the new track, otherwise the new track will stop with
|
14409
|
-
// 'A MediaStreamTrack ended due to a capture failure`
|
14410
|
-
this._mediaStreamTrack.stop();
|
14411
|
-
// create new track and attach
|
14412
|
-
const mediaStream = yield navigator.mediaDevices.getUserMedia(streamConstraints);
|
14413
|
-
const newTrack = mediaStream.getTracks()[0];
|
14414
|
-
newTrack.addEventListener('ended', this.handleEnded);
|
14415
|
-
this.log.debug('re-acquired MediaStreamTrack', this.logContext);
|
14416
|
-
yield this.setMediaStreamTrack(newTrack);
|
14417
|
-
this._constraints = constraints;
|
14418
|
-
this.emit(TrackEvent.Restarted, this);
|
14419
|
-
return this;
|
14420
14433
|
});
|
14421
14434
|
}
|
14422
14435
|
setTrackMuted(muted) {
|
@@ -14569,6 +14582,7 @@ class LocalTrack extends Track {
|
|
14569
14582
|
}
|
14570
14583
|
yield (_b = this.sender) === null || _b === void 0 ? void 0 : _b.replaceTrack(this.processor.processedTrack);
|
14571
14584
|
}
|
14585
|
+
this.emit(TrackEvent.TrackProcessorUpdate, this.processor);
|
14572
14586
|
} finally {
|
14573
14587
|
unlock();
|
14574
14588
|
}
|
@@ -14595,6 +14609,7 @@ class LocalTrack extends Track {
|
|
14595
14609
|
(_b = this.processorElement) === null || _b === void 0 ? void 0 : _b.remove();
|
14596
14610
|
this.processorElement = undefined;
|
14597
14611
|
yield this.restart();
|
14612
|
+
this.emit(TrackEvent.TrackProcessorUpdate);
|
14598
14613
|
});
|
14599
14614
|
}
|
14600
14615
|
}
|
@@ -18441,6 +18456,7 @@ class LocalAudioTrack extends LocalTrack {
|
|
18441
18456
|
if (this.processor.processedTrack) {
|
18442
18457
|
yield (_a = this.sender) === null || _a === void 0 ? void 0 : _a.replaceTrack(this.processor.processedTrack);
|
18443
18458
|
}
|
18459
|
+
this.emit(TrackEvent.TrackProcessorUpdate, this.processor);
|
18444
18460
|
} finally {
|
18445
18461
|
unlock();
|
18446
18462
|
}
|
@@ -22041,14 +22057,20 @@ class Room extends eventsExports.EventEmitter {
|
|
22041
22057
|
const pi = joinResponse.participant;
|
22042
22058
|
this.localParticipant.sid = pi.sid;
|
22043
22059
|
this.localParticipant.identity = pi.identity;
|
22060
|
+
if (this.options.e2ee && this.e2eeManager) {
|
22061
|
+
try {
|
22062
|
+
this.e2eeManager.setSifTrailer(joinResponse.sifTrailer);
|
22063
|
+
} catch (e) {
|
22064
|
+
this.log.error(e instanceof Error ? e.message : 'Could not set SifTrailer', Object.assign(Object.assign({}, this.logContext), {
|
22065
|
+
error: e
|
22066
|
+
}));
|
22067
|
+
}
|
22068
|
+
}
|
22044
22069
|
// populate remote participants, these should not trigger new events
|
22045
22070
|
this.handleParticipantUpdates([pi, ...joinResponse.otherParticipants]);
|
22046
22071
|
if (joinResponse.room) {
|
22047
22072
|
this.handleRoomUpdate(joinResponse.room);
|
22048
22073
|
}
|
22049
|
-
if (this.options.e2ee && this.e2eeManager) {
|
22050
|
-
this.e2eeManager.setSifTrailer(joinResponse.sifTrailer);
|
22051
|
-
}
|
22052
22074
|
};
|
22053
22075
|
this.attemptConnection = (url, token, opts, abortController) => __awaiter(this, void 0, void 0, function* () {
|
22054
22076
|
var _h, _j, _k;
|
@@ -22483,9 +22505,14 @@ class Room extends eventsExports.EventEmitter {
|
|
22483
22505
|
this.onLocalTrackUnmuted = pub => {
|
22484
22506
|
this.emit(RoomEvent.TrackUnmuted, pub, this.localParticipant);
|
22485
22507
|
};
|
22508
|
+
this.onTrackProcessorUpdate = processor => {
|
22509
|
+
var _a;
|
22510
|
+
(_a = processor === null || processor === void 0 ? void 0 : processor.onPublish) === null || _a === void 0 ? void 0 : _a.call(processor, this);
|
22511
|
+
};
|
22486
22512
|
this.onLocalTrackPublished = pub => __awaiter(this, void 0, void 0, function* () {
|
22487
|
-
var _r, _s, _t, _u;
|
22488
|
-
(
|
22513
|
+
var _r, _s, _t, _u, _v;
|
22514
|
+
(_r = pub.track) === null || _r === void 0 ? void 0 : _r.on(TrackEvent.TrackProcessorUpdate, this.onTrackProcessorUpdate);
|
22515
|
+
(_u = (_t = (_s = pub.track) === null || _s === void 0 ? void 0 : _s.getProcessor()) === null || _t === void 0 ? void 0 : _t.onPublish) === null || _u === void 0 ? void 0 : _u.call(_t, this);
|
22489
22516
|
this.emit(RoomEvent.LocalTrackPublished, pub, this.localParticipant);
|
22490
22517
|
if (pub.track instanceof LocalAudioTrack) {
|
22491
22518
|
const trackIsSilent = yield pub.track.checkForSilence();
|
@@ -22493,7 +22520,7 @@ class Room extends eventsExports.EventEmitter {
|
|
22493
22520
|
this.emit(RoomEvent.LocalAudioSilenceDetected, pub);
|
22494
22521
|
}
|
22495
22522
|
}
|
22496
|
-
const deviceId = yield (
|
22523
|
+
const deviceId = yield (_v = pub.track) === null || _v === void 0 ? void 0 : _v.getDeviceId();
|
22497
22524
|
const deviceKind = sourceToKind(pub.source);
|
22498
22525
|
if (deviceKind && deviceId && deviceId !== this.localParticipant.activeDeviceMap.get(deviceKind)) {
|
22499
22526
|
this.localParticipant.activeDeviceMap.set(deviceKind, deviceId);
|
@@ -22501,6 +22528,8 @@ class Room extends eventsExports.EventEmitter {
|
|
22501
22528
|
}
|
22502
22529
|
});
|
22503
22530
|
this.onLocalTrackUnpublished = pub => {
|
22531
|
+
var _a;
|
22532
|
+
(_a = pub.track) === null || _a === void 0 ? void 0 : _a.off(TrackEvent.TrackProcessorUpdate, this.onTrackProcessorUpdate);
|
22504
22533
|
this.emit(RoomEvent.LocalTrackUnpublished, pub, this.localParticipant);
|
22505
22534
|
};
|
22506
22535
|
this.onLocalConnectionQualityChanged = quality => {
|