livekit-client 2.9.2 → 2.9.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/dist/livekit-client.esm.mjs +25 -19
- 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/room/Room.d.ts +1 -2
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/room/Room.d.ts +1 -2
- package/dist/ts4.2/src/room/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/room/Room.ts +1 -2
- package/src/room/participant/LocalParticipant.ts +8 -11
- package/src/room/track/utils.ts +6 -4
- package/src/room/utils.test.ts +47 -1
- package/src/room/utils.ts +17 -8
@@ -11162,7 +11162,7 @@ function getOSVersion(ua) {
|
|
11162
11162
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
11163
11163
|
}
|
11164
11164
|
|
11165
|
-
var version$1 = "2.9.
|
11165
|
+
var version$1 = "2.9.4";
|
11166
11166
|
|
11167
11167
|
const version = version$1;
|
11168
11168
|
const protocolVersion = 15;
|
@@ -12145,16 +12145,22 @@ function isRemoteParticipant(p) {
|
|
12145
12145
|
function splitUtf8(s, n) {
|
12146
12146
|
// adapted from https://stackoverflow.com/a/6043797
|
12147
12147
|
const result = [];
|
12148
|
-
|
12148
|
+
let encoded = new TextEncoder().encode(s);
|
12149
|
+
while (encoded.length > n) {
|
12149
12150
|
let k = n;
|
12150
|
-
|
12151
|
-
|
12151
|
+
while (k > 0) {
|
12152
|
+
const byte = encoded[k];
|
12153
|
+
if (byte !== undefined && (byte & 0xc0) !== 0x80) {
|
12154
|
+
break;
|
12155
|
+
}
|
12152
12156
|
k--;
|
12153
12157
|
}
|
12154
|
-
result.push(
|
12155
|
-
|
12158
|
+
result.push(encoded.slice(0, k));
|
12159
|
+
encoded = encoded.slice(k);
|
12160
|
+
}
|
12161
|
+
if (encoded.length > 0) {
|
12162
|
+
result.push(encoded);
|
12156
12163
|
}
|
12157
|
-
result.push(s);
|
12158
12164
|
return result;
|
12159
12165
|
}
|
12160
12166
|
|
@@ -12166,6 +12172,8 @@ function mergeDefaultOptions(options, audioDefaults, videoDefaults) {
|
|
12166
12172
|
audioProcessor,
|
12167
12173
|
videoProcessor
|
12168
12174
|
} = extractProcessorsFromOptions(options !== null && options !== void 0 ? options : {});
|
12175
|
+
const defaultAudioProcessor = audioDefaults === null || audioDefaults === void 0 ? void 0 : audioDefaults.processor;
|
12176
|
+
const defaultVideoProcessor = videoDefaults === null || videoDefaults === void 0 ? void 0 : videoDefaults.processor;
|
12169
12177
|
const clonedOptions = (_a = cloneDeep(optionsWithoutProcessor)) !== null && _a !== void 0 ? _a : {};
|
12170
12178
|
if (clonedOptions.audio === true) clonedOptions.audio = {};
|
12171
12179
|
if (clonedOptions.video === true) clonedOptions.video = {};
|
@@ -12173,15 +12181,15 @@ function mergeDefaultOptions(options, audioDefaults, videoDefaults) {
|
|
12173
12181
|
if (clonedOptions.audio) {
|
12174
12182
|
mergeObjectWithoutOverwriting(clonedOptions.audio, audioDefaults);
|
12175
12183
|
(_b = (_d = clonedOptions.audio).deviceId) !== null && _b !== void 0 ? _b : _d.deviceId = 'default';
|
12176
|
-
if (audioProcessor) {
|
12177
|
-
clonedOptions.audio.processor = audioProcessor;
|
12184
|
+
if (audioProcessor || defaultAudioProcessor) {
|
12185
|
+
clonedOptions.audio.processor = audioProcessor !== null && audioProcessor !== void 0 ? audioProcessor : defaultAudioProcessor;
|
12178
12186
|
}
|
12179
12187
|
}
|
12180
12188
|
if (clonedOptions.video) {
|
12181
12189
|
mergeObjectWithoutOverwriting(clonedOptions.video, videoDefaults);
|
12182
12190
|
(_c = (_e = clonedOptions.video).deviceId) !== null && _c !== void 0 ? _c : _e.deviceId = 'default';
|
12183
|
-
if (videoProcessor) {
|
12184
|
-
clonedOptions.video.processor = videoProcessor;
|
12191
|
+
if (videoProcessor || defaultVideoProcessor) {
|
12192
|
+
clonedOptions.video.processor = videoProcessor !== null && videoProcessor !== void 0 ? videoProcessor : defaultVideoProcessor;
|
12185
12193
|
}
|
12186
12194
|
}
|
12187
12195
|
return clonedOptions;
|
@@ -20062,13 +20070,13 @@ class LocalParticipant extends Participant {
|
|
20062
20070
|
return __awaiter(this, void 0, void 0, function* () {
|
20063
20071
|
var _a, _b;
|
20064
20072
|
options !== null && options !== void 0 ? options : options = {};
|
20073
|
+
const mergedOptionsWithProcessors = mergeDefaultOptions(options, (_a = this.roomOptions) === null || _a === void 0 ? void 0 : _a.audioCaptureDefaults, (_b = this.roomOptions) === null || _b === void 0 ? void 0 : _b.videoCaptureDefaults);
|
20065
20074
|
const {
|
20066
20075
|
audioProcessor,
|
20067
20076
|
videoProcessor,
|
20068
20077
|
optionsWithoutProcessor
|
20069
|
-
} = extractProcessorsFromOptions(
|
20070
|
-
const
|
20071
|
-
const constraints = constraintsForOptions(mergedOptions);
|
20078
|
+
} = extractProcessorsFromOptions(mergedOptionsWithProcessors);
|
20079
|
+
const constraints = constraintsForOptions(optionsWithoutProcessor);
|
20072
20080
|
let stream;
|
20073
20081
|
try {
|
20074
20082
|
stream = yield navigator.mediaDevices.getUserMedia(constraints);
|
@@ -20092,7 +20100,6 @@ class LocalParticipant extends Participant {
|
|
20092
20100
|
}
|
20093
20101
|
return Promise.all(stream.getTracks().map(mediaStreamTrack => __awaiter(this, void 0, void 0, function* () {
|
20094
20102
|
const isAudio = mediaStreamTrack.kind === 'audio';
|
20095
|
-
isAudio ? mergedOptions.audio : mergedOptions.video;
|
20096
20103
|
let trackConstraints;
|
20097
20104
|
const conOrBool = isAudio ? constraints.audio : constraints.video;
|
20098
20105
|
if (typeof conOrBool !== 'boolean') {
|
@@ -20893,10 +20900,10 @@ class LocalParticipant extends Participant {
|
|
20893
20900
|
// Implement the sink
|
20894
20901
|
write(text) {
|
20895
20902
|
return __awaiter(this, void 0, void 0, function* () {
|
20896
|
-
for (const
|
20903
|
+
for (const textByteChunk of splitUtf8(text, STREAM_CHUNK_SIZE)) {
|
20897
20904
|
yield localP.engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
|
20898
20905
|
const chunk = new DataStream_Chunk({
|
20899
|
-
content:
|
20906
|
+
content: textByteChunk,
|
20900
20907
|
streamId,
|
20901
20908
|
chunkIndex: numberToBigInt(chunkId)
|
20902
20909
|
});
|
@@ -22589,12 +22596,11 @@ class Room extends eventsExports.EventEmitter {
|
|
22589
22596
|
}
|
22590
22597
|
/**
|
22591
22598
|
* Establishes the participant as a receiver for calls of the specified RPC method.
|
22592
|
-
* Will overwrite any existing callback for the same method.
|
22593
22599
|
*
|
22594
22600
|
* @param method - The name of the indicated RPC method
|
22595
22601
|
* @param handler - Will be invoked when an RPC request for this method is received
|
22596
22602
|
* @returns A promise that resolves when the method is successfully registered
|
22597
|
-
* @throws {Error}
|
22603
|
+
* @throws {Error} If a handler for this method is already registered (must call unregisterRpcMethod first)
|
22598
22604
|
*
|
22599
22605
|
* @example
|
22600
22606
|
* ```typescript
|