livekit-client 2.11.3 → 2.12.0
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 +30 -23
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +126 -27
- 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/api/SignalClient.d.ts +2 -1
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/e2ee/E2eeManager.d.ts.map +1 -1
- package/dist/src/e2ee/KeyProvider.d.ts +8 -5
- package/dist/src/e2ee/KeyProvider.d.ts.map +1 -1
- package/dist/src/e2ee/constants.d.ts.map +1 -1
- package/dist/src/e2ee/events.d.ts +8 -3
- package/dist/src/e2ee/events.d.ts.map +1 -1
- package/dist/src/e2ee/types.d.ts +5 -3
- package/dist/src/e2ee/types.d.ts.map +1 -1
- package/dist/src/e2ee/utils.d.ts +1 -1
- package/dist/src/e2ee/utils.d.ts.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +5 -6
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +2 -1
- package/dist/src/room/RTCEngine.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 +11 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/track/RemoteAudioTrack.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +2 -1
- package/dist/ts4.2/src/e2ee/KeyProvider.d.ts +8 -5
- package/dist/ts4.2/src/e2ee/events.d.ts +8 -3
- package/dist/ts4.2/src/e2ee/types.d.ts +5 -3
- package/dist/ts4.2/src/e2ee/utils.d.ts +1 -1
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +5 -6
- package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -0
- package/dist/ts4.2/src/room/events.d.ts +11 -1
- package/dist/ts4.2/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/api/SignalClient.ts +10 -0
- package/src/e2ee/E2eeManager.ts +8 -12
- package/src/e2ee/KeyProvider.ts +13 -6
- package/src/e2ee/constants.ts +0 -1
- package/src/e2ee/events.ts +12 -3
- package/src/e2ee/types.ts +8 -3
- package/src/e2ee/utils.ts +1 -2
- package/src/e2ee/worker/FrameCryptor.ts +8 -4
- package/src/e2ee/worker/ParticipantKeyHandler.test.ts +104 -4
- package/src/e2ee/worker/ParticipantKeyHandler.ts +23 -26
- package/src/e2ee/worker/e2ee.worker.ts +9 -4
- package/src/room/RTCEngine.ts +7 -0
- package/src/room/Room.ts +27 -2
- package/src/room/events.ts +11 -0
- package/src/room/participant/LocalParticipant.ts +0 -5
- package/src/room/track/RemoteAudioTrack.ts +3 -2
- package/src/version.ts +1 -1
package/src/room/Room.ts
CHANGED
@@ -79,7 +79,7 @@ import { Track } from './track/Track';
|
|
79
79
|
import type { TrackPublication } from './track/TrackPublication';
|
80
80
|
import type { TrackProcessor } from './track/processor/types';
|
81
81
|
import type { AdaptiveStreamSettings } from './track/types';
|
82
|
-
import { getNewAudioContext, sourceToKind } from './track/utils';
|
82
|
+
import { getNewAudioContext, kindToSource, sourceToKind } from './track/utils';
|
83
83
|
import {
|
84
84
|
type ByteStreamInfo,
|
85
85
|
type ChatMessage,
|
@@ -589,6 +589,25 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
589
589
|
trackPublication,
|
590
590
|
this.localParticipant,
|
591
591
|
);
|
592
|
+
})
|
593
|
+
.on(EngineEvent.RoomMoved, (roomMoved) => {
|
594
|
+
this.log.debug('room moved', roomMoved);
|
595
|
+
|
596
|
+
if (roomMoved.room) {
|
597
|
+
this.handleRoomUpdate(roomMoved.room);
|
598
|
+
}
|
599
|
+
|
600
|
+
this.remoteParticipants.forEach((participant, identity) => {
|
601
|
+
this.handleParticipantDisconnected(identity, participant);
|
602
|
+
});
|
603
|
+
|
604
|
+
this.emit(RoomEvent.Moved, roomMoved.room!.name, roomMoved.token);
|
605
|
+
|
606
|
+
if (roomMoved.participant) {
|
607
|
+
this.handleParticipantUpdates([roomMoved.participant, ...roomMoved.otherParticipants]);
|
608
|
+
} else {
|
609
|
+
this.handleParticipantUpdates(roomMoved.otherParticipants);
|
610
|
+
}
|
592
611
|
});
|
593
612
|
|
594
613
|
if (this.localParticipant) {
|
@@ -2000,9 +2019,14 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
|
|
2000
2019
|
}
|
2001
2020
|
}
|
2002
2021
|
|
2003
|
-
// inputs are automatically handled via TrackEvent.Ended causing a TrackEvent.Restarted. Here we only need to worry about audiooutputs changing
|
2004
2022
|
const kinds: MediaDeviceKind[] = ['audiooutput', 'audioinput', 'videoinput'];
|
2005
2023
|
for (let kind of kinds) {
|
2024
|
+
const targetSource = kindToSource(kind);
|
2025
|
+
const targetPublication = this.localParticipant.getTrackPublication(targetSource);
|
2026
|
+
if (targetPublication && targetPublication.track?.isUserProvided) {
|
2027
|
+
// if the track is user provided, we don't want to switch devices on behalf of the user
|
2028
|
+
continue;
|
2029
|
+
}
|
2006
2030
|
const devicesOfKind = availableDevices.filter((d) => d.kind === kind);
|
2007
2031
|
const activeDevice = this.getActiveDevice(kind);
|
2008
2032
|
|
@@ -2606,6 +2630,7 @@ export type RoomEventCallbacks = {
|
|
2606
2630
|
reconnected: () => void;
|
2607
2631
|
disconnected: (reason?: DisconnectReason) => void;
|
2608
2632
|
connectionStateChanged: (state: ConnectionState) => void;
|
2633
|
+
moved: (name: string, token: string) => void;
|
2609
2634
|
mediaDevicesChanged: () => void;
|
2610
2635
|
participantConnected: (participant: RemoteParticipant) => void;
|
2611
2636
|
participantDisconnected: (participant: RemoteParticipant) => void;
|
package/src/room/events.ts
CHANGED
@@ -52,6 +52,16 @@ export enum RoomEvent {
|
|
52
52
|
*/
|
53
53
|
ConnectionStateChanged = 'connectionStateChanged',
|
54
54
|
|
55
|
+
/**
|
56
|
+
* When participant has been moved to a different room by the service request.
|
57
|
+
* The behavior looks like the participant has been disconnected and reconnected to a different room
|
58
|
+
* seamlessly without connection state transition.
|
59
|
+
* A new token will be provided for reconnecting to the new room if needed.
|
60
|
+
*
|
61
|
+
* args: ([[room: string, token: string]])
|
62
|
+
*/
|
63
|
+
Moved = 'moved',
|
64
|
+
|
55
65
|
/**
|
56
66
|
* When input or output devices on the machine have changed.
|
57
67
|
*/
|
@@ -563,6 +573,7 @@ export enum EngineEvent {
|
|
563
573
|
Offline = 'offline',
|
564
574
|
SignalRequestResponse = 'signalRequestResponse',
|
565
575
|
SignalConnected = 'signalConnected',
|
576
|
+
RoomMoved = 'roomMoved',
|
566
577
|
}
|
567
578
|
|
568
579
|
export enum TrackEvent {
|
@@ -2053,11 +2053,6 @@ export default class LocalParticipant extends Participant {
|
|
2053
2053
|
|
2054
2054
|
/** @internal */
|
2055
2055
|
updateInfo(info: ParticipantInfo): boolean {
|
2056
|
-
if (info.sid !== this.sid) {
|
2057
|
-
// drop updates that specify a wrong sid.
|
2058
|
-
// the sid for local participant is only explicitly set on join and full reconnect
|
2059
|
-
return false;
|
2060
|
-
}
|
2061
2056
|
if (!super.updateInfo(info)) {
|
2062
2057
|
return false;
|
2063
2058
|
}
|
@@ -104,8 +104,9 @@ export default class RemoteAudioTrack extends RemoteTrack<Track.Kind.Audio> {
|
|
104
104
|
}
|
105
105
|
|
106
106
|
if (this.sinkId && supportsSetSinkId(element)) {
|
107
|
-
|
108
|
-
|
107
|
+
element.setSinkId(this.sinkId).catch((e) => {
|
108
|
+
this.log.error('Failed to set sink id on remote audio track', e, this.logContext);
|
109
|
+
});
|
109
110
|
}
|
110
111
|
if (this.audioContext && needsNewWebAudioConnection) {
|
111
112
|
this.log.debug('using audio context mapping', this.logContext);
|
package/src/version.ts
CHANGED