livekit-client 2.19.0 → 2.19.2
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 +181 -122
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +517 -426
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.pt.worker.js +1 -1
- package/dist/livekit-client.pt.worker.js.map +1 -1
- package/dist/livekit-client.pt.worker.mjs +129 -95
- package/dist/livekit-client.pt.worker.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 +12 -2
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +8 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/rpc/client/RpcClientManager.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/e2ee/worker/FrameCryptor.d.ts +11 -1
- package/dist/ts4.2/room/RTCEngine.d.ts +8 -0
- package/dist/ts4.2/room/utils.d.ts +1 -0
- package/package.json +10 -8
- package/src/api/SignalClient.ts +1 -0
- package/src/e2ee/worker/FrameCryptor.ts +42 -7
- package/src/room/RTCEngine.ts +48 -20
- package/src/room/Room.test.ts +99 -1
- package/src/room/Room.ts +24 -7
- package/src/room/rpc/client/RpcClientManager.ts +5 -2
- package/src/room/utils.ts +5 -0
|
@@ -509,16 +509,15 @@ function int64ToString(lo, hi) {
|
|
|
509
509
|
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
|
|
510
510
|
*/
|
|
511
511
|
function uInt64ToString(lo, hi) {
|
|
512
|
-
({
|
|
513
|
-
lo,
|
|
514
|
-
hi
|
|
515
|
-
} = toUnsigned(lo, hi));
|
|
516
512
|
// Skip the expensive conversion if the number is small enough to use the
|
|
517
513
|
// built-in conversions.
|
|
518
514
|
// Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with
|
|
519
515
|
// highBits <= 0x1FFFFF can be safely expressed with a double and retain
|
|
520
516
|
// integer precision.
|
|
521
517
|
// Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.
|
|
518
|
+
var _toUnsigned = toUnsigned(lo, hi);
|
|
519
|
+
lo = _toUnsigned.lo;
|
|
520
|
+
hi = _toUnsigned.hi;
|
|
522
521
|
if (hi <= 0x1FFFFF) {
|
|
523
522
|
return String(TWO_PWR_32_DBL * hi + lo);
|
|
524
523
|
}
|
|
@@ -931,20 +930,76 @@ function isScalarZeroValue(type, value) {
|
|
|
931
930
|
return value == 0;
|
|
932
931
|
// Loose comparison matches 0n, 0 and "0"
|
|
933
932
|
}
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
933
|
+
}function _arrayLikeToArray(r, a) {
|
|
934
|
+
(null == a || a > r.length) && (a = r.length);
|
|
935
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
936
|
+
return n;
|
|
937
|
+
}
|
|
938
|
+
function _arrayWithHoles(r) {
|
|
939
|
+
if (Array.isArray(r)) return r;
|
|
940
|
+
}
|
|
941
|
+
function _defineProperty(e, r, t) {
|
|
942
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
943
|
+
value: t,
|
|
944
|
+
enumerable: true,
|
|
945
|
+
configurable: true,
|
|
946
|
+
writable: true
|
|
947
|
+
}) : e[r] = t, e;
|
|
948
|
+
}
|
|
949
|
+
function _iterableToArrayLimit(r, l) {
|
|
950
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
951
|
+
if (null != t) {
|
|
952
|
+
var e,
|
|
953
|
+
n,
|
|
954
|
+
i,
|
|
955
|
+
u,
|
|
956
|
+
a = [],
|
|
957
|
+
f = true,
|
|
958
|
+
o = false;
|
|
959
|
+
try {
|
|
960
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
961
|
+
if (Object(t) !== t) return;
|
|
962
|
+
f = !1;
|
|
963
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
964
|
+
} catch (r) {
|
|
965
|
+
o = true, n = r;
|
|
966
|
+
} finally {
|
|
967
|
+
try {
|
|
968
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
969
|
+
} finally {
|
|
970
|
+
if (o) throw n;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
return a;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
function _nonIterableRest() {
|
|
977
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
978
|
+
}
|
|
979
|
+
function _slicedToArray(r, e) {
|
|
980
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
981
|
+
}
|
|
982
|
+
function _toPrimitive(t, r) {
|
|
983
|
+
if ("object" != typeof t || !t) return t;
|
|
984
|
+
var e = t[Symbol.toPrimitive];
|
|
985
|
+
if (void 0 !== e) {
|
|
986
|
+
var i = e.call(t, r);
|
|
987
|
+
if ("object" != typeof i) return i;
|
|
988
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
989
|
+
}
|
|
990
|
+
return ("string" === r ? String : Number)(t);
|
|
991
|
+
}
|
|
992
|
+
function _toPropertyKey(t) {
|
|
993
|
+
var i = _toPrimitive(t, "string");
|
|
994
|
+
return "symbol" == typeof i ? i : i + "";
|
|
995
|
+
}
|
|
996
|
+
function _unsupportedIterableToArray(r, a) {
|
|
997
|
+
if (r) {
|
|
998
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
999
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
1000
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
1001
|
+
}
|
|
1002
|
+
}/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/restrict-plus-operands */
|
|
948
1003
|
/**
|
|
949
1004
|
* Protobuf binary format wire types.
|
|
950
1005
|
*
|
|
@@ -1256,7 +1311,10 @@ class BinaryReader {
|
|
|
1256
1311
|
break;
|
|
1257
1312
|
case WireType.StartGroup:
|
|
1258
1313
|
for (;;) {
|
|
1259
|
-
const
|
|
1314
|
+
const _this$tag = this.tag(),
|
|
1315
|
+
_this$tag2 = _slicedToArray(_this$tag, 2),
|
|
1316
|
+
fn = _this$tag2[0],
|
|
1317
|
+
wt = _this$tag2[1];
|
|
1260
1318
|
if (wt === WireType.EndGroup) {
|
|
1261
1319
|
if (fieldNo !== undefined && fn !== fieldNo) {
|
|
1262
1320
|
throw new Error("invalid end group tag");
|
|
@@ -1308,7 +1366,10 @@ class BinaryReader {
|
|
|
1308
1366
|
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
1309
1367
|
*/
|
|
1310
1368
|
sint64() {
|
|
1311
|
-
let
|
|
1369
|
+
let _this$varint = this.varint64(),
|
|
1370
|
+
_this$varint2 = _slicedToArray(_this$varint, 2),
|
|
1371
|
+
lo = _this$varint2[0],
|
|
1372
|
+
hi = _this$varint2[1];
|
|
1312
1373
|
// decode zig zag
|
|
1313
1374
|
let s = -(lo & 1);
|
|
1314
1375
|
lo = (lo >>> 1 | (hi & 1) << 31) ^ s;
|
|
@@ -1319,7 +1380,10 @@ class BinaryReader {
|
|
|
1319
1380
|
* Read a `bool` field, a variant.
|
|
1320
1381
|
*/
|
|
1321
1382
|
bool() {
|
|
1322
|
-
let
|
|
1383
|
+
let _this$varint3 = this.varint64(),
|
|
1384
|
+
_this$varint4 = _slicedToArray(_this$varint3, 2),
|
|
1385
|
+
lo = _this$varint4[0],
|
|
1386
|
+
hi = _this$varint4[1];
|
|
1323
1387
|
return lo !== 0 || hi !== 0;
|
|
1324
1388
|
}
|
|
1325
1389
|
/**
|
|
@@ -1580,20 +1644,7 @@ const protoBase64 = {
|
|
|
1580
1644
|
}
|
|
1581
1645
|
return base64;
|
|
1582
1646
|
}
|
|
1583
|
-
}
|
|
1584
|
-
//
|
|
1585
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
1586
|
-
// you may not use this file except in compliance with the License.
|
|
1587
|
-
// You may obtain a copy of the License at
|
|
1588
|
-
//
|
|
1589
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
1590
|
-
//
|
|
1591
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
1592
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
1593
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1594
|
-
// See the License for the specific language governing permissions and
|
|
1595
|
-
// limitations under the License.
|
|
1596
|
-
/**
|
|
1647
|
+
};/**
|
|
1597
1648
|
* Retrieve an extension value from a message.
|
|
1598
1649
|
*
|
|
1599
1650
|
* The function never returns undefined. Use hasExtension() to check whether an
|
|
@@ -1611,7 +1662,10 @@ function getExtension(message, extension, options) {
|
|
|
1611
1662
|
assertExtendee(extension, message);
|
|
1612
1663
|
const opt = extension.runtime.bin.makeReadOptions(options);
|
|
1613
1664
|
const ufs = filterUnknownFields(message.getType().runtime.bin.listUnknownFields(message), extension.field);
|
|
1614
|
-
const
|
|
1665
|
+
const _createExtensionConta = createExtensionContainer(extension),
|
|
1666
|
+
_createExtensionConta2 = _slicedToArray(_createExtensionConta, 2),
|
|
1667
|
+
container = _createExtensionConta2[0],
|
|
1668
|
+
get = _createExtensionConta2[1];
|
|
1615
1669
|
for (const uf of ufs) {
|
|
1616
1670
|
extension.runtime.bin.readField(container, opt.readerFactory(uf.data), extension.field, uf.wireType, opt);
|
|
1617
1671
|
}
|
|
@@ -1646,7 +1700,10 @@ function setExtension(message, extension, value, options) {
|
|
|
1646
1700
|
extension.runtime.bin.writeField(f, value, writer, writeOpt);
|
|
1647
1701
|
const reader = readOpt.readerFactory(writer.finish());
|
|
1648
1702
|
while (reader.pos < reader.len) {
|
|
1649
|
-
const
|
|
1703
|
+
const _reader$tag = reader.tag(),
|
|
1704
|
+
_reader$tag2 = _slicedToArray(_reader$tag, 2),
|
|
1705
|
+
no = _reader$tag2[0],
|
|
1706
|
+
wireType = _reader$tag2[1];
|
|
1650
1707
|
const data = reader.skip(wireType, no);
|
|
1651
1708
|
message.getType().runtime.bin.onUnknownField(message, no, wireType, data);
|
|
1652
1709
|
}
|
|
@@ -1807,20 +1864,7 @@ function wrapField(type, value) {
|
|
|
1807
1864
|
"google.protobuf.BoolValue": ScalarType.BOOL,
|
|
1808
1865
|
"google.protobuf.StringValue": ScalarType.STRING,
|
|
1809
1866
|
"google.protobuf.BytesValue": ScalarType.BYTES
|
|
1810
|
-
})
|
|
1811
|
-
//
|
|
1812
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
1813
|
-
// you may not use this file except in compliance with the License.
|
|
1814
|
-
// You may obtain a copy of the License at
|
|
1815
|
-
//
|
|
1816
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
1817
|
-
//
|
|
1818
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
1819
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
1820
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1821
|
-
// See the License for the specific language governing permissions and
|
|
1822
|
-
// limitations under the License.
|
|
1823
|
-
/* eslint-disable no-case-declarations,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
|
|
1867
|
+
});/* eslint-disable no-case-declarations,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
|
|
1824
1868
|
// Default options for parsing JSON.
|
|
1825
1869
|
const jsonReadDefaults = {
|
|
1826
1870
|
ignoreUnknownFields: false
|
|
@@ -1851,7 +1895,10 @@ function makeJsonFormat() {
|
|
|
1851
1895
|
message = message !== null && message !== void 0 ? message : new type();
|
|
1852
1896
|
const oneofSeen = new Map();
|
|
1853
1897
|
const registry = options.typeRegistry;
|
|
1854
|
-
for (const
|
|
1898
|
+
for (const _ref of Object.entries(json)) {
|
|
1899
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
1900
|
+
const jsonKey = _ref2[0];
|
|
1901
|
+
const jsonValue = _ref2[1];
|
|
1855
1902
|
const field = type.fields.findJsonName(jsonKey);
|
|
1856
1903
|
if (field) {
|
|
1857
1904
|
if (field.oneof) {
|
|
@@ -1872,7 +1919,10 @@ function makeJsonFormat() {
|
|
|
1872
1919
|
const ext = registry.findExtension(jsonKey.substring(1, jsonKey.length - 1));
|
|
1873
1920
|
if (ext && ext.extendee.typeName == type.typeName) {
|
|
1874
1921
|
found = true;
|
|
1875
|
-
const
|
|
1922
|
+
const _createExtensionConta = createExtensionContainer(ext),
|
|
1923
|
+
_createExtensionConta2 = _slicedToArray(_createExtensionConta, 2),
|
|
1924
|
+
container = _createExtensionConta2[0],
|
|
1925
|
+
get = _createExtensionConta2[1];
|
|
1876
1926
|
readField$1(container, jsonValue, ext.field, options, ext);
|
|
1877
1927
|
// We pass on the options as BinaryReadOptions/BinaryWriteOptions,
|
|
1878
1928
|
// so that users can bring their own binary reader and writer factories
|
|
@@ -2015,7 +2065,10 @@ function readField$1(target, jsonValue, field, options, parentType) {
|
|
|
2015
2065
|
throw new Error("cannot decode field ".concat(parentType.typeName, ".").concat(field.name, " from JSON: ").concat(debugJsonValue(jsonValue)));
|
|
2016
2066
|
}
|
|
2017
2067
|
const targetMap = target[localName];
|
|
2018
|
-
for (const
|
|
2068
|
+
for (const _ref3 of Object.entries(jsonValue)) {
|
|
2069
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
2070
|
+
const jsonMapKey = _ref4[0];
|
|
2071
|
+
const jsonMapValue = _ref4[1];
|
|
2019
2072
|
if (jsonMapValue === null) {
|
|
2020
2073
|
throw new Error("cannot decode field ".concat(parentType.typeName, ".").concat(field.name, " from JSON: map value null"));
|
|
2021
2074
|
}
|
|
@@ -2270,19 +2323,28 @@ function writeField$1(field, value, options) {
|
|
|
2270
2323
|
const entries = Object.entries(value);
|
|
2271
2324
|
switch (field.V.kind) {
|
|
2272
2325
|
case "scalar":
|
|
2273
|
-
for (const
|
|
2326
|
+
for (const _ref5 of entries) {
|
|
2327
|
+
var _ref6 = _slicedToArray(_ref5, 2);
|
|
2328
|
+
const entryKey = _ref6[0];
|
|
2329
|
+
const entryValue = _ref6[1];
|
|
2274
2330
|
jsonObj[entryKey.toString()] = writeScalar$1(field.V.T, entryValue); // JSON standard allows only (double quoted) string as property key
|
|
2275
2331
|
}
|
|
2276
2332
|
break;
|
|
2277
2333
|
case "message":
|
|
2278
|
-
for (const
|
|
2334
|
+
for (const _ref7 of entries) {
|
|
2335
|
+
var _ref8 = _slicedToArray(_ref7, 2);
|
|
2336
|
+
const entryKey = _ref8[0];
|
|
2337
|
+
const entryValue = _ref8[1];
|
|
2279
2338
|
// JSON standard allows only (double quoted) string as property key
|
|
2280
2339
|
jsonObj[entryKey.toString()] = entryValue.toJson(options);
|
|
2281
2340
|
}
|
|
2282
2341
|
break;
|
|
2283
2342
|
case "enum":
|
|
2284
2343
|
const enumType = field.V.T;
|
|
2285
|
-
for (const
|
|
2344
|
+
for (const _ref9 of entries) {
|
|
2345
|
+
var _ref0 = _slicedToArray(_ref9, 2);
|
|
2346
|
+
const entryKey = _ref0[0];
|
|
2347
|
+
const entryValue = _ref0[1];
|
|
2286
2348
|
// JSON standard allows only (double quoted) string as property key
|
|
2287
2349
|
jsonObj[entryKey.toString()] = writeEnum(enumType, entryValue, options.enumAsInteger);
|
|
2288
2350
|
}
|
|
@@ -2376,20 +2438,7 @@ function writeScalar$1(type, value) {
|
|
|
2376
2438
|
assert(value instanceof Uint8Array);
|
|
2377
2439
|
return protoBase64.enc(value);
|
|
2378
2440
|
}
|
|
2379
|
-
}
|
|
2380
|
-
//
|
|
2381
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
2382
|
-
// you may not use this file except in compliance with the License.
|
|
2383
|
-
// You may obtain a copy of the License at
|
|
2384
|
-
//
|
|
2385
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
2386
|
-
//
|
|
2387
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
2388
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
2389
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2390
|
-
// See the License for the specific language governing permissions and
|
|
2391
|
-
// limitations under the License.
|
|
2392
|
-
/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return */
|
|
2441
|
+
}/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return */
|
|
2393
2442
|
const unknownFieldsSymbol = Symbol("@bufbuild/protobuf/unknown-fields");
|
|
2394
2443
|
// Default options for parsing binary data.
|
|
2395
2444
|
const readDefaults = {
|
|
@@ -2444,7 +2493,10 @@ function makeBinaryFormat() {
|
|
|
2444
2493
|
const end = delimitedMessageEncoding ? reader.len : reader.pos + lengthOrEndTagFieldNo;
|
|
2445
2494
|
let fieldNo, wireType;
|
|
2446
2495
|
while (reader.pos < end) {
|
|
2447
|
-
|
|
2496
|
+
var _reader$tag = reader.tag();
|
|
2497
|
+
var _reader$tag2 = _slicedToArray(_reader$tag, 2);
|
|
2498
|
+
fieldNo = _reader$tag2[0];
|
|
2499
|
+
wireType = _reader$tag2[1];
|
|
2448
2500
|
if (delimitedMessageEncoding === true && wireType == WireType.EndGroup) {
|
|
2449
2501
|
break;
|
|
2450
2502
|
}
|
|
@@ -2497,10 +2549,8 @@ function makeBinaryFormat() {
|
|
|
2497
2549
|
function readField(target,
|
|
2498
2550
|
// eslint-disable-line @typescript-eslint/no-explicit-any -- `any` is the best choice for dynamic access
|
|
2499
2551
|
reader, field, wireType, options) {
|
|
2500
|
-
let
|
|
2501
|
-
|
|
2502
|
-
localName
|
|
2503
|
-
} = field;
|
|
2552
|
+
let repeated = field.repeated,
|
|
2553
|
+
localName = field.localName;
|
|
2504
2554
|
if (field.oneof) {
|
|
2505
2555
|
target = target[field.oneof.localName];
|
|
2506
2556
|
if (target.case != localName) {
|
|
@@ -2550,7 +2600,10 @@ reader, field, wireType, options) {
|
|
|
2550
2600
|
}
|
|
2551
2601
|
break;
|
|
2552
2602
|
case "map":
|
|
2553
|
-
let
|
|
2603
|
+
let _readMapEntry = readMapEntry(field, reader, options),
|
|
2604
|
+
_readMapEntry2 = _slicedToArray(_readMapEntry, 2),
|
|
2605
|
+
mapKey = _readMapEntry2[0],
|
|
2606
|
+
mapVal = _readMapEntry2[1];
|
|
2554
2607
|
// safe to assume presence of map object, oneof cannot contain repeated values
|
|
2555
2608
|
target[localName][mapKey] = mapVal;
|
|
2556
2609
|
break;
|
|
@@ -2572,7 +2625,9 @@ function readMapEntry(field, reader, options) {
|
|
|
2572
2625
|
end = reader.pos + length;
|
|
2573
2626
|
let key, val;
|
|
2574
2627
|
while (reader.pos < end) {
|
|
2575
|
-
const
|
|
2628
|
+
const _reader$tag3 = reader.tag(),
|
|
2629
|
+
_reader$tag4 = _slicedToArray(_reader$tag3, 1),
|
|
2630
|
+
fieldNo = _reader$tag4[0];
|
|
2576
2631
|
switch (fieldNo) {
|
|
2577
2632
|
case 1:
|
|
2578
2633
|
key = readScalar(reader, field.K);
|
|
@@ -2686,7 +2741,10 @@ function writeField(field, value, writer, options) {
|
|
|
2686
2741
|
break;
|
|
2687
2742
|
case "map":
|
|
2688
2743
|
assert(typeof value == "object" && value != null);
|
|
2689
|
-
for (const
|
|
2744
|
+
for (const _ref of Object.entries(value)) {
|
|
2745
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
2746
|
+
const key = _ref2[0];
|
|
2747
|
+
const val = _ref2[1];
|
|
2690
2748
|
writeMapEntry(writer, options, field, key, val);
|
|
2691
2749
|
}
|
|
2692
2750
|
break;
|
|
@@ -2737,7 +2795,10 @@ function writeMessageField(writer, options, field, value) {
|
|
|
2737
2795
|
}
|
|
2738
2796
|
function writeScalar(writer, type, fieldNo, value) {
|
|
2739
2797
|
assert(value !== undefined);
|
|
2740
|
-
let
|
|
2798
|
+
let _scalarTypeInfo = scalarTypeInfo(type),
|
|
2799
|
+
_scalarTypeInfo2 = _slicedToArray(_scalarTypeInfo, 2),
|
|
2800
|
+
wireType = _scalarTypeInfo2[0],
|
|
2801
|
+
method = _scalarTypeInfo2[1];
|
|
2741
2802
|
writer.tag(fieldNo, wireType)[method](value);
|
|
2742
2803
|
}
|
|
2743
2804
|
function writePacked(writer, type, fieldNo, value) {
|
|
@@ -2745,7 +2806,9 @@ function writePacked(writer, type, fieldNo, value) {
|
|
|
2745
2806
|
return;
|
|
2746
2807
|
}
|
|
2747
2808
|
writer.tag(fieldNo, WireType.LengthDelimited).fork();
|
|
2748
|
-
let
|
|
2809
|
+
let _scalarTypeInfo3 = scalarTypeInfo(type),
|
|
2810
|
+
_scalarTypeInfo4 = _slicedToArray(_scalarTypeInfo3, 2),
|
|
2811
|
+
method = _scalarTypeInfo4[1];
|
|
2749
2812
|
for (let i = 0; i < value.length; i++) {
|
|
2750
2813
|
writer[method](value[i]);
|
|
2751
2814
|
}
|
|
@@ -2783,20 +2846,7 @@ function scalarTypeInfo(type) {
|
|
|
2783
2846
|
}
|
|
2784
2847
|
const method = ScalarType[type].toLowerCase();
|
|
2785
2848
|
return [wireType, method];
|
|
2786
|
-
}
|
|
2787
|
-
//
|
|
2788
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
2789
|
-
// you may not use this file except in compliance with the License.
|
|
2790
|
-
// You may obtain a copy of the License at
|
|
2791
|
-
//
|
|
2792
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
2793
|
-
//
|
|
2794
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
2795
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
2796
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2797
|
-
// See the License for the specific language governing permissions and
|
|
2798
|
-
// limitations under the License.
|
|
2799
|
-
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
|
|
2849
|
+
}/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
|
|
2800
2850
|
function makeUtilCommon() {
|
|
2801
2851
|
return {
|
|
2802
2852
|
setEnumType,
|
|
@@ -2844,7 +2894,10 @@ function makeUtilCommon() {
|
|
|
2844
2894
|
case "scalar":
|
|
2845
2895
|
case "enum":
|
|
2846
2896
|
if (member.V.T === ScalarType.BYTES) {
|
|
2847
|
-
for (const
|
|
2897
|
+
for (const _ref of Object.entries(s[localName])) {
|
|
2898
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
2899
|
+
const k = _ref2[0];
|
|
2900
|
+
const v = _ref2[1];
|
|
2848
2901
|
t[localName][k] = toU8Arr(v);
|
|
2849
2902
|
}
|
|
2850
2903
|
} else {
|
|
@@ -2976,7 +3029,10 @@ function makeUtilCommon() {
|
|
|
2976
3029
|
copy = source.map(cloneSingularField);
|
|
2977
3030
|
} else if (member.kind == "map") {
|
|
2978
3031
|
copy = any[member.localName];
|
|
2979
|
-
for (const
|
|
3032
|
+
for (const _ref3 of Object.entries(source)) {
|
|
3033
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
3034
|
+
const key = _ref4[0];
|
|
3035
|
+
const v = _ref4[1];
|
|
2980
3036
|
copy[key] = cloneSingularField(v);
|
|
2981
3037
|
}
|
|
2982
3038
|
} else if (member.kind == "oneof") {
|
|
@@ -8874,9 +8930,7 @@ function detectBrowser(window) {
|
|
|
8874
8930
|
result.browser = 'Not a browser.';
|
|
8875
8931
|
return result;
|
|
8876
8932
|
}
|
|
8877
|
-
const
|
|
8878
|
-
navigator
|
|
8879
|
-
} = window;
|
|
8933
|
+
const navigator = window.navigator;
|
|
8880
8934
|
|
|
8881
8935
|
// Prefer navigator.userAgentData.
|
|
8882
8936
|
if (navigator.userAgentData && navigator.userAgentData.brands) {
|
|
@@ -9868,7 +9922,10 @@ function shimGetStats(window, browserDetails) {
|
|
|
9868
9922
|
};
|
|
9869
9923
|
const nativeGetStats = window.RTCPeerConnection.prototype.getStats;
|
|
9870
9924
|
window.RTCPeerConnection.prototype.getStats = function getStats() {
|
|
9871
|
-
const
|
|
9925
|
+
const _arguments = Array.prototype.slice.call(arguments),
|
|
9926
|
+
selector = _arguments[0],
|
|
9927
|
+
onSucc = _arguments[1],
|
|
9928
|
+
onErr = _arguments[2];
|
|
9872
9929
|
if (this.signalingState === 'closed') {
|
|
9873
9930
|
// No longer required in FF151+
|
|
9874
9931
|
return Promise.resolve(new Map());
|
|
@@ -10015,9 +10072,7 @@ function shimAddTransceiver(window) {
|
|
|
10015
10072
|
// Also note that after the createoffer we are not 100% sure that
|
|
10016
10073
|
// the params were asynchronously applied so we might miss the
|
|
10017
10074
|
// opportunity to recreate offer.
|
|
10018
|
-
const
|
|
10019
|
-
sender
|
|
10020
|
-
} = transceiver;
|
|
10075
|
+
const sender = transceiver.sender;
|
|
10021
10076
|
const params = sender.getParameters();
|
|
10022
10077
|
if (!('encodings' in params) ||
|
|
10023
10078
|
// Avoid being fooled by patched getParameters() below.
|
|
@@ -11324,9 +11379,8 @@ function shimMaxMessageSize(window, browserDetails) {
|
|
|
11324
11379
|
// As usual, adapter.js has to do an 'ugly worakaround'
|
|
11325
11380
|
// to cover up the mess.
|
|
11326
11381
|
if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {
|
|
11327
|
-
const
|
|
11328
|
-
sdpSemantics
|
|
11329
|
-
} = this.getConfiguration();
|
|
11382
|
+
const _this$getConfiguratio = this.getConfiguration(),
|
|
11383
|
+
sdpSemantics = _this$getConfiguratio.sdpSemantics;
|
|
11330
11384
|
if (sdpSemantics === 'plan-b') {
|
|
11331
11385
|
Object.defineProperty(this, 'sctp', {
|
|
11332
11386
|
get() {
|
|
@@ -11580,9 +11634,8 @@ function shimParameterlessSetLocalDescription(window, browserDetails) {
|
|
|
11580
11634
|
|
|
11581
11635
|
// Shimming starts here.
|
|
11582
11636
|
function adapterFactory() {
|
|
11583
|
-
let {
|
|
11584
|
-
window
|
|
11585
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11637
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
11638
|
+
window = _ref.window;
|
|
11586
11639
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
11587
11640
|
shimChrome: true,
|
|
11588
11641
|
shimFirefox: true,
|
|
@@ -11742,9 +11795,7 @@ function getBrowser(userAgent) {
|
|
|
11742
11795
|
const ua = (userAgent !== null && userAgent !== void 0 ? userAgent : navigator.userAgent).toLowerCase();
|
|
11743
11796
|
if (browserDetails === undefined || force) {
|
|
11744
11797
|
const browser = browsersList.find(_ref => {
|
|
11745
|
-
let
|
|
11746
|
-
test
|
|
11747
|
-
} = _ref;
|
|
11798
|
+
let test = _ref.test;
|
|
11748
11799
|
return test.test(ua);
|
|
11749
11800
|
});
|
|
11750
11801
|
browserDetails = browser === null || browser === void 0 ? void 0 : browser.describe(ua);
|
|
@@ -11793,7 +11844,7 @@ function getMatch(exp, ua) {
|
|
|
11793
11844
|
}
|
|
11794
11845
|
function getOSVersion(ua) {
|
|
11795
11846
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
|
11796
|
-
}var version$1 = "2.19.
|
|
11847
|
+
}var version$1 = "2.19.2";const version = version$1;
|
|
11797
11848
|
const protocolVersion = 17;
|
|
11798
11849
|
/** Initial client protocol. */
|
|
11799
11850
|
const CLIENT_PROTOCOL_DEFAULT = 0;
|
|
@@ -12765,11 +12816,10 @@ const ScreenSharePresets = {
|
|
|
12765
12816
|
};function mergeDefaultOptions(options, audioDefaults, videoDefaults) {
|
|
12766
12817
|
var _a, _b;
|
|
12767
12818
|
var _c, _d;
|
|
12768
|
-
const {
|
|
12769
|
-
optionsWithoutProcessor,
|
|
12770
|
-
audioProcessor,
|
|
12771
|
-
videoProcessor
|
|
12772
|
-
} = extractProcessorsFromOptions(options !== null && options !== void 0 ? options : {});
|
|
12819
|
+
const _extractProcessorsFro = extractProcessorsFromOptions(options !== null && options !== void 0 ? options : {}),
|
|
12820
|
+
optionsWithoutProcessor = _extractProcessorsFro.optionsWithoutProcessor,
|
|
12821
|
+
audioProcessor = _extractProcessorsFro.audioProcessor,
|
|
12822
|
+
videoProcessor = _extractProcessorsFro.videoProcessor;
|
|
12773
12823
|
const defaultAudioProcessor = audioDefaults === null || audioDefaults === void 0 ? void 0 : audioDefaults.processor;
|
|
12774
12824
|
const defaultVideoProcessor = videoDefaults === null || videoDefaults === void 0 ? void 0 : videoDefaults.processor;
|
|
12775
12825
|
const clonedOptions = optionsWithoutProcessor !== null && optionsWithoutProcessor !== void 0 ? optionsWithoutProcessor : {};
|
|
@@ -13769,7 +13819,9 @@ function createDummyVideoStreamTrack() {
|
|
|
13769
13819
|
}
|
|
13770
13820
|
// @ts-ignore
|
|
13771
13821
|
const dummyStream = canvas.captureStream();
|
|
13772
|
-
const
|
|
13822
|
+
const _dummyStream$getTrack = dummyStream.getTracks(),
|
|
13823
|
+
_dummyStream$getTrack2 = _slicedToArray(_dummyStream$getTrack, 1),
|
|
13824
|
+
dummyTrack = _dummyStream$getTrack2[0];
|
|
13773
13825
|
if (!dummyTrack) {
|
|
13774
13826
|
throw Error('Could not get empty media stream video track');
|
|
13775
13827
|
}
|
|
@@ -13788,7 +13840,9 @@ function getEmptyAudioStreamTrack() {
|
|
|
13788
13840
|
oscillator.connect(gain);
|
|
13789
13841
|
gain.connect(dst);
|
|
13790
13842
|
oscillator.start();
|
|
13791
|
-
|
|
13843
|
+
var _dst$stream$getAudioT = dst.stream.getAudioTracks();
|
|
13844
|
+
var _dst$stream$getAudioT2 = _slicedToArray(_dst$stream$getAudioT, 1);
|
|
13845
|
+
emptyAudioStreamTrack = _dst$stream$getAudioT2[0];
|
|
13792
13846
|
if (!emptyAudioStreamTrack) {
|
|
13793
13847
|
throw Error('Could not get empty media stream audio track');
|
|
13794
13848
|
}
|
|
@@ -13911,14 +13965,12 @@ function toHttpUrl(url) {
|
|
|
13911
13965
|
}
|
|
13912
13966
|
function extractTranscriptionSegments(transcription, firstReceivedTimesMap) {
|
|
13913
13967
|
return transcription.segments.map(_ref => {
|
|
13914
|
-
let
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
final
|
|
13921
|
-
} = _ref;
|
|
13968
|
+
let id = _ref.id,
|
|
13969
|
+
text = _ref.text,
|
|
13970
|
+
language = _ref.language,
|
|
13971
|
+
startTime = _ref.startTime,
|
|
13972
|
+
endTime = _ref.endTime,
|
|
13973
|
+
final = _ref.final;
|
|
13922
13974
|
var _a;
|
|
13923
13975
|
const firstReceivedTime = (_a = firstReceivedTimesMap.get(id)) !== null && _a !== void 0 ? _a : Date.now();
|
|
13924
13976
|
const lastReceivedTime = Date.now();
|
|
@@ -13940,12 +13992,10 @@ function extractTranscriptionSegments(transcription, firstReceivedTimesMap) {
|
|
|
13940
13992
|
});
|
|
13941
13993
|
}
|
|
13942
13994
|
function extractChatMessage(msg) {
|
|
13943
|
-
const
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
editTimestamp
|
|
13948
|
-
} = msg;
|
|
13995
|
+
const id = msg.id,
|
|
13996
|
+
timestamp = msg.timestamp,
|
|
13997
|
+
message = msg.message,
|
|
13998
|
+
editTimestamp = msg.editTimestamp;
|
|
13949
13999
|
return {
|
|
13950
14000
|
id,
|
|
13951
14001
|
timestamp: Number.parseInt(timestamp.toString()),
|
|
@@ -14039,6 +14089,10 @@ function extractMaxAgeFromRequestHeaders(headers) {
|
|
|
14039
14089
|
}
|
|
14040
14090
|
function isCompressionStreamSupported() {
|
|
14041
14091
|
return typeof CompressionStream !== 'undefined';
|
|
14092
|
+
}
|
|
14093
|
+
function isPublisherOfferWithJoinSupported() {
|
|
14094
|
+
// we have connectivity issue about publisher offer with join on firefox #1919
|
|
14095
|
+
return isCompressionStreamSupported() && !isFireFox();
|
|
14042
14096
|
}function createRtcUrl(url, searchParams) {
|
|
14043
14097
|
let useV0Path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14044
14098
|
const v0Url = createV0RtcUrl(url, searchParams);
|
|
@@ -14482,9 +14536,7 @@ function debounce(func) {
|
|
|
14482
14536
|
callback && callback(result);
|
|
14483
14537
|
// biome-ignore lint/suspicious/useIterableCallbackReturn: vendored code
|
|
14484
14538
|
promises.forEach(_ref => {
|
|
14485
|
-
let
|
|
14486
|
-
resolve
|
|
14487
|
-
} = _ref;
|
|
14539
|
+
let resolve = _ref.resolve;
|
|
14488
14540
|
return resolve(result);
|
|
14489
14541
|
});
|
|
14490
14542
|
promises = [];
|
|
@@ -14512,9 +14564,7 @@ function debounce(func) {
|
|
|
14512
14564
|
}
|
|
14513
14565
|
// biome-ignore lint/suspicious/useIterableCallbackReturn: vendored code
|
|
14514
14566
|
promises.forEach(_ref2 => {
|
|
14515
|
-
let
|
|
14516
|
-
reject
|
|
14517
|
-
} = _ref2;
|
|
14567
|
+
let reject = _ref2.reject;
|
|
14518
14568
|
return reject(reason);
|
|
14519
14569
|
});
|
|
14520
14570
|
promises = [];
|
|
@@ -14644,10 +14694,8 @@ function computeBitrate(currentStats, prevStats) {
|
|
|
14644
14694
|
this.timeSyncHandle = requestAnimationFrame(() => loop());
|
|
14645
14695
|
const sources = (_a = this.receiver) === null || _a === void 0 ? void 0 : _a.getSynchronizationSources()[0];
|
|
14646
14696
|
if (sources) {
|
|
14647
|
-
const
|
|
14648
|
-
|
|
14649
|
-
rtpTimestamp
|
|
14650
|
-
} = sources;
|
|
14697
|
+
const timestamp = sources.timestamp,
|
|
14698
|
+
rtpTimestamp = sources.rtpTimestamp;
|
|
14651
14699
|
if (rtpTimestamp && this.rtpTimestamp !== rtpTimestamp) {
|
|
14652
14700
|
this.emit(TrackEvent.TimeSyncUpdate, {
|
|
14653
14701
|
timestamp,
|
|
@@ -14693,9 +14741,7 @@ class RemoteVideoTrack extends RemoteTrack {
|
|
|
14693
14741
|
*
|
|
14694
14742
|
*/
|
|
14695
14743
|
lookupFrameMetadata(_ref) {
|
|
14696
|
-
let
|
|
14697
|
-
rtpTimestamp
|
|
14698
|
-
} = _ref;
|
|
14744
|
+
let rtpTimestamp = _ref.rtpTimestamp;
|
|
14699
14745
|
var _a;
|
|
14700
14746
|
return (_a = this.packetTrailerExtractor) === null || _a === void 0 ? void 0 : _a.lookupMetadata(rtpTimestamp);
|
|
14701
14747
|
}
|
|
@@ -14927,10 +14973,8 @@ class HTMLElementInfo {
|
|
|
14927
14973
|
constructor(element, visible) {
|
|
14928
14974
|
this.onVisibilityChanged = entry => {
|
|
14929
14975
|
var _a;
|
|
14930
|
-
const
|
|
14931
|
-
|
|
14932
|
-
isIntersecting
|
|
14933
|
-
} = entry;
|
|
14976
|
+
const target = entry.target,
|
|
14977
|
+
isIntersecting = entry.isIntersecting;
|
|
14934
14978
|
if (target === this.element) {
|
|
14935
14979
|
this.isIntersecting = isIntersecting;
|
|
14936
14980
|
this.isPiP = isElementInPiP(this.element);
|
|
@@ -15009,12 +15053,10 @@ function isElementInViewport(el, win) {
|
|
|
15009
15053
|
let left = el.offsetLeft;
|
|
15010
15054
|
const width = el.offsetWidth;
|
|
15011
15055
|
const height = el.offsetHeight;
|
|
15012
|
-
const
|
|
15013
|
-
hidden
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
display
|
|
15017
|
-
} = getComputedStyle(el);
|
|
15056
|
+
const _el = el,
|
|
15057
|
+
hidden = _el.hidden;
|
|
15058
|
+
const _getComputedStyle = getComputedStyle(el),
|
|
15059
|
+
display = _getComputedStyle.display;
|
|
15018
15060
|
while (el.offsetParent) {
|
|
15019
15061
|
el = el.offsetParent;
|
|
15020
15062
|
top += el.offsetTop;
|
|
@@ -15031,10 +15073,9 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15031
15073
|
this.encryptDataRequests = new Map();
|
|
15032
15074
|
this.onWorkerMessage = ev => {
|
|
15033
15075
|
var _a, _b;
|
|
15034
|
-
const
|
|
15035
|
-
kind,
|
|
15036
|
-
data
|
|
15037
|
-
} = ev.data;
|
|
15076
|
+
const _ev$data = ev.data,
|
|
15077
|
+
kind = _ev$data.kind,
|
|
15078
|
+
data = _ev$data.data;
|
|
15038
15079
|
switch (kind) {
|
|
15039
15080
|
case 'error':
|
|
15040
15081
|
livekitLogger.error(data.error.message);
|
|
@@ -15294,11 +15335,9 @@ class E2EEManager extends eventsExports.EventEmitter {
|
|
|
15294
15335
|
this.worker.postMessage(msg);
|
|
15295
15336
|
}
|
|
15296
15337
|
postKey(_ref, updateCurrentKeyIndex) {
|
|
15297
|
-
let
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
keyIndex
|
|
15301
|
-
} = _ref;
|
|
15338
|
+
let key = _ref.key,
|
|
15339
|
+
participantIdentity = _ref.participantIdentity,
|
|
15340
|
+
keyIndex = _ref.keyIndex;
|
|
15302
15341
|
var _a;
|
|
15303
15342
|
if (!this.worker) {
|
|
15304
15343
|
throw Error('could not set key, worker is missing');
|
|
@@ -16148,10 +16187,9 @@ class WebSocketStream {
|
|
|
16148
16187
|
ws.binaryType = 'arraybuffer';
|
|
16149
16188
|
this.ws = ws;
|
|
16150
16189
|
const closeWithInfo = function () {
|
|
16151
|
-
let {
|
|
16152
|
-
closeCode
|
|
16153
|
-
reason
|
|
16154
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16190
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
16191
|
+
code = _ref.closeCode,
|
|
16192
|
+
reason = _ref.reason;
|
|
16155
16193
|
return ws.close(code, reason);
|
|
16156
16194
|
};
|
|
16157
16195
|
this.opened = new TypedPromise((resolve, reject) => {
|
|
@@ -16162,10 +16200,8 @@ class WebSocketStream {
|
|
|
16162
16200
|
resolve({
|
|
16163
16201
|
readable: new ReadableStream({
|
|
16164
16202
|
start(controller) {
|
|
16165
|
-
ws.onmessage =
|
|
16166
|
-
let
|
|
16167
|
-
data
|
|
16168
|
-
} = _ref;
|
|
16203
|
+
ws.onmessage = _ref2 => {
|
|
16204
|
+
let data = _ref2.data;
|
|
16169
16205
|
return controller.enqueue(data);
|
|
16170
16206
|
};
|
|
16171
16207
|
ws.onerror = e => controller.error(e);
|
|
@@ -16207,11 +16243,9 @@ class WebSocketStream {
|
|
|
16207
16243
|
resolve(reason);
|
|
16208
16244
|
}
|
|
16209
16245
|
});
|
|
16210
|
-
ws.onclose =
|
|
16211
|
-
let
|
|
16212
|
-
|
|
16213
|
-
reason
|
|
16214
|
-
} = _ref2;
|
|
16246
|
+
ws.onclose = _ref3 => {
|
|
16247
|
+
let code = _ref3.code,
|
|
16248
|
+
reason = _ref3.reason;
|
|
16215
16249
|
resolve({
|
|
16216
16250
|
closeCode: code,
|
|
16217
16251
|
reason
|
|
@@ -16482,10 +16516,9 @@ class SignalClient {
|
|
|
16482
16516
|
if (this.signalLatency) {
|
|
16483
16517
|
yield sleep(this.signalLatency);
|
|
16484
16518
|
}
|
|
16485
|
-
const
|
|
16486
|
-
done,
|
|
16487
|
-
value
|
|
16488
|
-
} = yield signalReader.read();
|
|
16519
|
+
const _yield$signalReader$r = yield signalReader.read(),
|
|
16520
|
+
done = _yield$signalReader$r.done,
|
|
16521
|
+
value = _yield$signalReader$r.value;
|
|
16489
16522
|
if (done) {
|
|
16490
16523
|
break;
|
|
16491
16524
|
}
|
|
@@ -17077,6 +17110,7 @@ function createConnectionParams(token, info, opts) {
|
|
|
17077
17110
|
params.set('sdk', isReactNative() ? 'reactnative' : 'js');
|
|
17078
17111
|
params.set('version', info.version);
|
|
17079
17112
|
params.set('protocol', info.protocol.toString());
|
|
17113
|
+
params.set('client_protocol', info.clientProtocol.toString());
|
|
17080
17114
|
if (info.deviceModel) {
|
|
17081
17115
|
params.set('device_model', info.deviceModel);
|
|
17082
17116
|
}
|
|
@@ -17133,10 +17167,9 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
|
|
|
17133
17167
|
const chunks = [];
|
|
17134
17168
|
const reader = stream.readable.getReader();
|
|
17135
17169
|
while (true) {
|
|
17136
|
-
const
|
|
17137
|
-
done,
|
|
17138
|
-
value
|
|
17139
|
-
} = yield reader.read();
|
|
17170
|
+
const _yield$reader$read = yield reader.read(),
|
|
17171
|
+
done = _yield$reader$read.done,
|
|
17172
|
+
value = _yield$reader$read.value;
|
|
17140
17173
|
if (done) break;
|
|
17141
17174
|
chunks.push(value);
|
|
17142
17175
|
}
|
|
@@ -17253,7 +17286,10 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
|
|
|
17253
17286
|
}
|
|
17254
17287
|
cleanup() {
|
|
17255
17288
|
const now = Date.now();
|
|
17256
|
-
for (const
|
|
17289
|
+
for (const _ref of this._map.entries()) {
|
|
17290
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
17291
|
+
const key = _ref2[0];
|
|
17292
|
+
const entry = _ref2[1];
|
|
17257
17293
|
if (entry.expiresAt < now) {
|
|
17258
17294
|
this._map.delete(key);
|
|
17259
17295
|
}
|
|
@@ -17266,7 +17302,10 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
|
|
|
17266
17302
|
}
|
|
17267
17303
|
forEach(callback) {
|
|
17268
17304
|
this.cleanup();
|
|
17269
|
-
for (const
|
|
17305
|
+
for (const _ref3 of this._map.entries()) {
|
|
17306
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
17307
|
+
const key = _ref4[0];
|
|
17308
|
+
const entry = _ref4[1];
|
|
17270
17309
|
if (entry.expiresAt >= Date.now()) {
|
|
17271
17310
|
callback(entry.value, key, this.asValueMap());
|
|
17272
17311
|
}
|
|
@@ -17276,14 +17315,20 @@ function createJoinRequestConnectionParams(token, info, opts, publisherOffer) {
|
|
|
17276
17315
|
this.cleanup();
|
|
17277
17316
|
const result = [];
|
|
17278
17317
|
const valueMap = this.asValueMap();
|
|
17279
|
-
for (const
|
|
17318
|
+
for (const _ref5 of valueMap.entries()) {
|
|
17319
|
+
var _ref6 = _slicedToArray(_ref5, 2);
|
|
17320
|
+
const key = _ref6[0];
|
|
17321
|
+
const value = _ref6[1];
|
|
17280
17322
|
result.push(callback(value, key, valueMap));
|
|
17281
17323
|
}
|
|
17282
17324
|
return result;
|
|
17283
17325
|
}
|
|
17284
17326
|
asValueMap() {
|
|
17285
17327
|
const result = new Map();
|
|
17286
|
-
for (const
|
|
17328
|
+
for (const _ref7 of this._map.entries()) {
|
|
17329
|
+
var _ref8 = _slicedToArray(_ref7, 2);
|
|
17330
|
+
const key = _ref8[0];
|
|
17331
|
+
const entry = _ref8[1];
|
|
17287
17332
|
if (entry.expiresAt >= Date.now()) {
|
|
17288
17333
|
result.set(key, entry.value);
|
|
17289
17334
|
}
|
|
@@ -17735,7 +17780,7 @@ function requireGrammar() {
|
|
|
17735
17780
|
function requireParser() {
|
|
17736
17781
|
if (hasRequiredParser) return parser;
|
|
17737
17782
|
hasRequiredParser = 1;
|
|
17738
|
-
(function (exports
|
|
17783
|
+
(function (exports) {
|
|
17739
17784
|
var toIntIfInt = function (v) {
|
|
17740
17785
|
return String(Number(v)) === v ? Number(v) : v;
|
|
17741
17786
|
};
|
|
@@ -17768,7 +17813,7 @@ function requireParser() {
|
|
|
17768
17813
|
};
|
|
17769
17814
|
var grammar = requireGrammar();
|
|
17770
17815
|
var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
|
|
17771
|
-
exports
|
|
17816
|
+
exports.parse = function (sdp) {
|
|
17772
17817
|
var session = {},
|
|
17773
17818
|
media = [],
|
|
17774
17819
|
location = session; // points at where properties go under (one of the above)
|
|
@@ -17803,16 +17848,16 @@ function requireParser() {
|
|
|
17803
17848
|
}
|
|
17804
17849
|
return acc;
|
|
17805
17850
|
};
|
|
17806
|
-
exports
|
|
17851
|
+
exports.parseParams = function (str) {
|
|
17807
17852
|
return str.split(/;\s?/).reduce(paramReducer, {});
|
|
17808
17853
|
};
|
|
17809
17854
|
|
|
17810
17855
|
// For backward compatibility - alias will be removed in 3.0.0
|
|
17811
|
-
exports
|
|
17812
|
-
exports
|
|
17856
|
+
exports.parseFmtpConfig = exports.parseParams;
|
|
17857
|
+
exports.parsePayloads = function (str) {
|
|
17813
17858
|
return str.toString().split(' ').map(Number);
|
|
17814
17859
|
};
|
|
17815
|
-
exports
|
|
17860
|
+
exports.parseRemoteCandidates = function (str) {
|
|
17816
17861
|
var candidates = [];
|
|
17817
17862
|
var parts = str.split(' ').map(toIntIfInt);
|
|
17818
17863
|
for (var i = 0; i < parts.length; i += 3) {
|
|
@@ -17824,12 +17869,12 @@ function requireParser() {
|
|
|
17824
17869
|
}
|
|
17825
17870
|
return candidates;
|
|
17826
17871
|
};
|
|
17827
|
-
exports
|
|
17872
|
+
exports.parseImageAttributes = function (str) {
|
|
17828
17873
|
return str.split(' ').map(function (item) {
|
|
17829
17874
|
return item.substring(1, item.length - 1).split(',').reduce(paramReducer, {});
|
|
17830
17875
|
});
|
|
17831
17876
|
};
|
|
17832
|
-
exports
|
|
17877
|
+
exports.parseSimulcastStreamList = function (str) {
|
|
17833
17878
|
return str.split(';').map(function (stream) {
|
|
17834
17879
|
return stream.split(',').map(function (format) {
|
|
17835
17880
|
var scid,
|
|
@@ -18108,10 +18153,9 @@ class PCTransport extends eventsExports.EventEmitter {
|
|
|
18108
18153
|
}
|
|
18109
18154
|
let mungedSDP = undefined;
|
|
18110
18155
|
if (sd.type === 'offer') {
|
|
18111
|
-
let
|
|
18112
|
-
stereoMids,
|
|
18113
|
-
nackMids
|
|
18114
|
-
} = extractStereoAndNackAudioFromOffer(sd);
|
|
18156
|
+
let _extractStereoAndNack = extractStereoAndNackAudioFromOffer(sd),
|
|
18157
|
+
stereoMids = _extractStereoAndNack.stereoMids,
|
|
18158
|
+
nackMids = _extractStereoAndNack.nackMids;
|
|
18115
18159
|
this.remoteStereoMids = stereoMids;
|
|
18116
18160
|
this.remoteNackMids = nackMids;
|
|
18117
18161
|
} else if (sd.type === 'answer') {
|
|
@@ -19118,10 +19162,9 @@ class LocalTrack extends Track {
|
|
|
19118
19162
|
if (this.kind !== Track.Kind.Video) {
|
|
19119
19163
|
return undefined;
|
|
19120
19164
|
}
|
|
19121
|
-
const
|
|
19122
|
-
width,
|
|
19123
|
-
height
|
|
19124
|
-
} = this._mediaStreamTrack.getSettings();
|
|
19165
|
+
const _this$_mediaStreamTra = this._mediaStreamTrack.getSettings(),
|
|
19166
|
+
width = _this$_mediaStreamTra.width,
|
|
19167
|
+
height = _this$_mediaStreamTra.height;
|
|
19125
19168
|
if (width && height) {
|
|
19126
19169
|
return {
|
|
19127
19170
|
width,
|
|
@@ -19272,10 +19315,9 @@ class LocalTrack extends Track {
|
|
|
19272
19315
|
if (_this2.source === Track.Source.ScreenShare) {
|
|
19273
19316
|
return;
|
|
19274
19317
|
}
|
|
19275
|
-
const
|
|
19276
|
-
deviceId,
|
|
19277
|
-
groupId
|
|
19278
|
-
} = _this2._mediaStreamTrack.getSettings();
|
|
19318
|
+
const _this2$_mediaStreamTr = _this2._mediaStreamTrack.getSettings(),
|
|
19319
|
+
deviceId = _this2$_mediaStreamTr.deviceId,
|
|
19320
|
+
groupId = _this2$_mediaStreamTr.groupId;
|
|
19279
19321
|
const kind = _this2.kind === Track.Kind.Audio ? 'audioinput' : 'videoinput';
|
|
19280
19322
|
return normalize ? DeviceManager.getInstance().normalizeDeviceId(kind, deviceId, groupId) : deviceId;
|
|
19281
19323
|
}();
|
|
@@ -19343,10 +19385,9 @@ class LocalTrack extends Track {
|
|
|
19343
19385
|
if (!constraints) {
|
|
19344
19386
|
constraints = this._constraints;
|
|
19345
19387
|
}
|
|
19346
|
-
const
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
} = constraints,
|
|
19388
|
+
const _constraints = constraints,
|
|
19389
|
+
deviceId = _constraints.deviceId,
|
|
19390
|
+
facingMode = _constraints.facingMode,
|
|
19350
19391
|
otherConstraints = __rest(constraints, ["deviceId", "facingMode"]);
|
|
19351
19392
|
this.log.debug('restarting track with constraints', Object.assign(Object.assign({}, this.logContext), {
|
|
19352
19393
|
constraints
|
|
@@ -20028,7 +20069,9 @@ function computeVideoEncodings(isScreenShare, width, height, options) {
|
|
|
20028
20069
|
if (presets.length > 0) {
|
|
20029
20070
|
const lowPreset = presets[0];
|
|
20030
20071
|
if (presets.length > 1) {
|
|
20031
|
-
|
|
20072
|
+
var _presets = presets;
|
|
20073
|
+
var _presets2 = _slicedToArray(_presets, 2);
|
|
20074
|
+
midPreset = _presets2[1];
|
|
20032
20075
|
}
|
|
20033
20076
|
// NOTE:
|
|
20034
20077
|
// 1. Ordering of these encodings is important. Chrome seems
|
|
@@ -20078,9 +20121,7 @@ function computeTrackBackupEncodings(track, videoCodec, opts) {
|
|
|
20078
20121
|
/* @internal */
|
|
20079
20122
|
function determineAppropriateEncoding(isScreenShare, width, height, codec) {
|
|
20080
20123
|
const presets = presetsForResolution(isScreenShare, width, height);
|
|
20081
|
-
let
|
|
20082
|
-
encoding
|
|
20083
|
-
} = presets[0];
|
|
20124
|
+
let encoding = presets[0].encoding;
|
|
20084
20125
|
// handle portrait by swapping dimensions
|
|
20085
20126
|
const size = Math.max(width, height);
|
|
20086
20127
|
for (let i = 0; i < presets.length; i += 1) {
|
|
@@ -20126,10 +20167,8 @@ function defaultSimulcastLayers(isScreenShare, original) {
|
|
|
20126
20167
|
if (isScreenShare) {
|
|
20127
20168
|
return computeDefaultScreenShareSimulcastPresets(original);
|
|
20128
20169
|
}
|
|
20129
|
-
const
|
|
20130
|
-
|
|
20131
|
-
height
|
|
20132
|
-
} = original;
|
|
20170
|
+
const width = original.width,
|
|
20171
|
+
height = original.height;
|
|
20133
20172
|
const aspect = width > height ? width / height : height / width;
|
|
20134
20173
|
if (Math.abs(aspect - 16.0 / 9) < Math.abs(aspect - 4.0 / 3)) {
|
|
20135
20174
|
return defaultSimulcastPresets169;
|
|
@@ -20193,12 +20232,8 @@ function encodingsFromPresets(width, height, presets, sourceFramerate) {
|
|
|
20193
20232
|
function sortPresets(presets) {
|
|
20194
20233
|
if (!presets) return;
|
|
20195
20234
|
return presets.sort((a, b) => {
|
|
20196
|
-
const
|
|
20197
|
-
|
|
20198
|
-
} = a;
|
|
20199
|
-
const {
|
|
20200
|
-
encoding: bEnc
|
|
20201
|
-
} = b;
|
|
20235
|
+
const aEnc = a.encoding;
|
|
20236
|
+
const bEnc = b.encoding;
|
|
20202
20237
|
if (aEnc.maxBitrate > bEnc.maxBitrate) {
|
|
20203
20238
|
return 1;
|
|
20204
20239
|
}
|
|
@@ -20591,7 +20626,10 @@ class LocalVideoTrack extends LocalTrack {
|
|
|
20591
20626
|
yield this.applyEncodingsToSender(this.sender, newEncodings);
|
|
20592
20627
|
this.encodings = newEncodings;
|
|
20593
20628
|
this.lastEncodedDimensions = dims;
|
|
20594
|
-
for (const
|
|
20629
|
+
for (const _ref of this.simulcastCodecs) {
|
|
20630
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
20631
|
+
const codec = _ref2[0];
|
|
20632
|
+
const sc = _ref2[1];
|
|
20595
20633
|
if (!sc.sender || ((_a = sc.sender.transport) === null || _a === void 0 ? void 0 : _a.state) === 'closed') {
|
|
20596
20634
|
continue;
|
|
20597
20635
|
}
|
|
@@ -20873,9 +20911,7 @@ function setPublishingLayersForSender(sender, senderEncodings, qualities, sender
|
|
|
20873
20911
|
}));
|
|
20874
20912
|
try {
|
|
20875
20913
|
const params = sender.getParameters();
|
|
20876
|
-
const
|
|
20877
|
-
encodings
|
|
20878
|
-
} = params;
|
|
20914
|
+
const encodings = params.encodings;
|
|
20879
20915
|
if (!encodings) {
|
|
20880
20916
|
return;
|
|
20881
20917
|
}
|
|
@@ -21073,9 +21109,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21073
21109
|
this.bufferStatusLowClosingFuture = new Future();
|
|
21074
21110
|
this.handleDataChannel = _a => __awaiter(this, [_a], void 0, function (_ref) {
|
|
21075
21111
|
var _this = this;
|
|
21076
|
-
let
|
|
21077
|
-
channel
|
|
21078
|
-
} = _ref;
|
|
21112
|
+
let channel = _ref.channel;
|
|
21079
21113
|
return function* () {
|
|
21080
21114
|
if (!channel) {
|
|
21081
21115
|
return;
|
|
@@ -21173,9 +21207,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21173
21207
|
const channel = event.currentTarget;
|
|
21174
21208
|
const channelKind = channel.maxRetransmits === 0 ? 'lossy' : 'reliable';
|
|
21175
21209
|
if (event instanceof ErrorEvent && event.error) {
|
|
21176
|
-
const
|
|
21177
|
-
error
|
|
21178
|
-
} = event.error;
|
|
21210
|
+
const error = event.error.error;
|
|
21179
21211
|
this.log.error("DataChannel error on ".concat(channelKind, ": ").concat(event.message), {
|
|
21180
21212
|
error
|
|
21181
21213
|
});
|
|
@@ -21262,6 +21294,16 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21262
21294
|
return dc.bufferedAmount <= dc.bufferedAmountLowThreshold;
|
|
21263
21295
|
}
|
|
21264
21296
|
};
|
|
21297
|
+
this.onRtpMapAvailable = rtpTypes => {
|
|
21298
|
+
const rtpMap = new Map();
|
|
21299
|
+
rtpTypes.forEach(rtp => {
|
|
21300
|
+
const codec = rtp.codec.toLowerCase();
|
|
21301
|
+
if (isVideoCodec(codec)) {
|
|
21302
|
+
rtpMap.set(rtp.payload, codec);
|
|
21303
|
+
}
|
|
21304
|
+
});
|
|
21305
|
+
this.emit(EngineEvent.RTPVideoMapUpdate, rtpMap);
|
|
21306
|
+
};
|
|
21265
21307
|
this.handleBrowserOnLine = () => __awaiter(this, void 0, void 0, function* () {
|
|
21266
21308
|
if (!this.url) {
|
|
21267
21309
|
return;
|
|
@@ -21354,12 +21396,20 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21354
21396
|
try {
|
|
21355
21397
|
_this2.joinAttempts += 1;
|
|
21356
21398
|
_this2.setupSignalClientCallbacks();
|
|
21399
|
+
// Whether the initial publisher offer is bundled with the join request. Computed once and
|
|
21400
|
+
// reused after the join below. Only the (non-Firefox) offer-with-join path does this.
|
|
21401
|
+
const sendOfferWithJoin = !useV0Path && isPublisherOfferWithJoinSupported();
|
|
21357
21402
|
let offerProto;
|
|
21358
|
-
if (
|
|
21403
|
+
if (sendOfferWithJoin) {
|
|
21359
21404
|
if (!_this2.pcManager) {
|
|
21405
|
+
// Firefox is excluded from offer-with-join (see isPublisherOfferWithJoinSupported):
|
|
21406
|
+
// customers reported ICE connectivity problems for FF on this path (#1919) that we were
|
|
21407
|
+
// never able to reproduce, so out of caution FF stays on the deferred path below. The
|
|
21408
|
+
// exact cause is unknown — note that ICE gathering does not actually start here, since
|
|
21409
|
+
// createInitialOffer() defers setLocalDescription (via pendingInitialOffer) until the
|
|
21410
|
+
// answer is applied, after updateConfiguration() has set the server's TURN servers.
|
|
21360
21411
|
yield _this2.configure();
|
|
21361
|
-
_this2.
|
|
21362
|
-
_this2.addMediaSections(initialMediaSectionsAudio, initialMediaSectionsVideo);
|
|
21412
|
+
_this2.applyInitialPublisherLayout();
|
|
21363
21413
|
}
|
|
21364
21414
|
const offer = yield (_a = _this2.pcManager) === null || _a === void 0 ? void 0 : _a.publisher.createInitialOffer();
|
|
21365
21415
|
if (offer) {
|
|
@@ -21378,11 +21428,20 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21378
21428
|
_this2.latestJoinResponse = joinResponse;
|
|
21379
21429
|
_this2.participantSid = (_b = joinResponse.participant) === null || _b === void 0 ? void 0 : _b.sid;
|
|
21380
21430
|
_this2.subscriberPrimary = joinResponse.subscriberPrimary;
|
|
21381
|
-
if (
|
|
21431
|
+
if (sendOfferWithJoin) {
|
|
21382
21432
|
(_c = _this2.pcManager) === null || _c === void 0 ? void 0 : _c.updateConfiguration(_this2.makeRTCConfiguration(joinResponse));
|
|
21383
21433
|
} else {
|
|
21384
21434
|
if (!_this2.pcManager) {
|
|
21435
|
+
// Deferred path (Firefox, and V0): configure with the join response so the PC picks up
|
|
21436
|
+
// the server's ICE servers and topology, then negotiate separately rather than bundling
|
|
21437
|
+
// the offer with the join.
|
|
21385
21438
|
yield _this2.configure(joinResponse, !useV0Path);
|
|
21439
|
+
if (!useV0Path) {
|
|
21440
|
+
// The V1 first offer must carry the media layout so Firefox binds receive decoders for
|
|
21441
|
+
// subscribed tracks — without it, subscribed audio/video arrive as RTP but
|
|
21442
|
+
// never decode. V0 (legacy dual-PC) keeps its original lazy behavior.
|
|
21443
|
+
_this2.applyInitialPublisherLayout();
|
|
21444
|
+
}
|
|
21386
21445
|
}
|
|
21387
21446
|
// create offer
|
|
21388
21447
|
if (!_this2.subscriberPrimary || joinResponse.fastPublish) {
|
|
@@ -21402,7 +21461,9 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21402
21461
|
};
|
|
21403
21462
|
}
|
|
21404
21463
|
_this2.log.info("connected to Livekit Server ".concat(Object.entries(serverInfo).map(_ref2 => {
|
|
21405
|
-
let
|
|
21464
|
+
let _ref3 = _slicedToArray(_ref2, 2),
|
|
21465
|
+
key = _ref3[0],
|
|
21466
|
+
value = _ref3[1];
|
|
21406
21467
|
return "".concat(key, ": ").concat(value);
|
|
21407
21468
|
}).join(', ')));
|
|
21408
21469
|
return {
|
|
@@ -21537,9 +21598,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21537
21598
|
*/
|
|
21538
21599
|
removeTrack(sender) {
|
|
21539
21600
|
if (sender.track && this.pendingTrackResolvers[sender.track.id]) {
|
|
21540
|
-
const
|
|
21541
|
-
reject
|
|
21542
|
-
} = this.pendingTrackResolvers[sender.track.id];
|
|
21601
|
+
const reject = this.pendingTrackResolvers[sender.track.id].reject;
|
|
21543
21602
|
if (reject) {
|
|
21544
21603
|
reject();
|
|
21545
21604
|
}
|
|
@@ -21678,9 +21737,7 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21678
21737
|
});
|
|
21679
21738
|
return;
|
|
21680
21739
|
}
|
|
21681
|
-
const
|
|
21682
|
-
resolve
|
|
21683
|
-
} = this.pendingTrackResolvers[res.cid];
|
|
21740
|
+
const resolve = this.pendingTrackResolvers[res.cid].resolve;
|
|
21684
21741
|
delete this.pendingTrackResolvers[res.cid];
|
|
21685
21742
|
resolve(res.track);
|
|
21686
21743
|
};
|
|
@@ -21788,6 +21845,16 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21788
21845
|
}
|
|
21789
21846
|
return rtcConfig;
|
|
21790
21847
|
}
|
|
21848
|
+
/**
|
|
21849
|
+
* Populate the publisher PC so its first offer carries the data channels + recvonly media
|
|
21850
|
+
* sections. Required for every V1 connection: Firefox only binds receive decoders for media
|
|
21851
|
+
* present in that first offer, and the offer-with-join path needs the sections to
|
|
21852
|
+
* build a meaningful initial offer. Must be called on a configured pcManager.
|
|
21853
|
+
*/
|
|
21854
|
+
applyInitialPublisherLayout() {
|
|
21855
|
+
this.createDataChannels();
|
|
21856
|
+
this.addMediaSections(initialMediaSectionsAudio, initialMediaSectionsVideo);
|
|
21857
|
+
}
|
|
21791
21858
|
addMediaSections(numAudios, numVideos) {
|
|
21792
21859
|
var _a, _b;
|
|
21793
21860
|
const transceiverInit = {
|
|
@@ -21914,10 +21981,9 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
21914
21981
|
return;
|
|
21915
21982
|
}
|
|
21916
21983
|
// @ts-ignore
|
|
21917
|
-
const
|
|
21918
|
-
readable,
|
|
21919
|
-
writable
|
|
21920
|
-
} = sender.createEncodedStreams();
|
|
21984
|
+
const _sender$createEncoded = sender.createEncodedStreams(),
|
|
21985
|
+
readable = _sender$createEncoded.readable,
|
|
21986
|
+
writable = _sender$createEncoded.writable;
|
|
21921
21987
|
if (hasPacketTrailer) {
|
|
21922
21988
|
this.options.packetTrailer.worker.postMessage({
|
|
21923
21989
|
kind: 'encode',
|
|
@@ -22423,16 +22489,8 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22423
22489
|
}
|
|
22424
22490
|
this.on(EngineEvent.Closing, handleClosed);
|
|
22425
22491
|
this.on(EngineEvent.Restarting, handleClosed);
|
|
22426
|
-
this.pcManager.publisher.
|
|
22427
|
-
|
|
22428
|
-
rtpTypes.forEach(rtp => {
|
|
22429
|
-
const codec = rtp.codec.toLowerCase();
|
|
22430
|
-
if (isVideoCodec(codec)) {
|
|
22431
|
-
rtpMap.set(rtp.payload, codec);
|
|
22432
|
-
}
|
|
22433
|
-
});
|
|
22434
|
-
this.emit(EngineEvent.RTPVideoMapUpdate, rtpMap);
|
|
22435
|
-
});
|
|
22492
|
+
this.pcManager.publisher.off(PCEvents.RTPVideoPayloadTypes, this.onRtpMapAvailable);
|
|
22493
|
+
this.pcManager.publisher.once(PCEvents.RTPVideoPayloadTypes, this.onRtpMapAvailable);
|
|
22436
22494
|
try {
|
|
22437
22495
|
yield this.pcManager.negotiate(abortController);
|
|
22438
22496
|
resolve();
|
|
@@ -22596,8 +22654,9 @@ class RTCEngine extends eventsExports.EventEmitter {
|
|
|
22596
22654
|
var _a;
|
|
22597
22655
|
const mid = (_a = this.pcManager) === null || _a === void 0 ? void 0 : _a.getMidForReceiver(receiver);
|
|
22598
22656
|
if (mid) {
|
|
22599
|
-
const match = Object.entries(this.midToTrackId).find(
|
|
22600
|
-
let
|
|
22657
|
+
const match = Object.entries(this.midToTrackId).find(_ref4 => {
|
|
22658
|
+
let _ref5 = _slicedToArray(_ref4, 1),
|
|
22659
|
+
key = _ref5[0];
|
|
22601
22660
|
return key === mid;
|
|
22602
22661
|
});
|
|
22603
22662
|
if (match) {
|
|
@@ -23096,10 +23155,9 @@ class TextStreamReader extends BaseStreamReader {
|
|
|
23096
23155
|
flushBufferedPackets() {
|
|
23097
23156
|
const packets = this.bufferedPackets;
|
|
23098
23157
|
this.bufferedPackets = [];
|
|
23099
|
-
for (const {
|
|
23100
|
-
packet
|
|
23101
|
-
encryptionType
|
|
23102
|
-
} of packets) {
|
|
23158
|
+
for (const _ref of packets) {
|
|
23159
|
+
const packet = _ref.packet;
|
|
23160
|
+
const encryptionType = _ref.encryptionType;
|
|
23103
23161
|
this.handleDataStreamPacket(packet, encryptionType);
|
|
23104
23162
|
}
|
|
23105
23163
|
}
|
|
@@ -23132,11 +23190,17 @@ class TextStreamReader extends BaseStreamReader {
|
|
|
23132
23190
|
const byteStreamsBeingSentByDisconnectingParticipant = Array.from(this.byteStreamControllers.entries()).filter(entry => entry[1].sendingParticipantIdentity === participantIdentity);
|
|
23133
23191
|
if (textStreamsBeingSentByDisconnectingParticipant.length > 0 || byteStreamsBeingSentByDisconnectingParticipant.length > 0) {
|
|
23134
23192
|
const abnormalEndError = new DataStreamError("Participant ".concat(participantIdentity, " unexpectedly disconnected in the middle of sending data"), DataStreamErrorReason.AbnormalEnd);
|
|
23135
|
-
for (const
|
|
23193
|
+
for (const _ref2 of byteStreamsBeingSentByDisconnectingParticipant) {
|
|
23194
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
23195
|
+
const id = _ref3[0];
|
|
23196
|
+
const controller = _ref3[1];
|
|
23136
23197
|
controller.controller.error(abnormalEndError);
|
|
23137
23198
|
this.byteStreamControllers.delete(id);
|
|
23138
23199
|
}
|
|
23139
|
-
for (const
|
|
23200
|
+
for (const _ref4 of textStreamsBeingSentByDisconnectingParticipant) {
|
|
23201
|
+
var _ref5 = _slicedToArray(_ref4, 2);
|
|
23202
|
+
const id = _ref5[0];
|
|
23203
|
+
const controller = _ref5[1];
|
|
23140
23204
|
controller.controller.error(abnormalEndError);
|
|
23141
23205
|
this.textStreamControllers.delete(id);
|
|
23142
23206
|
}
|
|
@@ -23466,10 +23530,9 @@ class OutgoingDataStreamManager {
|
|
|
23466
23530
|
});
|
|
23467
23531
|
const reader = file.stream().getReader();
|
|
23468
23532
|
while (true) {
|
|
23469
|
-
const
|
|
23470
|
-
done,
|
|
23471
|
-
value
|
|
23472
|
-
} = yield reader.read();
|
|
23533
|
+
const _yield$reader$read = yield reader.read(),
|
|
23534
|
+
done = _yield$reader$read.done,
|
|
23535
|
+
value = _yield$reader$read.value;
|
|
23473
23536
|
if (done) {
|
|
23474
23537
|
break;
|
|
23475
23538
|
}
|
|
@@ -23933,7 +23996,10 @@ const DataTrackSymbol = Symbol.for('lk.data-track');class RemoteDataTrack {
|
|
|
23933
23996
|
*/
|
|
23934
23997
|
subscribe(options) {
|
|
23935
23998
|
try {
|
|
23936
|
-
const
|
|
23999
|
+
const _this$manager$openSub = this.manager.openSubscriptionStream(this.info.sid, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.bufferSize),
|
|
24000
|
+
_this$manager$openSub2 = _slicedToArray(_this$manager$openSub, 2),
|
|
24001
|
+
stream = _this$manager$openSub2[0],
|
|
24002
|
+
sfuSubscriptionComplete = _this$manager$openSub2[1];
|
|
23937
24003
|
// Prevent uncaught promise rejections from bubbling up if rejections occur after the
|
|
23938
24004
|
// readable stream is discarded.
|
|
23939
24005
|
sfuSubscriptionComplete.catch(() => {});
|
|
@@ -23972,10 +24038,9 @@ class DataTrackPacketHeader extends Serializable {
|
|
|
23972
24038
|
};
|
|
23973
24039
|
}
|
|
23974
24040
|
toBinaryLengthBytes() {
|
|
23975
|
-
const
|
|
23976
|
-
lengthBytes
|
|
23977
|
-
paddingLengthBytes
|
|
23978
|
-
} = this.extensionsMetrics();
|
|
24041
|
+
const _this$extensionsMetri = this.extensionsMetrics(),
|
|
24042
|
+
extLengthBytes = _this$extensionsMetri.lengthBytes,
|
|
24043
|
+
extPaddingLengthBytes = _this$extensionsMetri.paddingLengthBytes;
|
|
23979
24044
|
let totalLengthBytes = BASE_HEADER_LEN;
|
|
23980
24045
|
if (extLengthBytes > 0) {
|
|
23981
24046
|
totalLengthBytes += EXT_WORDS_INDICATOR_SIZE + extLengthBytes + extPaddingLengthBytes;
|
|
@@ -24003,11 +24068,10 @@ class DataTrackPacketHeader extends Serializable {
|
|
|
24003
24068
|
break;
|
|
24004
24069
|
}
|
|
24005
24070
|
initial |= marker << FRAME_MARKER_SHIFT;
|
|
24006
|
-
const
|
|
24007
|
-
lengthBytes
|
|
24008
|
-
lengthWords
|
|
24009
|
-
paddingLengthBytes
|
|
24010
|
-
} = this.extensionsMetrics();
|
|
24071
|
+
const _this$extensionsMetri2 = this.extensionsMetrics(),
|
|
24072
|
+
extensionsLengthBytes = _this$extensionsMetri2.lengthBytes,
|
|
24073
|
+
extensionsLengthWords = _this$extensionsMetri2.lengthWords,
|
|
24074
|
+
extensionsPaddingLengthBytes = _this$extensionsMetri2.paddingLengthBytes;
|
|
24011
24075
|
if (extensionsLengthBytes > 0) {
|
|
24012
24076
|
initial |= 1 << EXT_FLAG_SHIFT;
|
|
24013
24077
|
}
|
|
@@ -24110,7 +24174,10 @@ class DataTrackPacketHeader extends Serializable {
|
|
|
24110
24174
|
throw DataTrackDeserializeError.headerOverrun();
|
|
24111
24175
|
}
|
|
24112
24176
|
let extensionDataView = new DataView(dataView.buffer, dataView.byteOffset + byteIndex, extensionLengthBytes);
|
|
24113
|
-
const
|
|
24177
|
+
const _DataTrackExtensions$ = DataTrackExtensions.fromBinary(extensionDataView),
|
|
24178
|
+
_DataTrackExtensions$2 = _slicedToArray(_DataTrackExtensions$, 2),
|
|
24179
|
+
result = _DataTrackExtensions$2[0],
|
|
24180
|
+
readBytes = _DataTrackExtensions$2[1];
|
|
24114
24181
|
extensions = result;
|
|
24115
24182
|
byteIndex += readBytes;
|
|
24116
24183
|
}
|
|
@@ -24176,7 +24243,10 @@ class DataTrackPacket extends Serializable {
|
|
|
24176
24243
|
}
|
|
24177
24244
|
static fromBinary(input) {
|
|
24178
24245
|
const dataView = coerceToDataView(input);
|
|
24179
|
-
const
|
|
24246
|
+
const _DataTrackPacketHeade = DataTrackPacketHeader.fromBinary(dataView),
|
|
24247
|
+
_DataTrackPacketHeade2 = _slicedToArray(_DataTrackPacketHeade, 2),
|
|
24248
|
+
header = _DataTrackPacketHeade2[0],
|
|
24249
|
+
headerByteLength = _DataTrackPacketHeade2[1];
|
|
24180
24250
|
const payload = dataView.buffer.slice(dataView.byteOffset + headerByteLength, dataView.byteOffset + dataView.byteLength);
|
|
24181
24251
|
return [new DataTrackPacket(header, new Uint8Array(payload)), dataView.byteLength];
|
|
24182
24252
|
}
|
|
@@ -24778,7 +24848,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24778
24848
|
* subscription. Used when the subscription is being torn down by the manager (unsubscribe,
|
|
24779
24849
|
* unpublish, or shutdown). */
|
|
24780
24850
|
closeStreamControllers(streamControllers, sid) {
|
|
24781
|
-
for (const
|
|
24851
|
+
for (const _ref of streamControllers) {
|
|
24852
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
24853
|
+
const controller = _ref2[0];
|
|
24854
|
+
const detachSignal = _ref2[1];
|
|
24782
24855
|
// Detach before close so we don't leak a listener on the user's AbortSignal.
|
|
24783
24856
|
detachSignal();
|
|
24784
24857
|
try {
|
|
@@ -24807,7 +24880,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24807
24880
|
}
|
|
24808
24881
|
// Detect published track
|
|
24809
24882
|
const publisherParticipantToSidsInUpdate = new Map();
|
|
24810
|
-
for (const
|
|
24883
|
+
for (const _ref3 of updates.entries()) {
|
|
24884
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
24885
|
+
const publisherIdentity = _ref4[0];
|
|
24886
|
+
const infos = _ref4[1];
|
|
24811
24887
|
const sidsInUpdate = new Set();
|
|
24812
24888
|
for (const info of infos) {
|
|
24813
24889
|
sidsInUpdate.add(info.sid);
|
|
@@ -24819,12 +24895,18 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24819
24895
|
publisherParticipantToSidsInUpdate.set(publisherIdentity, sidsInUpdate);
|
|
24820
24896
|
}
|
|
24821
24897
|
// Detect unpublished tracks
|
|
24822
|
-
for (const
|
|
24823
|
-
|
|
24824
|
-
|
|
24898
|
+
for (const _ref5 of publisherParticipantToSidsInUpdate.entries()) {
|
|
24899
|
+
var _ref6 = _slicedToArray(_ref5, 2);
|
|
24900
|
+
const publisherIdentity = _ref6[0];
|
|
24901
|
+
const sidsInUpdate = _ref6[1];
|
|
24902
|
+
const descriptorsForPublisher = Array.from(this.descriptors.entries()).filter(_ref7 => {
|
|
24903
|
+
let _ref8 = _slicedToArray(_ref7, 2);
|
|
24904
|
+
_ref8[0];
|
|
24905
|
+
let descriptor = _ref8[1];
|
|
24825
24906
|
return descriptor.publisherIdentity === publisherIdentity;
|
|
24826
|
-
}).map(
|
|
24827
|
-
let
|
|
24907
|
+
}).map(_ref9 => {
|
|
24908
|
+
let _ref0 = _slicedToArray(_ref9, 1),
|
|
24909
|
+
sid = _ref0[0];
|
|
24828
24910
|
return sid;
|
|
24829
24911
|
});
|
|
24830
24912
|
let unpublishedSids = descriptorsForPublisher.filter(sid => !sidsInUpdate.has(sid));
|
|
@@ -24886,7 +24968,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24886
24968
|
/** Mapping between track handles attached to incoming packets to the
|
|
24887
24969
|
* track SIDs they belong to. */
|
|
24888
24970
|
mapping) {
|
|
24889
|
-
for (const
|
|
24971
|
+
for (const _ref1 of mapping.entries()) {
|
|
24972
|
+
var _ref10 = _slicedToArray(_ref1, 2);
|
|
24973
|
+
const handle = _ref10[0];
|
|
24974
|
+
const sid = _ref10[1];
|
|
24890
24975
|
this.registerSubscriberHandle(handle, sid);
|
|
24891
24976
|
}
|
|
24892
24977
|
}
|
|
@@ -24936,7 +25021,9 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24936
25021
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24937
25022
|
let packet;
|
|
24938
25023
|
try {
|
|
24939
|
-
|
|
25024
|
+
var _DataTrackPacket$from = DataTrackPacket.fromBinary(bytes);
|
|
25025
|
+
var _DataTrackPacket$from2 = _slicedToArray(_DataTrackPacket$from, 1);
|
|
25026
|
+
packet = _DataTrackPacket$from2[0];
|
|
24940
25027
|
} catch (err) {
|
|
24941
25028
|
log$1.error("Failed to deserialize packet: ".concat(err));
|
|
24942
25029
|
return;
|
|
@@ -24977,7 +25064,10 @@ class IncomingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
24977
25064
|
* tracks are subscribed to locally.
|
|
24978
25065
|
*/
|
|
24979
25066
|
resendSubscriptionUpdates() {
|
|
24980
|
-
for (const
|
|
25067
|
+
for (const _ref11 of this.descriptors) {
|
|
25068
|
+
var _ref12 = _slicedToArray(_ref11, 2);
|
|
25069
|
+
const sid = _ref12[0];
|
|
25070
|
+
const descriptor = _ref12[1];
|
|
24981
25071
|
if (descriptor.subscription.type === 'none') {
|
|
24982
25072
|
continue;
|
|
24983
25073
|
}
|
|
@@ -25086,7 +25176,8 @@ class DataTrackPacketizer {
|
|
|
25086
25176
|
}
|
|
25087
25177
|
const maxPayloadSizeBytes = this.mtuSizeBytes - headerSerializedLengthBytes;
|
|
25088
25178
|
const packetCount = Math.ceil(frame.payload.byteLength / maxPayloadSizeBytes);
|
|
25089
|
-
for (let index = 0, indexBytes = 0; indexBytes < frame.payload.byteLength;
|
|
25179
|
+
for (let index = 0, indexBytes = 0; indexBytes < frame.payload.byteLength; _ref = [index + 1, indexBytes + maxPayloadSizeBytes], index = _ref[0], indexBytes = _ref[1], _ref) {
|
|
25180
|
+
var _ref;
|
|
25090
25181
|
const sequence = this.sequence.getThenIncrement();
|
|
25091
25182
|
const packetHeader = new DataTrackPacketHeader(Object.assign(Object.assign({}, headerParams), {
|
|
25092
25183
|
marker: DataTrackPacketizer.computeFrameMarker(index, packetCount),
|
|
@@ -25694,7 +25785,10 @@ class OutgoingDataTrackManager extends eventsExports.EventEmitter {
|
|
|
25694
25785
|
*/
|
|
25695
25786
|
sfuWillRepublishTracks() {
|
|
25696
25787
|
var _a, _b;
|
|
25697
|
-
for (const
|
|
25788
|
+
for (const _ref of this.descriptors.entries()) {
|
|
25789
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
25790
|
+
const handle = _ref2[0];
|
|
25791
|
+
const descriptor = _ref2[1];
|
|
25698
25792
|
switch (descriptor.type) {
|
|
25699
25793
|
case 'pending':
|
|
25700
25794
|
// TODO: support republish for pending publications
|
|
@@ -25897,12 +25991,11 @@ class RpcClientManager extends EventEmitter {
|
|
|
25897
25991
|
performRpc(_a) {
|
|
25898
25992
|
return __awaiter(this, arguments, void 0, function (_ref) {
|
|
25899
25993
|
var _this = this;
|
|
25900
|
-
let
|
|
25901
|
-
|
|
25902
|
-
|
|
25903
|
-
|
|
25904
|
-
|
|
25905
|
-
} = _ref;
|
|
25994
|
+
let destinationIdentity = _ref.destinationIdentity,
|
|
25995
|
+
method = _ref.method,
|
|
25996
|
+
payload = _ref.payload,
|
|
25997
|
+
_ref$responseTimeout = _ref.responseTimeout,
|
|
25998
|
+
responseTimeoutMs = _ref$responseTimeout === void 0 ? 15000 : _ref$responseTimeout;
|
|
25906
25999
|
return function* () {
|
|
25907
26000
|
const maxRoundTripLatencyMs = 7000;
|
|
25908
26001
|
const minEffectiveTimeoutMs = maxRoundTripLatencyMs + 1000;
|
|
@@ -25919,12 +26012,15 @@ class RpcClientManager extends EventEmitter {
|
|
|
25919
26012
|
const effectiveTimeoutMs = Math.max(responseTimeoutMs, minEffectiveTimeoutMs);
|
|
25920
26013
|
const id = crypto.randomUUID();
|
|
25921
26014
|
const completionFuture = new Future();
|
|
26015
|
+
let responseTimeoutId = null;
|
|
25922
26016
|
const ackTimeoutId = setTimeout(() => {
|
|
25923
26017
|
var _a;
|
|
25924
26018
|
_this.pendingAcks.delete(id);
|
|
25925
26019
|
(_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('CONNECTION_TIMEOUT'));
|
|
25926
26020
|
_this.pendingResponses.delete(id);
|
|
25927
|
-
|
|
26021
|
+
if (responseTimeoutId !== null) {
|
|
26022
|
+
clearTimeout(responseTimeoutId);
|
|
26023
|
+
}
|
|
25928
26024
|
}, maxRoundTripLatencyMs);
|
|
25929
26025
|
_this.pendingAcks.set(id, {
|
|
25930
26026
|
resolve: () => {
|
|
@@ -25937,7 +26033,7 @@ class RpcClientManager extends EventEmitter {
|
|
|
25937
26033
|
participantIdentity: destinationIdentity
|
|
25938
26034
|
});
|
|
25939
26035
|
yield _this.publishRpcRequest(destinationIdentity, id, method, payload, effectiveTimeoutMs, remoteClientProtocol);
|
|
25940
|
-
|
|
26036
|
+
responseTimeoutId = setTimeout(() => {
|
|
25941
26037
|
var _a;
|
|
25942
26038
|
_this.pendingResponses.delete(id);
|
|
25943
26039
|
(_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('RESPONSE_TIMEOUT'));
|
|
@@ -26057,17 +26153,20 @@ class RpcClientManager extends EventEmitter {
|
|
|
26057
26153
|
/** @internal */
|
|
26058
26154
|
handleParticipantDisconnected(participantIdentity) {
|
|
26059
26155
|
var _a;
|
|
26060
|
-
for (const
|
|
26061
|
-
|
|
26062
|
-
|
|
26156
|
+
for (const _ref2 of this.pendingAcks) {
|
|
26157
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
26158
|
+
const id = _ref3[0];
|
|
26159
|
+
const pendingIdentity = _ref3[1].participantIdentity;
|
|
26063
26160
|
if (pendingIdentity === participantIdentity) {
|
|
26064
26161
|
this.pendingAcks.delete(id);
|
|
26065
26162
|
}
|
|
26066
26163
|
}
|
|
26067
|
-
for (const
|
|
26068
|
-
|
|
26069
|
-
|
|
26070
|
-
|
|
26164
|
+
for (const _ref4 of this.pendingResponses) {
|
|
26165
|
+
var _ref5 = _slicedToArray(_ref4, 2);
|
|
26166
|
+
const id = _ref5[0];
|
|
26167
|
+
var _ref5$ = _ref5[1];
|
|
26168
|
+
const pendingIdentity = _ref5$.participantIdentity;
|
|
26169
|
+
const completionFuture = _ref5$.completionFuture;
|
|
26071
26170
|
if (pendingIdentity === participantIdentity) {
|
|
26072
26171
|
(_a = completionFuture.reject) === null || _a === void 0 ? void 0 : _a.call(completionFuture, RpcError.builtIn('RECIPIENT_DISCONNECTED'));
|
|
26073
26172
|
this.pendingResponses.delete(id);
|
|
@@ -26676,11 +26775,10 @@ function createLocalTracks(options, loggerOptions) {
|
|
|
26676
26775
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26677
26776
|
options !== null && options !== void 0 ? options : options = {};
|
|
26678
26777
|
let attemptExactMatch = false;
|
|
26679
|
-
const
|
|
26680
|
-
audioProcessor,
|
|
26681
|
-
videoProcessor,
|
|
26682
|
-
optionsWithoutProcessor
|
|
26683
|
-
} = extractProcessorsFromOptions(options);
|
|
26778
|
+
const _extractProcessorsFro = extractProcessorsFromOptions(options),
|
|
26779
|
+
audioProcessor = _extractProcessorsFro.audioProcessor,
|
|
26780
|
+
videoProcessor = _extractProcessorsFro.videoProcessor,
|
|
26781
|
+
internalOptions = _extractProcessorsFro.optionsWithoutProcessor;
|
|
26684
26782
|
let retryAudioOptions = internalOptions.audio;
|
|
26685
26783
|
let retryVideoOptions = internalOptions.video;
|
|
26686
26784
|
if (audioProcessor && typeof internalOptions.audio === 'object') {
|
|
@@ -26922,7 +27020,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
26922
27020
|
* the user's camera track with getTrackBySource(Track.Source.Camera).
|
|
26923
27021
|
*/
|
|
26924
27022
|
getTrackPublication(source) {
|
|
26925
|
-
for (const
|
|
27023
|
+
for (const _ref of this.trackPublications) {
|
|
27024
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
27025
|
+
const pub = _ref2[1];
|
|
26926
27026
|
if (pub.source === source) {
|
|
26927
27027
|
return pub;
|
|
26928
27028
|
}
|
|
@@ -26932,7 +27032,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
26932
27032
|
* Finds the first track that matches the track's name.
|
|
26933
27033
|
*/
|
|
26934
27034
|
getTrackPublicationByName(name) {
|
|
26935
|
-
for (const
|
|
27035
|
+
for (const _ref3 of this.trackPublications) {
|
|
27036
|
+
var _ref4 = _slicedToArray(_ref3, 2);
|
|
27037
|
+
const pub = _ref4[1];
|
|
26936
27038
|
if (pub.trackName === name) {
|
|
26937
27039
|
return pub;
|
|
26938
27040
|
}
|
|
@@ -27175,11 +27277,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27175
27277
|
(_b = (_a = this.signalConnectedFuture).resolve) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
27176
27278
|
};
|
|
27177
27279
|
this.handleSignalRequestResponse = response => {
|
|
27178
|
-
const
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
message
|
|
27182
|
-
} = response;
|
|
27280
|
+
const requestId = response.requestId,
|
|
27281
|
+
reason = response.reason,
|
|
27282
|
+
message = response.message;
|
|
27183
27283
|
const targetRequest = this.pendingSignalRequests.get(requestId);
|
|
27184
27284
|
if (targetRequest) {
|
|
27185
27285
|
if (reason !== RequestResponse_Reason.OK) {
|
|
@@ -27455,11 +27555,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27455
27555
|
requestMetadataUpdate(_a) {
|
|
27456
27556
|
return __awaiter(this, arguments, void 0, function (_ref) {
|
|
27457
27557
|
var _this = this;
|
|
27458
|
-
let
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
attributes
|
|
27462
|
-
} = _ref;
|
|
27558
|
+
let metadata = _ref.metadata,
|
|
27559
|
+
name = _ref.name,
|
|
27560
|
+
attributes = _ref.attributes;
|
|
27463
27561
|
return function* () {
|
|
27464
27562
|
return new TypedPromise((resolve, reject) => __awaiter(_this, void 0, void 0, function* () {
|
|
27465
27563
|
var _a, _b;
|
|
@@ -27481,7 +27579,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27481
27579
|
});
|
|
27482
27580
|
while (performance.now() - startTime < 5000 && !isRejected) {
|
|
27483
27581
|
if ((!name || this.name === name) && (!metadata || this.metadata === metadata) && (!attributes || Object.entries(attributes).every(_ref2 => {
|
|
27484
|
-
let
|
|
27582
|
+
let _ref3 = _slicedToArray(_ref2, 2),
|
|
27583
|
+
key = _ref3[0],
|
|
27584
|
+
value = _ref3[1];
|
|
27485
27585
|
return this.attributes[key] === value || value === '' && !this.attributes[key];
|
|
27486
27586
|
}))) {
|
|
27487
27587
|
this.pendingSignalRequests.delete(requestId);
|
|
@@ -27614,7 +27714,8 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27614
27714
|
const publishedTracks = yield Promise.all(publishPromises);
|
|
27615
27715
|
// for screen share publications including audio, this will only return the screen share publication, not the screen share audio one
|
|
27616
27716
|
// revisit if we want to return an array of tracks instead for v2
|
|
27617
|
-
|
|
27717
|
+
var _publishedTracks = _slicedToArray(publishedTracks, 1);
|
|
27718
|
+
track = _publishedTracks[0];
|
|
27618
27719
|
} catch (e) {
|
|
27619
27720
|
localTracks === null || localTracks === void 0 ? void 0 : localTracks.forEach(tr => {
|
|
27620
27721
|
tr.stop();
|
|
@@ -27642,7 +27743,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27642
27743
|
if (screenAudioTrack && screenAudioTrack.track) {
|
|
27643
27744
|
unpublishPromises.push(this.unpublishTrack(screenAudioTrack.track));
|
|
27644
27745
|
}
|
|
27645
|
-
|
|
27746
|
+
var _yield$Promise$all = yield Promise.all(unpublishPromises);
|
|
27747
|
+
var _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
|
|
27748
|
+
track = _yield$Promise$all2[0];
|
|
27646
27749
|
} else {
|
|
27647
27750
|
yield track.mute();
|
|
27648
27751
|
}
|
|
@@ -27965,10 +28068,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
27965
28068
|
this.log.warn('no permissions present for publishing track', getLogContextFromTrack(track));
|
|
27966
28069
|
return false;
|
|
27967
28070
|
}
|
|
27968
|
-
const
|
|
27969
|
-
canPublish,
|
|
27970
|
-
canPublishSources
|
|
27971
|
-
} = this.permissions;
|
|
28071
|
+
const _this$permissions = this.permissions,
|
|
28072
|
+
canPublish = _this$permissions.canPublish,
|
|
28073
|
+
canPublishSources = _this$permissions.canPublishSources;
|
|
27972
28074
|
if (canPublish && (canPublishSources.length === 0 || canPublishSources.map(source => getTrackSourceFromProto(source)).includes(track.source))) {
|
|
27973
28075
|
return true;
|
|
27974
28076
|
}
|
|
@@ -28474,7 +28576,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28474
28576
|
negotiationNeeded = true;
|
|
28475
28577
|
}
|
|
28476
28578
|
if (isLocalVideoTrack(track)) {
|
|
28477
|
-
for (const
|
|
28579
|
+
for (const _ref4 of track.simulcastCodecs) {
|
|
28580
|
+
var _ref5 = _slicedToArray(_ref4, 2);
|
|
28581
|
+
const trackInfo = _ref5[1];
|
|
28478
28582
|
if (trackInfo.sender) {
|
|
28479
28583
|
try {
|
|
28480
28584
|
negotiationNeeded = this.engine.removeTrack(trackInfo.sender);
|
|
@@ -28715,8 +28819,10 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28715
28819
|
* @throws Error on failure. Details in `message`.
|
|
28716
28820
|
*/
|
|
28717
28821
|
performRpc(params) {
|
|
28718
|
-
return this.rpcClientManager.performRpc(params).then(
|
|
28719
|
-
let
|
|
28822
|
+
return this.rpcClientManager.performRpc(params).then(_ref6 => {
|
|
28823
|
+
let _ref7 = _slicedToArray(_ref6, 2);
|
|
28824
|
+
_ref7[0];
|
|
28825
|
+
let completionPromise = _ref7[1];
|
|
28720
28826
|
return completionPromise;
|
|
28721
28827
|
});
|
|
28722
28828
|
}
|
|
@@ -28832,8 +28938,9 @@ class Participant extends eventsExports.EventEmitter {
|
|
|
28832
28938
|
const waitForPendingTimeout = 10000;
|
|
28833
28939
|
const startTime = Date.now();
|
|
28834
28940
|
while (Date.now() < startTime + waitForPendingTimeout) {
|
|
28835
|
-
const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(
|
|
28836
|
-
let
|
|
28941
|
+
const publishPromiseEntry = Array.from(this.pendingPublishPromises.entries()).find(_ref8 => {
|
|
28942
|
+
let _ref9 = _slicedToArray(_ref8, 1),
|
|
28943
|
+
pendingTrack = _ref9[0];
|
|
28837
28944
|
return pendingTrack.source === source;
|
|
28838
28945
|
});
|
|
28839
28946
|
if (publishPromiseEntry) {
|
|
@@ -29442,9 +29549,7 @@ class DeferrableMap extends Map {
|
|
|
29442
29549
|
return;
|
|
29443
29550
|
}
|
|
29444
29551
|
// also send unsubscribe, if track is actively subscribed
|
|
29445
|
-
const
|
|
29446
|
-
track
|
|
29447
|
-
} = publication;
|
|
29552
|
+
const track = publication.track;
|
|
29448
29553
|
if (track) {
|
|
29449
29554
|
track.stop();
|
|
29450
29555
|
publication.setTrack(undefined);
|
|
@@ -29486,7 +29591,10 @@ class DeferrableMap extends Map {
|
|
|
29486
29591
|
}
|
|
29487
29592
|
/** @internal */
|
|
29488
29593
|
removeRemoteDataTrack(remoteDataTrackSid) {
|
|
29489
|
-
for (const
|
|
29594
|
+
for (const _ref of this.dataTracks.entries()) {
|
|
29595
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
29596
|
+
const name = _ref2[0];
|
|
29597
|
+
const dataTrack = _ref2[1];
|
|
29490
29598
|
if (remoteDataTrackSid === dataTrack.info.sid) {
|
|
29491
29599
|
this.dataTracks.delete(name);
|
|
29492
29600
|
}
|
|
@@ -29656,17 +29764,16 @@ class Room extends eventsExports.EventEmitter {
|
|
|
29656
29764
|
return this.connectFuture.promise;
|
|
29657
29765
|
});
|
|
29658
29766
|
this.connectSignal = (url, token, engine, connectOptions, roomOptions, abortController) => __awaiter(this, void 0, void 0, function* () {
|
|
29659
|
-
const {
|
|
29660
|
-
|
|
29661
|
-
|
|
29662
|
-
|
|
29663
|
-
|
|
29664
|
-
|
|
29665
|
-
|
|
29666
|
-
|
|
29667
|
-
|
|
29668
|
-
|
|
29669
|
-
}, abortController.signal, !roomOptions.singlePeerConnection);
|
|
29767
|
+
const _yield$engine$join = yield engine.join(url, token, {
|
|
29768
|
+
autoSubscribe: connectOptions.autoSubscribe,
|
|
29769
|
+
adaptiveStream: typeof roomOptions.adaptiveStream === 'object' ? true : roomOptions.adaptiveStream,
|
|
29770
|
+
clientInfoCapabilities: isPacketTrailerSupported(roomOptions.packetTrailer) || !!this.e2eeManager ? [ClientInfo_Capability.CAP_PACKET_TRAILER] : undefined,
|
|
29771
|
+
maxRetries: connectOptions.maxRetries,
|
|
29772
|
+
e2eeEnabled: !!this.e2eeManager,
|
|
29773
|
+
websocketTimeout: connectOptions.websocketTimeout
|
|
29774
|
+
}, abortController.signal, !roomOptions.singlePeerConnection),
|
|
29775
|
+
joinResponse = _yield$engine$join.joinResponse,
|
|
29776
|
+
serverInfo = _yield$engine$join.serverInfo;
|
|
29670
29777
|
this.serverInfo = serverInfo;
|
|
29671
29778
|
if (!serverInfo.version) {
|
|
29672
29779
|
throw new UnsupportedServer('unknown server version');
|
|
@@ -30325,10 +30432,8 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30325
30432
|
}).on('trackUnpublished', event => {
|
|
30326
30433
|
this.emit(RoomEvent.LocalDataTrackUnpublished, event.sid);
|
|
30327
30434
|
}).on('packetAvailable', _ref => {
|
|
30328
|
-
let
|
|
30329
|
-
|
|
30330
|
-
bytes
|
|
30331
|
-
} = _ref;
|
|
30435
|
+
let handle = _ref.handle,
|
|
30436
|
+
bytes = _ref.bytes;
|
|
30332
30437
|
this.engine.sendLossyBytes(bytes, DataChannelKind.DATA_TRACK_LOSSY, 'wait').finally(() => this.outgoingDataTrackManager.handlePacketSendComplete(handle));
|
|
30333
30438
|
});
|
|
30334
30439
|
this.registerRpcDataStreamHandler();
|
|
@@ -30337,17 +30442,13 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30337
30442
|
return (_b = (_a = this.engine.latestJoinResponse) === null || _a === void 0 ? void 0 : _a.serverInfo) === null || _b === void 0 ? void 0 : _b.version;
|
|
30338
30443
|
});
|
|
30339
30444
|
this.rpcClientManager.on('sendDataPacket', _ref2 => {
|
|
30340
|
-
let
|
|
30341
|
-
packet
|
|
30342
|
-
} = _ref2;
|
|
30445
|
+
let packet = _ref2.packet;
|
|
30343
30446
|
var _a;
|
|
30344
30447
|
(_a = this.engine) === null || _a === void 0 ? void 0 : _a.sendDataPacket(packet, DataChannelKind.RELIABLE);
|
|
30345
30448
|
});
|
|
30346
30449
|
this.rpcServerManager = new RpcServerManager(this.log, this.outgoingDataStreamManager, this.getRemoteParticipantClientProtocol);
|
|
30347
30450
|
this.rpcServerManager.on('sendDataPacket', _ref3 => {
|
|
30348
|
-
let
|
|
30349
|
-
packet
|
|
30350
|
-
} = _ref3;
|
|
30451
|
+
let packet = _ref3.packet;
|
|
30351
30452
|
var _a;
|
|
30352
30453
|
(_a = this.engine) === null || _a === void 0 ? void 0 : _a.sendDataPacket(packet, DataChannelKind.RELIABLE);
|
|
30353
30454
|
});
|
|
@@ -30370,16 +30471,32 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30370
30471
|
this.switchActiveDevice('audiooutput', unwrapConstraint(this.options.audioOutput.deviceId)).catch(e => this.log.warn("Could not set audio output: ".concat(e.message)));
|
|
30371
30472
|
}
|
|
30372
30473
|
if (isWeb()) {
|
|
30373
|
-
const
|
|
30374
|
-
|
|
30375
|
-
(_f = (_e = navigator.mediaDevices) === null || _e === void 0 ? void 0 : _e.addEventListener) === null || _f === void 0 ? void 0 : _f.call(_e, 'devicechange', this.handleDeviceChange, {
|
|
30376
|
-
signal: abortController.signal
|
|
30377
|
-
});
|
|
30474
|
+
const cleanupController = new AbortController();
|
|
30475
|
+
let onDeviceChange;
|
|
30378
30476
|
if (Room.cleanupRegistry) {
|
|
30477
|
+
// Wrap the listener in a WeakRef closure so navigator.mediaDevices does not
|
|
30478
|
+
// strongly retain the Room. When the user drops their Room ref, the
|
|
30479
|
+
// FinalizationRegistry callback aborts the controller and removes the listener.
|
|
30480
|
+
const roomRef = new WeakRef(this);
|
|
30481
|
+
onDeviceChange = () => {
|
|
30482
|
+
const self = roomRef.deref();
|
|
30483
|
+
if (!self) {
|
|
30484
|
+
return;
|
|
30485
|
+
}
|
|
30486
|
+
self.handleDeviceChange();
|
|
30487
|
+
};
|
|
30379
30488
|
Room.cleanupRegistry.register(this, () => {
|
|
30380
|
-
|
|
30489
|
+
cleanupController.abort();
|
|
30381
30490
|
});
|
|
30491
|
+
} else {
|
|
30492
|
+
// Legacy browsers without WeakRef/FinalizationRegistry: fall back to a
|
|
30493
|
+
// direct listener (matches pre-#1944 behavior).
|
|
30494
|
+
onDeviceChange = this.handleDeviceChange;
|
|
30382
30495
|
}
|
|
30496
|
+
// in order to catch device changes prior to room connection we need to register the event in the constructor
|
|
30497
|
+
(_f = (_e = navigator.mediaDevices) === null || _e === void 0 ? void 0 : _e.addEventListener) === null || _f === void 0 ? void 0 : _f.call(_e, 'devicechange', onDeviceChange, {
|
|
30498
|
+
signal: cleanupController.signal
|
|
30499
|
+
});
|
|
30383
30500
|
}
|
|
30384
30501
|
}
|
|
30385
30502
|
registerTextStreamHandler(topic, callback) {
|
|
@@ -30619,7 +30736,9 @@ class Room extends eventsExports.EventEmitter {
|
|
|
30619
30736
|
this.outgoingDataTrackManager.receivedSfuUnpublishResponse(event.info.pubHandle);
|
|
30620
30737
|
}).on(EngineEvent.DataTrackSubscriberHandles, event => {
|
|
30621
30738
|
const handleToSidMapping = new Map(Object.entries(event.subHandles).map(_ref4 => {
|
|
30622
|
-
let
|
|
30739
|
+
let _ref5 = _slicedToArray(_ref4, 2),
|
|
30740
|
+
key = _ref5[0],
|
|
30741
|
+
value = _ref5[1];
|
|
30623
30742
|
return [parseInt(key, 10), value.trackSid];
|
|
30624
30743
|
}));
|
|
30625
30744
|
this.incomingDataTrackManager.receivedSfuSubscriberHandles(handleToSidMapping);
|
|
@@ -31073,10 +31192,8 @@ class Room extends eventsExports.EventEmitter {
|
|
|
31073
31192
|
}
|
|
31074
31193
|
}
|
|
31075
31194
|
handleLocalTrackSubscribed(subscribedSid) {
|
|
31076
|
-
const findPublication = () => this.localParticipant.getTrackPublications().find(
|
|
31077
|
-
let
|
|
31078
|
-
trackSid
|
|
31079
|
-
} = _ref5;
|
|
31195
|
+
const findPublication = () => this.localParticipant.getTrackPublications().find(_ref6 => {
|
|
31196
|
+
let trackSid = _ref6.trackSid;
|
|
31080
31197
|
return trackSid === subscribedSid;
|
|
31081
31198
|
});
|
|
31082
31199
|
const trackPublication = findPublication();
|
|
@@ -31401,22 +31518,18 @@ class Room extends eventsExports.EventEmitter {
|
|
|
31401
31518
|
}
|
|
31402
31519
|
}
|
|
31403
31520
|
registerRpcDataStreamHandler() {
|
|
31404
|
-
this.incomingDataStreamManager.registerTextStreamHandler(RPC_REQUEST_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader,
|
|
31521
|
+
this.incomingDataStreamManager.registerTextStreamHandler(RPC_REQUEST_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref7) {
|
|
31405
31522
|
var _this4 = this;
|
|
31406
|
-
let
|
|
31407
|
-
identity
|
|
31408
|
-
} = _ref6;
|
|
31523
|
+
let identity = _ref7.identity;
|
|
31409
31524
|
return function* () {
|
|
31410
31525
|
var _b;
|
|
31411
31526
|
const attributes = (_b = reader.info.attributes) !== null && _b !== void 0 ? _b : {};
|
|
31412
31527
|
yield _this4.rpcServerManager.handleIncomingDataStream(reader, identity, attributes);
|
|
31413
31528
|
}();
|
|
31414
31529
|
}));
|
|
31415
|
-
this.incomingDataStreamManager.registerTextStreamHandler(RPC_RESPONSE_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader,
|
|
31530
|
+
this.incomingDataStreamManager.registerTextStreamHandler(RPC_RESPONSE_DATA_STREAM_TOPIC, (reader_1, _a) => __awaiter(this, [reader_1, _a], void 0, function (reader, _ref8) {
|
|
31416
31531
|
var _this5 = this;
|
|
31417
|
-
let
|
|
31418
|
-
identity
|
|
31419
|
-
} = _ref7;
|
|
31532
|
+
let identity = _ref8.identity;
|
|
31420
31533
|
return function* () {
|
|
31421
31534
|
var _b;
|
|
31422
31535
|
const attributes = (_b = reader.info.attributes) !== null && _b !== void 0 ? _b : {};
|
|
@@ -31469,8 +31582,10 @@ class Room extends eventsExports.EventEmitter {
|
|
|
31469
31582
|
return true;
|
|
31470
31583
|
}
|
|
31471
31584
|
emitBufferedEvents() {
|
|
31472
|
-
this.bufferedEvents.forEach(
|
|
31473
|
-
let
|
|
31585
|
+
this.bufferedEvents.forEach(_ref9 => {
|
|
31586
|
+
let _ref0 = _slicedToArray(_ref9, 2),
|
|
31587
|
+
ev = _ref0[0],
|
|
31588
|
+
args = _ref0[1];
|
|
31474
31589
|
this.emit(ev, ...args);
|
|
31475
31590
|
});
|
|
31476
31591
|
this.bufferedEvents = [];
|
|
@@ -31621,7 +31736,7 @@ class Room extends eventsExports.EventEmitter {
|
|
|
31621
31736
|
return super.emit(event, ...args);
|
|
31622
31737
|
}
|
|
31623
31738
|
}
|
|
31624
|
-
Room.cleanupRegistry = typeof FinalizationRegistry !== 'undefined' && new FinalizationRegistry(cleanup => {
|
|
31739
|
+
Room.cleanupRegistry = typeof FinalizationRegistry !== 'undefined' && typeof WeakRef !== 'undefined' && new FinalizationRegistry(cleanup => {
|
|
31625
31740
|
cleanup();
|
|
31626
31741
|
});
|
|
31627
31742
|
function mapArgs(args) {
|
|
@@ -32423,28 +32538,7 @@ class TokenSourceFixed {}
|
|
|
32423
32538
|
* A few common downstream implementers are {@link TokenSourceEndpoint}
|
|
32424
32539
|
* and {@link TokenSourceCustom}.
|
|
32425
32540
|
*/
|
|
32426
|
-
class TokenSourceConfigurable {}
|
|
32427
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
32428
|
-
value: t,
|
|
32429
|
-
enumerable: true,
|
|
32430
|
-
configurable: true,
|
|
32431
|
-
writable: true
|
|
32432
|
-
}) : e[r] = t, e;
|
|
32433
|
-
}
|
|
32434
|
-
function _toPrimitive(t, r) {
|
|
32435
|
-
if ("object" != typeof t || !t) return t;
|
|
32436
|
-
var e = t[Symbol.toPrimitive];
|
|
32437
|
-
if (void 0 !== e) {
|
|
32438
|
-
var i = e.call(t, r);
|
|
32439
|
-
if ("object" != typeof i) return i;
|
|
32440
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
32441
|
-
}
|
|
32442
|
-
return ("string" === r ? String : Number)(t);
|
|
32443
|
-
}
|
|
32444
|
-
function _toPropertyKey(t) {
|
|
32445
|
-
var i = _toPrimitive(t, "string");
|
|
32446
|
-
return "symbol" == typeof i ? i : i + "";
|
|
32447
|
-
}new TextEncoder();
|
|
32541
|
+
class TokenSourceConfigurable {}new TextEncoder();
|
|
32448
32542
|
const decoder = new TextDecoder();function decodeBase64(encoded) {
|
|
32449
32543
|
if (Uint8Array.fromBase64) {
|
|
32450
32544
|
return Uint8Array.fromBase64(encoded);
|
|
@@ -32632,10 +32726,9 @@ function isObject(input) {
|
|
|
32632
32726
|
return Object.getPrototypeOf(input) === proto;
|
|
32633
32727
|
}function decodeJwt(jwt) {
|
|
32634
32728
|
if (typeof jwt !== 'string') throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');
|
|
32635
|
-
const
|
|
32636
|
-
1
|
|
32637
|
-
length
|
|
32638
|
-
} = jwt.split('.');
|
|
32729
|
+
const _jwt$split = jwt.split('.'),
|
|
32730
|
+
payload = _jwt$split[1],
|
|
32731
|
+
length = _jwt$split.length;
|
|
32639
32732
|
if (length === 5) throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');
|
|
32640
32733
|
if (length !== 3) throw new JWTInvalid('Invalid JWT');
|
|
32641
32734
|
if (!payload) throw new JWTInvalid('JWTs must contain a payload');
|
|
@@ -32670,10 +32763,8 @@ function isResponseTokenValid(response) {
|
|
|
32670
32763
|
/** Given a LiveKit generated participant token, decodes and returns the associated {@link TokenPayload} data. */
|
|
32671
32764
|
function decodeTokenPayload(token) {
|
|
32672
32765
|
const payload = decodeJwt(token);
|
|
32673
|
-
|
|
32674
|
-
|
|
32675
|
-
} = payload,
|
|
32676
|
-
rest = __rest(payload, ["roomConfig"]);
|
|
32766
|
+
payload.roomConfig;
|
|
32767
|
+
const rest = __rest(payload, ["roomConfig"]);
|
|
32677
32768
|
const mappedPayload = Object.assign(Object.assign({}, rest), {
|
|
32678
32769
|
roomConfig: payload.roomConfig ? RoomConfiguration.fromJson(payload.roomConfig, {
|
|
32679
32770
|
ignoreUnknownFields: true
|
|
@@ -32883,9 +32974,8 @@ class TokenSourceEndpoint extends TokenSourceCached {
|
|
|
32883
32974
|
}
|
|
32884
32975
|
class TokenSourceSandboxTokenServer extends TokenSourceEndpoint {
|
|
32885
32976
|
constructor(sandboxId, options) {
|
|
32886
|
-
const
|
|
32887
|
-
|
|
32888
|
-
} = options,
|
|
32977
|
+
const _options$baseUrl = options.baseUrl,
|
|
32978
|
+
baseUrl = _options$baseUrl === void 0 ? 'https://cloud-api.livekit.io' : _options$baseUrl,
|
|
32889
32979
|
rest = __rest(options, ["baseUrl"]);
|
|
32890
32980
|
super("".concat(baseUrl, "/api/v2/sandbox/connection-details"), Object.assign(Object.assign({}, rest), {
|
|
32891
32981
|
headers: {
|
|
@@ -33003,7 +33093,8 @@ function facingModeFromDeviceLabel(deviceLabel) {
|
|
|
33003
33093
|
}
|
|
33004
33094
|
// Can we match against sections of the device label.
|
|
33005
33095
|
return (_a = Array.from(knownDeviceLabelSections.entries()).find(_ref => {
|
|
33006
|
-
let
|
|
33096
|
+
let _ref2 = _slicedToArray(_ref, 1),
|
|
33097
|
+
section = _ref2[0];
|
|
33007
33098
|
return label.includes(section);
|
|
33008
33099
|
})) === null || _a === void 0 ? void 0 : _a[1];
|
|
33009
33100
|
}
|