livekit-client 2.5.1 → 2.5.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 +4 -2
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +867 -425
- 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/room/PCTransportManager.d.ts +1 -0
- package/dist/src/room/PCTransportManager.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +7 -4
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/events.d.ts +4 -1
- package/dist/src/room/events.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +11 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +2 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts +1 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts +7 -0
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/types.d.ts +6 -0
- package/dist/src/room/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +3 -2
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/room/PCTransportManager.d.ts +1 -0
- package/dist/ts4.2/src/room/Room.d.ts +7 -4
- package/dist/ts4.2/src/room/events.d.ts +4 -1
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +11 -1
- package/dist/ts4.2/src/room/participant/Participant.d.ts +2 -1
- package/dist/ts4.2/src/room/track/LocalTrack.d.ts +1 -1
- package/dist/ts4.2/src/room/track/create.d.ts +7 -0
- package/dist/ts4.2/src/room/types.d.ts +6 -0
- package/dist/ts4.2/src/room/utils.d.ts +3 -2
- package/package.json +9 -9
- package/src/connectionHelper/checks/Checker.ts +1 -1
- package/src/e2ee/worker/FrameCryptor.ts +3 -1
- package/src/room/PCTransportManager.ts +12 -4
- package/src/room/Room.ts +67 -7
- package/src/room/events.ts +4 -0
- package/src/room/participant/LocalParticipant.ts +146 -52
- package/src/room/participant/Participant.ts +2 -1
- package/src/room/track/LocalTrack.ts +4 -2
- package/src/room/track/create.ts +27 -8
- package/src/room/types.ts +7 -0
- package/src/room/utils.ts +17 -2
@@ -215,7 +215,7 @@ export default abstract class LocalTrack<
|
|
215
215
|
/**
|
216
216
|
* @returns DeviceID of the device that is currently being used for this track
|
217
217
|
*/
|
218
|
-
async getDeviceId(): Promise<string | undefined> {
|
218
|
+
async getDeviceId(normalize = true): Promise<string | undefined> {
|
219
219
|
// screen share doesn't have a usable device id
|
220
220
|
if (this.source === Track.Source.ScreenShare) {
|
221
221
|
return;
|
@@ -223,7 +223,9 @@ export default abstract class LocalTrack<
|
|
223
223
|
const { deviceId, groupId } = this._mediaStreamTrack.getSettings();
|
224
224
|
const kind = this.kind === Track.Kind.Audio ? 'audioinput' : 'videoinput';
|
225
225
|
|
226
|
-
return
|
226
|
+
return normalize
|
227
|
+
? DeviceManager.getInstance().normalizeDeviceId(kind, deviceId, groupId)
|
228
|
+
: deviceId;
|
227
229
|
}
|
228
230
|
|
229
231
|
async mute() {
|
package/src/room/track/create.ts
CHANGED
@@ -14,13 +14,32 @@ import type {
|
|
14
14
|
VideoCaptureOptions,
|
15
15
|
} from './options';
|
16
16
|
import { ScreenSharePresets } from './options';
|
17
|
-
import type {
|
17
|
+
import type {
|
18
|
+
AudioProcessorOptions,
|
19
|
+
TrackProcessor,
|
20
|
+
VideoProcessorOptions,
|
21
|
+
} from './processor/types';
|
18
22
|
import {
|
19
23
|
constraintsForOptions,
|
20
24
|
mergeDefaultOptions,
|
21
25
|
screenCaptureToDisplayMediaStreamOptions,
|
22
26
|
} from './utils';
|
23
27
|
|
28
|
+
/** @internal */
|
29
|
+
export function extractProcessorsFromOptions(options: CreateLocalTracksOptions) {
|
30
|
+
let audioProcessor: TrackProcessor<Track.Kind.Audio, AudioProcessorOptions> | undefined;
|
31
|
+
let videoProcessor: TrackProcessor<Track.Kind.Video, VideoProcessorOptions> | undefined;
|
32
|
+
|
33
|
+
if (typeof options.audio === 'object' && options.audio.processor) {
|
34
|
+
audioProcessor = options.audio.processor;
|
35
|
+
}
|
36
|
+
if (typeof options.video === 'object' && options.video.processor) {
|
37
|
+
videoProcessor = options.video.processor;
|
38
|
+
}
|
39
|
+
|
40
|
+
return { audioProcessor, videoProcessor };
|
41
|
+
}
|
42
|
+
|
24
43
|
/**
|
25
44
|
* Creates a local video and audio track at the same time. When acquiring both
|
26
45
|
* audio and video tracks together, it'll display a single permission prompt to
|
@@ -35,6 +54,7 @@ export async function createLocalTracks(
|
|
35
54
|
options.audio ??= true;
|
36
55
|
options.video ??= true;
|
37
56
|
|
57
|
+
const { audioProcessor, videoProcessor } = extractProcessorsFromOptions(options);
|
38
58
|
const opts = mergeDefaultOptions(options, audioDefaults, videoDefaults);
|
39
59
|
const constraints = constraintsForOptions(opts);
|
40
60
|
|
@@ -55,7 +75,7 @@ export async function createLocalTracks(
|
|
55
75
|
return Promise.all(
|
56
76
|
stream.getTracks().map(async (mediaStreamTrack) => {
|
57
77
|
const isAudio = mediaStreamTrack.kind === 'audio';
|
58
|
-
let trackOptions = isAudio ?
|
78
|
+
let trackOptions = isAudio ? opts!.audio : opts!.video;
|
59
79
|
if (typeof trackOptions === 'boolean' || !trackOptions) {
|
60
80
|
trackOptions = {};
|
61
81
|
}
|
@@ -80,13 +100,12 @@ export async function createLocalTracks(
|
|
80
100
|
track.source = Track.Source.Microphone;
|
81
101
|
}
|
82
102
|
track.mediaStream = stream;
|
83
|
-
if (
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
await track.setProcessor(trackOptions.processor as TrackProcessor<Track.Kind.Video>);
|
88
|
-
}
|
103
|
+
if (track instanceof LocalAudioTrack && audioProcessor) {
|
104
|
+
await track.setProcessor(audioProcessor);
|
105
|
+
} else if (track instanceof LocalVideoTrack && videoProcessor) {
|
106
|
+
await track.setProcessor(videoProcessor);
|
89
107
|
}
|
108
|
+
|
90
109
|
return track;
|
91
110
|
}),
|
92
111
|
);
|
package/src/room/types.ts
CHANGED
package/src/room/utils.ts
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
ChatMessage as ChatMessageModel,
|
3
|
+
ClientInfo,
|
4
|
+
ClientInfo_SDK,
|
5
|
+
Transcription as TranscriptionModel,
|
6
|
+
} from '@livekit/protocol';
|
2
7
|
import { getBrowser } from '../utils/browserParser';
|
3
8
|
import { protocolVersion, version } from '../version';
|
4
9
|
import CriticalTimers from './timers';
|
@@ -6,7 +11,7 @@ import type LocalAudioTrack from './track/LocalAudioTrack';
|
|
6
11
|
import type RemoteAudioTrack from './track/RemoteAudioTrack';
|
7
12
|
import { VideoCodec, videoCodecs } from './track/options';
|
8
13
|
import { getNewAudioContext } from './track/utils';
|
9
|
-
import type { LiveKitReactNativeInfo, TranscriptionSegment } from './types';
|
14
|
+
import type { ChatMessage, LiveKitReactNativeInfo, TranscriptionSegment } from './types';
|
10
15
|
|
11
16
|
const separator = '|';
|
12
17
|
export const ddExtensionURI =
|
@@ -554,3 +559,13 @@ export function extractTranscriptionSegments(
|
|
554
559
|
};
|
555
560
|
});
|
556
561
|
}
|
562
|
+
|
563
|
+
export function extractChatMessage(msg: ChatMessageModel): ChatMessage {
|
564
|
+
const { id, timestamp, message, editTimestamp } = msg;
|
565
|
+
return {
|
566
|
+
id,
|
567
|
+
timestamp: Number.parseInt(timestamp.toString()),
|
568
|
+
editTimestamp: editTimestamp ? Number.parseInt(editTimestamp.toString()) : undefined,
|
569
|
+
message,
|
570
|
+
};
|
571
|
+
}
|