livekit-client 1.13.1 → 1.13.3
Sign up to get free protection for your applications and to get access to all the features.
- 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 +3 -2
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +61 -34
- 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/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/utils.d.ts +1 -1
- 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/utils.d.ts +1 -1
- package/package.json +15 -15
- package/src/e2ee/worker/FrameCryptor.ts +6 -8
- package/src/room/participant/LocalParticipant.ts +7 -5
- package/src/room/participant/Participant.ts +7 -5
- package/src/room/track/options.ts +1 -1
- package/src/room/utils.ts +2 -2
@@ -2483,7 +2483,7 @@ function debugJsonValue(json) {
|
|
2483
2483
|
case "string":
|
2484
2484
|
return json.length > 100 ? "string" : "\"".concat(json.split('"').join('\\"'), "\"");
|
2485
2485
|
default:
|
2486
|
-
return json
|
2486
|
+
return String(json);
|
2487
2487
|
}
|
2488
2488
|
}
|
2489
2489
|
// May throw an error. If the error message is non-blank, it should be shown.
|
@@ -2590,6 +2590,7 @@ function readEnum(type, json, ignoreUnknownFields) {
|
|
2590
2590
|
break;
|
2591
2591
|
case "string":
|
2592
2592
|
const value = type.findName(json);
|
2593
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
2593
2594
|
if (value || ignoreUnknownFields) {
|
2594
2595
|
return value === null || value === void 0 ? void 0 : value.no;
|
2595
2596
|
}
|
@@ -2786,6 +2787,8 @@ function makeUtilCommon() {
|
|
2786
2787
|
let val = s[localName].value;
|
2787
2788
|
if (sourceField && sourceField.kind == "message" && !(val instanceof sourceField.T)) {
|
2788
2789
|
val = new sourceField.T(val);
|
2790
|
+
} else if (sourceField && sourceField.kind === "scalar" && sourceField.T === ScalarType.BYTES) {
|
2791
|
+
val = toU8Arr(val);
|
2789
2792
|
}
|
2790
2793
|
t[localName] = {
|
2791
2794
|
case: sk,
|
@@ -2794,13 +2797,23 @@ function makeUtilCommon() {
|
|
2794
2797
|
break;
|
2795
2798
|
case "scalar":
|
2796
2799
|
case "enum":
|
2797
|
-
|
2800
|
+
let copy = s[localName];
|
2801
|
+
if (member.T === ScalarType.BYTES) {
|
2802
|
+
copy = member.repeated ? copy.map(toU8Arr) : toU8Arr(copy);
|
2803
|
+
}
|
2804
|
+
t[localName] = copy;
|
2798
2805
|
break;
|
2799
2806
|
case "map":
|
2800
2807
|
switch (member.V.kind) {
|
2801
2808
|
case "scalar":
|
2802
2809
|
case "enum":
|
2803
|
-
|
2810
|
+
if (member.V.T === ScalarType.BYTES) {
|
2811
|
+
for (const [k, v] of Object.entries(s[localName])) {
|
2812
|
+
t[localName][k] = toU8Arr(v);
|
2813
|
+
}
|
2814
|
+
} else {
|
2815
|
+
Object.assign(t[localName], s[localName]);
|
2816
|
+
}
|
2804
2817
|
break;
|
2805
2818
|
case "message":
|
2806
2819
|
const messageType = member.V.T;
|
@@ -2823,7 +2836,13 @@ function makeUtilCommon() {
|
|
2823
2836
|
} else if (s[localName] !== undefined) {
|
2824
2837
|
const val = s[localName];
|
2825
2838
|
if (mt.fieldWrapper) {
|
2826
|
-
|
2839
|
+
if (
|
2840
|
+
// We can't use BytesValue.typeName as that will create a circular import
|
2841
|
+
mt.typeName === "google.protobuf.BytesValue") {
|
2842
|
+
t[localName] = toU8Arr(val);
|
2843
|
+
} else {
|
2844
|
+
t[localName] = val;
|
2845
|
+
}
|
2827
2846
|
} else {
|
2828
2847
|
t[localName] = val instanceof mt ? val : new mt(val);
|
2829
2848
|
}
|
@@ -2906,22 +2925,22 @@ function makeUtilCommon() {
|
|
2906
2925
|
const source = message[member.localName];
|
2907
2926
|
let copy;
|
2908
2927
|
if (member.repeated) {
|
2909
|
-
copy = source.map(
|
2928
|
+
copy = source.map(cloneSingularField);
|
2910
2929
|
} else if (member.kind == "map") {
|
2911
2930
|
copy = any[member.localName];
|
2912
2931
|
for (const [key, v] of Object.entries(source)) {
|
2913
|
-
copy[key] = cloneSingularField(
|
2932
|
+
copy[key] = cloneSingularField(v);
|
2914
2933
|
}
|
2915
2934
|
} else if (member.kind == "oneof") {
|
2916
2935
|
const f = member.findField(source.case);
|
2917
2936
|
copy = f ? {
|
2918
2937
|
case: source.case,
|
2919
|
-
value: cloneSingularField(
|
2938
|
+
value: cloneSingularField(source.value)
|
2920
2939
|
} : {
|
2921
2940
|
case: undefined
|
2922
2941
|
};
|
2923
2942
|
} else {
|
2924
|
-
copy = cloneSingularField(
|
2943
|
+
copy = cloneSingularField(source);
|
2925
2944
|
}
|
2926
2945
|
any[member.localName] = copy;
|
2927
2946
|
}
|
@@ -2930,7 +2949,7 @@ function makeUtilCommon() {
|
|
2930
2949
|
};
|
2931
2950
|
}
|
2932
2951
|
// clone a single field value - i.e. the element type of repeated fields, the value type of maps
|
2933
|
-
function cloneSingularField(
|
2952
|
+
function cloneSingularField(value) {
|
2934
2953
|
if (value === undefined) {
|
2935
2954
|
return value;
|
2936
2955
|
}
|
@@ -2944,6 +2963,10 @@ function cloneSingularField(field, value) {
|
|
2944
2963
|
}
|
2945
2964
|
return value;
|
2946
2965
|
}
|
2966
|
+
// converts any ArrayLike<number> to Uint8Array if necessary.
|
2967
|
+
function toU8Arr(input) {
|
2968
|
+
return input instanceof Uint8Array ? input : new Uint8Array(input);
|
2969
|
+
}
|
2947
2970
|
|
2948
2971
|
// Copyright 2021-2023 Buf Technologies, Inc.
|
2949
2972
|
//
|
@@ -11840,7 +11863,7 @@ function getMatch(exp, ua) {
|
|
11840
11863
|
return match && match.length >= id && match[id] || '';
|
11841
11864
|
}
|
11842
11865
|
|
11843
|
-
var version$1 = "1.13.
|
11866
|
+
var version$1 = "1.13.3";
|
11844
11867
|
|
11845
11868
|
const version = version$1;
|
11846
11869
|
const protocolVersion = 9;
|
@@ -11914,7 +11937,7 @@ const VideoPresets43 = {
|
|
11914
11937
|
h120: new VideoPreset(160, 120, 70000, 20),
|
11915
11938
|
h180: new VideoPreset(240, 180, 125000, 20),
|
11916
11939
|
h240: new VideoPreset(320, 240, 140000, 20),
|
11917
|
-
h360: new VideoPreset(480, 360,
|
11940
|
+
h360: new VideoPreset(480, 360, 330000, 20),
|
11918
11941
|
h480: new VideoPreset(640, 480, 500000, 20),
|
11919
11942
|
h540: new VideoPreset(720, 540, 600000, 25),
|
11920
11943
|
h720: new VideoPreset(960, 720, 1300000, 30),
|
@@ -13212,12 +13235,12 @@ function createAudioAnalyser(track, options) {
|
|
13212
13235
|
const volume = Math.sqrt(sum / dataArray.length);
|
13213
13236
|
return volume;
|
13214
13237
|
};
|
13215
|
-
const cleanup = () => {
|
13216
|
-
audioContext.close();
|
13238
|
+
const cleanup = () => __awaiter(this, void 0, void 0, function* () {
|
13239
|
+
yield audioContext.close();
|
13217
13240
|
if (opts.cloneTrack) {
|
13218
13241
|
streamTrack.stop();
|
13219
13242
|
}
|
13220
|
-
};
|
13243
|
+
});
|
13221
13244
|
return {
|
13222
13245
|
calculateVolume,
|
13223
13246
|
analyser,
|
@@ -19153,8 +19176,8 @@ class Participant extends eventsExports.EventEmitter {
|
|
19153
19176
|
}
|
19154
19177
|
this.identity = info.identity;
|
19155
19178
|
this.sid = info.sid;
|
19156
|
-
this.
|
19157
|
-
this.
|
19179
|
+
this._setName(info.name);
|
19180
|
+
this._setMetadata(info.metadata);
|
19158
19181
|
if (info.permission) {
|
19159
19182
|
this.setPermissions(info.permission);
|
19160
19183
|
}
|
@@ -19165,8 +19188,10 @@ class Participant extends eventsExports.EventEmitter {
|
|
19165
19188
|
});
|
19166
19189
|
return true;
|
19167
19190
|
}
|
19168
|
-
/**
|
19169
|
-
|
19191
|
+
/**
|
19192
|
+
* Updates metadata from server
|
19193
|
+
**/
|
19194
|
+
_setMetadata(md) {
|
19170
19195
|
const changed = this.metadata !== md;
|
19171
19196
|
const prevMetadata = this.metadata;
|
19172
19197
|
this.metadata = md;
|
@@ -19174,7 +19199,7 @@ class Participant extends eventsExports.EventEmitter {
|
|
19174
19199
|
this.emit(ParticipantEvent.ParticipantMetadataChanged, prevMetadata);
|
19175
19200
|
}
|
19176
19201
|
}
|
19177
|
-
|
19202
|
+
_setName(name) {
|
19178
19203
|
const changed = this.name !== name;
|
19179
19204
|
this.name = name;
|
19180
19205
|
if (changed) {
|
@@ -19973,22 +19998,24 @@ class LocalParticipant extends Participant {
|
|
19973
19998
|
}
|
19974
19999
|
/**
|
19975
20000
|
* Sets and updates the metadata of the local participant.
|
19976
|
-
*
|
20001
|
+
* The change does not take immediate effect.
|
20002
|
+
* If successful, a `ParticipantEvent.MetadataChanged` event will be emitted on the local participant.
|
20003
|
+
* Note: this requires `canUpdateOwnMetadata` permission.
|
19977
20004
|
* @param metadata
|
19978
20005
|
*/
|
19979
20006
|
setMetadata(metadata) {
|
19980
20007
|
var _a;
|
19981
|
-
super.setMetadata(metadata);
|
19982
20008
|
this.engine.client.sendUpdateLocalMetadata(metadata, (_a = this.name) !== null && _a !== void 0 ? _a : '');
|
19983
20009
|
}
|
19984
20010
|
/**
|
19985
20011
|
* Sets and updates the name of the local participant.
|
19986
|
-
*
|
20012
|
+
* The change does not take immediate effect.
|
20013
|
+
* If successful, a `ParticipantEvent.ParticipantNameChanged` event will be emitted on the local participant.
|
20014
|
+
* Note: this requires `canUpdateOwnMetadata` permission.
|
19987
20015
|
* @param metadata
|
19988
20016
|
*/
|
19989
20017
|
setName(name) {
|
19990
20018
|
var _a;
|
19991
|
-
super.setName(name);
|
19992
20019
|
this.engine.client.sendUpdateLocalMetadata((_a = this.metadata) !== null && _a !== void 0 ? _a : '', name);
|
19993
20020
|
}
|
19994
20021
|
/**
|
@@ -20318,7 +20345,7 @@ class LocalParticipant extends Participant {
|
|
20318
20345
|
});
|
20319
20346
|
}
|
20320
20347
|
publish(track, opts, isStereo) {
|
20321
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
20348
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
20322
20349
|
return __awaiter(this, void 0, void 0, function* () {
|
20323
20350
|
const existingTrackOfSource = Array.from(this.tracks.values()).find(publishedTrack => track instanceof LocalTrack && publishedTrack.source === track.source);
|
20324
20351
|
if (existingTrackOfSource && track.source !== Track.Source.Unknown) {
|
@@ -20366,8 +20393,8 @@ class LocalParticipant extends Participant {
|
|
20366
20393
|
source: Track.sourceToProto(track.source),
|
20367
20394
|
disableDtx: !((_a = opts.dtx) !== null && _a !== void 0 ? _a : true),
|
20368
20395
|
encryption: this.encryptionType,
|
20369
|
-
stereo: isStereo
|
20370
|
-
|
20396
|
+
stereo: isStereo,
|
20397
|
+
disableRed: this.isE2EEEnabled || !((_b = opts.red) !== null && _b !== void 0 ? _b : true)
|
20371
20398
|
});
|
20372
20399
|
// compute encodings and layers for video
|
20373
20400
|
let encodings;
|
@@ -20382,7 +20409,7 @@ class LocalParticipant extends Participant {
|
|
20382
20409
|
} catch (e) {
|
20383
20410
|
// use defaults, it's quite painful for congestion control without simulcast
|
20384
20411
|
// so using default dims according to publish settings
|
20385
|
-
const defaultRes = (
|
20412
|
+
const defaultRes = (_d = (_c = this.roomOptions.videoCaptureDefaults) === null || _c === void 0 ? void 0 : _c.resolution) !== null && _d !== void 0 ? _d : VideoPresets.h720.resolution;
|
20386
20413
|
dims = {
|
20387
20414
|
width: defaultRes.width,
|
20388
20415
|
height: defaultRes.height
|
@@ -20397,7 +20424,7 @@ class LocalParticipant extends Participant {
|
|
20397
20424
|
if (track instanceof LocalVideoTrack) {
|
20398
20425
|
if (isSVCCodec(opts.videoCodec)) {
|
20399
20426
|
// set scalabilityMode to 'L3T3_KEY' by default
|
20400
|
-
opts.scalabilityMode = (
|
20427
|
+
opts.scalabilityMode = (_e = opts.scalabilityMode) !== null && _e !== void 0 ? _e : 'L3T3_KEY';
|
20401
20428
|
}
|
20402
20429
|
// set up backup
|
20403
20430
|
if (opts.videoCodec && opts.backupCodec && opts.videoCodec !== opts.backupCodec.codec) {
|
@@ -20422,7 +20449,7 @@ class LocalParticipant extends Participant {
|
|
20422
20449
|
req.simulcastCodecs = [new SimulcastCodec({
|
20423
20450
|
codec: opts.videoCodec,
|
20424
20451
|
cid: track.mediaStreamTrack.id,
|
20425
|
-
enableSimulcastLayers: (
|
20452
|
+
enableSimulcastLayers: (_f = opts.simulcast) !== null && _f !== void 0 ? _f : false
|
20426
20453
|
})];
|
20427
20454
|
}
|
20428
20455
|
}
|
@@ -20430,9 +20457,9 @@ class LocalParticipant extends Participant {
|
|
20430
20457
|
req.layers = videoLayersFromEncodings(req.width, req.height, encodings, isSVCCodec(opts.videoCodec));
|
20431
20458
|
} else if (track.kind === Track.Kind.Audio) {
|
20432
20459
|
encodings = [{
|
20433
|
-
maxBitrate: (
|
20434
|
-
priority: (
|
20435
|
-
networkPriority: (
|
20460
|
+
maxBitrate: (_h = (_g = opts.audioPreset) === null || _g === void 0 ? void 0 : _g.maxBitrate) !== null && _h !== void 0 ? _h : opts.audioBitrate,
|
20461
|
+
priority: (_k = (_j = opts.audioPreset) === null || _j === void 0 ? void 0 : _j.priority) !== null && _k !== void 0 ? _k : 'high',
|
20462
|
+
networkPriority: (_m = (_l = opts.audioPreset) === null || _l === void 0 ? void 0 : _l.priority) !== null && _m !== void 0 ? _m : 'high'
|
20436
20463
|
}];
|
20437
20464
|
}
|
20438
20465
|
if (!this.engine || this.engine.isClosed) {
|
@@ -20494,10 +20521,10 @@ class LocalParticipant extends Participant {
|
|
20494
20521
|
this.engine.publisher.setTrackCodecBitrate({
|
20495
20522
|
transceiver: trackTransceiver,
|
20496
20523
|
codec: 'opus',
|
20497
|
-
maxbr: ((
|
20524
|
+
maxbr: ((_o = encodings[0]) === null || _o === void 0 ? void 0 : _o.maxBitrate) ? encodings[0].maxBitrate / 1000 : 0
|
20498
20525
|
});
|
20499
20526
|
}
|
20500
|
-
} else if (track.codec && isSVCCodec(track.codec) && ((
|
20527
|
+
} else if (track.codec && isSVCCodec(track.codec) && ((_p = encodings[0]) === null || _p === void 0 ? void 0 : _p.maxBitrate)) {
|
20501
20528
|
this.engine.publisher.setTrackCodecBitrate({
|
20502
20529
|
cid: req.cid,
|
20503
20530
|
codec: track.codec,
|