livekit-client 1.2.3 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/livekit-client.esm.mjs +1002 -778
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +34 -34
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc.d.ts +124 -124
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
- package/dist/src/room/DeviceManager.d.ts +1 -0
- package/dist/src/room/DeviceManager.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +4 -1
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +1 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +4 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts +0 -1
- package/dist/src/room/track/LocalAudioTrack.d.ts.map +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts +1 -1
- package/dist/src/room/track/LocalVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/RemoteTrackPublication.d.ts.map +1 -1
- package/dist/src/room/track/RemoteVideoTrack.d.ts +0 -2
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -1
- package/dist/src/room/utils.d.ts.map +1 -1
- package/package.json +36 -34
- package/src/room/DeviceManager.ts +23 -1
- package/src/room/RTCEngine.ts +30 -6
- package/src/room/Room.ts +149 -152
- package/src/room/participant/LocalParticipant.ts +13 -3
- package/src/room/participant/RemoteParticipant.ts +14 -13
- package/src/room/track/LocalAudioTrack.ts +0 -2
- package/src/room/track/LocalVideoTrack.ts +3 -7
- package/src/room/track/RemoteTrackPublication.ts +1 -1
- package/src/room/track/RemoteVideoTrack.ts +0 -3
- package/src/room/track/create.ts +16 -1
- package/src/room/utils.ts +7 -5
@@ -1607,9 +1607,11 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
1607
1607
|
return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
|
1608
1608
|
};
|
1609
1609
|
|
1610
|
+
var minimal$1 = {exports: {}};
|
1611
|
+
|
1610
1612
|
var indexMinimal = {};
|
1611
1613
|
|
1612
|
-
var minimal
|
1614
|
+
var minimal = {};
|
1613
1615
|
|
1614
1616
|
var aspromise = asPromise;
|
1615
1617
|
/**
|
@@ -2387,618 +2389,656 @@ function pool(alloc, slice, size) {
|
|
2387
2389
|
};
|
2388
2390
|
}
|
2389
2391
|
|
2390
|
-
var longbits
|
2391
|
-
var
|
2392
|
-
/**
|
2393
|
-
* Constructs new long bits.
|
2394
|
-
* @classdesc Helper class for working with the low and high bits of a 64 bit value.
|
2395
|
-
* @memberof util
|
2396
|
-
* @constructor
|
2397
|
-
* @param {number} lo Low 32 bits, unsigned
|
2398
|
-
* @param {number} hi High 32 bits, unsigned
|
2399
|
-
*/
|
2392
|
+
var longbits;
|
2393
|
+
var hasRequiredLongbits;
|
2400
2394
|
|
2401
|
-
function
|
2402
|
-
|
2403
|
-
|
2395
|
+
function requireLongbits() {
|
2396
|
+
if (hasRequiredLongbits) return longbits;
|
2397
|
+
hasRequiredLongbits = 1;
|
2404
2398
|
|
2399
|
+
longbits = LongBits;
|
2400
|
+
var util = requireMinimal();
|
2405
2401
|
/**
|
2406
|
-
*
|
2407
|
-
* @
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
* High bits
|
2412
|
-
* @type {number}
|
2402
|
+
* Constructs new long bits.
|
2403
|
+
* @classdesc Helper class for working with the low and high bits of a 64 bit value.
|
2404
|
+
* @memberof util
|
2405
|
+
* @constructor
|
2406
|
+
* @param {number} lo Low 32 bits, unsigned
|
2407
|
+
* @param {number} hi High 32 bits, unsigned
|
2413
2408
|
*/
|
2414
2409
|
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
* Zero bits.
|
2419
|
-
* @memberof util.LongBits
|
2420
|
-
* @type {util.LongBits}
|
2421
|
-
*/
|
2410
|
+
function LongBits(lo, hi) {
|
2411
|
+
// note that the casts below are theoretically unnecessary as of today, but older statically
|
2412
|
+
// generated converter code might still call the ctor with signed 32bits. kept for compat.
|
2422
2413
|
|
2414
|
+
/**
|
2415
|
+
* Low bits.
|
2416
|
+
* @type {number}
|
2417
|
+
*/
|
2418
|
+
this.lo = lo >>> 0;
|
2419
|
+
/**
|
2420
|
+
* High bits.
|
2421
|
+
* @type {number}
|
2422
|
+
*/
|
2423
2423
|
|
2424
|
-
|
2424
|
+
this.hi = hi >>> 0;
|
2425
|
+
}
|
2426
|
+
/**
|
2427
|
+
* Zero bits.
|
2428
|
+
* @memberof util.LongBits
|
2429
|
+
* @type {util.LongBits}
|
2430
|
+
*/
|
2425
2431
|
|
2426
|
-
zero.toNumber = function () {
|
2427
|
-
return 0;
|
2428
|
-
};
|
2429
2432
|
|
2430
|
-
zero
|
2431
|
-
return this;
|
2432
|
-
};
|
2433
|
+
var zero = LongBits.zero = new LongBits(0, 0);
|
2433
2434
|
|
2434
|
-
zero.
|
2435
|
-
|
2436
|
-
};
|
2437
|
-
/**
|
2438
|
-
* Zero hash.
|
2439
|
-
* @memberof util.LongBits
|
2440
|
-
* @type {string}
|
2441
|
-
*/
|
2435
|
+
zero.toNumber = function () {
|
2436
|
+
return 0;
|
2437
|
+
};
|
2442
2438
|
|
2439
|
+
zero.zzEncode = zero.zzDecode = function () {
|
2440
|
+
return this;
|
2441
|
+
};
|
2443
2442
|
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2443
|
+
zero.length = function () {
|
2444
|
+
return 1;
|
2445
|
+
};
|
2446
|
+
/**
|
2447
|
+
* Zero hash.
|
2448
|
+
* @memberof util.LongBits
|
2449
|
+
* @type {string}
|
2450
|
+
*/
|
2450
2451
|
|
2451
|
-
LongBits$2.fromNumber = function fromNumber(value) {
|
2452
|
-
if (value === 0) return zero;
|
2453
|
-
var sign = value < 0;
|
2454
|
-
if (sign) value = -value;
|
2455
|
-
var lo = value >>> 0,
|
2456
|
-
hi = (value - lo) / 4294967296 >>> 0;
|
2457
2452
|
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2453
|
+
var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
|
2454
|
+
/**
|
2455
|
+
* Constructs new long bits from the specified number.
|
2456
|
+
* @param {number} value Value
|
2457
|
+
* @returns {util.LongBits} Instance
|
2458
|
+
*/
|
2461
2459
|
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2460
|
+
LongBits.fromNumber = function fromNumber(value) {
|
2461
|
+
if (value === 0) return zero;
|
2462
|
+
var sign = value < 0;
|
2463
|
+
if (sign) value = -value;
|
2464
|
+
var lo = value >>> 0,
|
2465
|
+
hi = (value - lo) / 4294967296 >>> 0;
|
2467
2466
|
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
* Constructs new long bits from a number, long or string.
|
2472
|
-
* @param {Long|number|string} value Value
|
2473
|
-
* @returns {util.LongBits} Instance
|
2474
|
-
*/
|
2467
|
+
if (sign) {
|
2468
|
+
hi = ~hi >>> 0;
|
2469
|
+
lo = ~lo >>> 0;
|
2475
2470
|
|
2471
|
+
if (++lo > 4294967295) {
|
2472
|
+
lo = 0;
|
2473
|
+
if (++hi > 4294967295) hi = 0;
|
2474
|
+
}
|
2475
|
+
}
|
2476
2476
|
|
2477
|
-
|
2478
|
-
|
2477
|
+
return new LongBits(lo, hi);
|
2478
|
+
};
|
2479
|
+
/**
|
2480
|
+
* Constructs new long bits from a number, long or string.
|
2481
|
+
* @param {Long|number|string} value Value
|
2482
|
+
* @returns {util.LongBits} Instance
|
2483
|
+
*/
|
2479
2484
|
|
2480
|
-
if (util$5.isString(value)) {
|
2481
|
-
/* istanbul ignore else */
|
2482
|
-
if (util$5.Long) value = util$5.Long.fromString(value);else return LongBits$2.fromNumber(parseInt(value, 10));
|
2483
|
-
}
|
2484
2485
|
|
2485
|
-
|
2486
|
-
|
2487
|
-
/**
|
2488
|
-
* Converts this long bits to a possibly unsafe JavaScript number.
|
2489
|
-
* @param {boolean} [unsigned=false] Whether unsigned or not
|
2490
|
-
* @returns {number} Possibly unsafe number
|
2491
|
-
*/
|
2486
|
+
LongBits.from = function from(value) {
|
2487
|
+
if (typeof value === "number") return LongBits.fromNumber(value);
|
2492
2488
|
|
2489
|
+
if (util.isString(value)) {
|
2490
|
+
/* istanbul ignore else */
|
2491
|
+
if (util.Long) value = util.Long.fromString(value);else return LongBits.fromNumber(parseInt(value, 10));
|
2492
|
+
}
|
2493
2493
|
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2494
|
+
return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
|
2495
|
+
};
|
2496
|
+
/**
|
2497
|
+
* Converts this long bits to a possibly unsafe JavaScript number.
|
2498
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
2499
|
+
* @returns {number} Possibly unsafe number
|
2500
|
+
*/
|
2501
2501
|
|
2502
|
-
return this.lo + this.hi * 4294967296;
|
2503
|
-
};
|
2504
|
-
/**
|
2505
|
-
* Converts this long bits to a long.
|
2506
|
-
* @param {boolean} [unsigned=false] Whether unsigned or not
|
2507
|
-
* @returns {Long} Long
|
2508
|
-
*/
|
2509
2502
|
|
2503
|
+
LongBits.prototype.toNumber = function toNumber(unsigned) {
|
2504
|
+
if (!unsigned && this.hi >>> 31) {
|
2505
|
+
var lo = ~this.lo + 1 >>> 0,
|
2506
|
+
hi = ~this.hi >>> 0;
|
2507
|
+
if (!lo) hi = hi + 1 >>> 0;
|
2508
|
+
return -(lo + hi * 4294967296);
|
2509
|
+
}
|
2510
2510
|
|
2511
|
-
|
2512
|
-
return util$5.Long ? new util$5.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
|
2513
|
-
/* istanbul ignore next */
|
2514
|
-
: {
|
2515
|
-
low: this.lo | 0,
|
2516
|
-
high: this.hi | 0,
|
2517
|
-
unsigned: Boolean(unsigned)
|
2511
|
+
return this.lo + this.hi * 4294967296;
|
2518
2512
|
};
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
* @param {string} hash Hash
|
2525
|
-
* @returns {util.LongBits} Bits
|
2526
|
-
*/
|
2513
|
+
/**
|
2514
|
+
* Converts this long bits to a long.
|
2515
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
2516
|
+
* @returns {Long} Long
|
2517
|
+
*/
|
2527
2518
|
|
2528
|
-
LongBits$2.fromHash = function fromHash(hash) {
|
2529
|
-
if (hash === zeroHash) return zero;
|
2530
|
-
return new LongBits$2((charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0, (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0);
|
2531
|
-
};
|
2532
|
-
/**
|
2533
|
-
* Converts this long bits to a 8 characters long hash.
|
2534
|
-
* @returns {string} Hash
|
2535
|
-
*/
|
2536
2519
|
|
2520
|
+
LongBits.prototype.toLong = function toLong(unsigned) {
|
2521
|
+
return util.Long ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))
|
2522
|
+
/* istanbul ignore next */
|
2523
|
+
: {
|
2524
|
+
low: this.lo | 0,
|
2525
|
+
high: this.hi | 0,
|
2526
|
+
unsigned: Boolean(unsigned)
|
2527
|
+
};
|
2528
|
+
};
|
2537
2529
|
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
*/
|
2530
|
+
var charCodeAt = String.prototype.charCodeAt;
|
2531
|
+
/**
|
2532
|
+
* Constructs new long bits from the specified 8 characters long hash.
|
2533
|
+
* @param {string} hash Hash
|
2534
|
+
* @returns {util.LongBits} Bits
|
2535
|
+
*/
|
2545
2536
|
|
2537
|
+
LongBits.fromHash = function fromHash(hash) {
|
2538
|
+
if (hash === zeroHash) return zero;
|
2539
|
+
return new LongBits((charCodeAt.call(hash, 0) | charCodeAt.call(hash, 1) << 8 | charCodeAt.call(hash, 2) << 16 | charCodeAt.call(hash, 3) << 24) >>> 0, (charCodeAt.call(hash, 4) | charCodeAt.call(hash, 5) << 8 | charCodeAt.call(hash, 6) << 16 | charCodeAt.call(hash, 7) << 24) >>> 0);
|
2540
|
+
};
|
2541
|
+
/**
|
2542
|
+
* Converts this long bits to a 8 characters long hash.
|
2543
|
+
* @returns {string} Hash
|
2544
|
+
*/
|
2546
2545
|
|
2547
|
-
LongBits$2.prototype.zzEncode = function zzEncode() {
|
2548
|
-
var mask = this.hi >> 31;
|
2549
|
-
this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
|
2550
|
-
this.lo = (this.lo << 1 ^ mask) >>> 0;
|
2551
|
-
return this;
|
2552
|
-
};
|
2553
|
-
/**
|
2554
|
-
* Zig-zag decodes this long bits.
|
2555
|
-
* @returns {util.LongBits} `this`
|
2556
|
-
*/
|
2557
2546
|
|
2547
|
+
LongBits.prototype.toHash = function toHash() {
|
2548
|
+
return String.fromCharCode(this.lo & 255, this.lo >>> 8 & 255, this.lo >>> 16 & 255, this.lo >>> 24, this.hi & 255, this.hi >>> 8 & 255, this.hi >>> 16 & 255, this.hi >>> 24);
|
2549
|
+
};
|
2550
|
+
/**
|
2551
|
+
* Zig-zag encodes this long bits.
|
2552
|
+
* @returns {util.LongBits} `this`
|
2553
|
+
*/
|
2558
2554
|
|
2559
|
-
LongBits$2.prototype.zzDecode = function zzDecode() {
|
2560
|
-
var mask = -(this.lo & 1);
|
2561
|
-
this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
|
2562
|
-
this.hi = (this.hi >>> 1 ^ mask) >>> 0;
|
2563
|
-
return this;
|
2564
|
-
};
|
2565
|
-
/**
|
2566
|
-
* Calculates the length of this longbits when encoded as a varint.
|
2567
|
-
* @returns {number} Length
|
2568
|
-
*/
|
2569
2555
|
|
2556
|
+
LongBits.prototype.zzEncode = function zzEncode() {
|
2557
|
+
var mask = this.hi >> 31;
|
2558
|
+
this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
|
2559
|
+
this.lo = (this.lo << 1 ^ mask) >>> 0;
|
2560
|
+
return this;
|
2561
|
+
};
|
2562
|
+
/**
|
2563
|
+
* Zig-zag decodes this long bits.
|
2564
|
+
* @returns {util.LongBits} `this`
|
2565
|
+
*/
|
2570
2566
|
|
2571
|
-
LongBits$2.prototype.length = function length() {
|
2572
|
-
var part0 = this.lo,
|
2573
|
-
part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
|
2574
|
-
part2 = this.hi >>> 24;
|
2575
|
-
return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10;
|
2576
|
-
};
|
2577
2567
|
|
2578
|
-
|
2568
|
+
LongBits.prototype.zzDecode = function zzDecode() {
|
2569
|
+
var mask = -(this.lo & 1);
|
2570
|
+
this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
|
2571
|
+
this.hi = (this.hi >>> 1 ^ mask) >>> 0;
|
2572
|
+
return this;
|
2573
|
+
};
|
2574
|
+
/**
|
2575
|
+
* Calculates the length of this longbits when encoded as a varint.
|
2576
|
+
* @returns {number} Length
|
2577
|
+
*/
|
2579
2578
|
|
2580
|
-
var util = exports; // used to return a Promise where callback is omitted
|
2581
2579
|
|
2582
|
-
|
2580
|
+
LongBits.prototype.length = function length() {
|
2581
|
+
var part0 = this.lo,
|
2582
|
+
part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,
|
2583
|
+
part2 = this.hi >>> 24;
|
2584
|
+
return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10;
|
2585
|
+
};
|
2583
2586
|
|
2584
|
-
|
2587
|
+
return longbits;
|
2588
|
+
}
|
2585
2589
|
|
2586
|
-
|
2590
|
+
var hasRequiredMinimal;
|
2587
2591
|
|
2588
|
-
|
2592
|
+
function requireMinimal() {
|
2593
|
+
if (hasRequiredMinimal) return minimal;
|
2594
|
+
hasRequiredMinimal = 1;
|
2589
2595
|
|
2590
|
-
|
2596
|
+
(function (exports) {
|
2591
2597
|
|
2592
|
-
|
2598
|
+
var util = exports; // used to return a Promise where callback is omitted
|
2593
2599
|
|
2594
|
-
|
2600
|
+
util.asPromise = aspromise; // converts to / from base64 encoded strings
|
2595
2601
|
|
2596
|
-
|
2597
|
-
/**
|
2598
|
-
* Whether running within node or not.
|
2599
|
-
* @memberof util
|
2600
|
-
* @type {boolean}
|
2601
|
-
*/
|
2602
|
+
util.base64 = base64$1; // base class of rpc.Service
|
2602
2603
|
|
2603
|
-
|
2604
|
-
/**
|
2605
|
-
* Global object reference.
|
2606
|
-
* @memberof util
|
2607
|
-
* @type {Object}
|
2608
|
-
*/
|
2604
|
+
util.EventEmitter = eventemitter; // float handling accross browsers
|
2609
2605
|
|
2610
|
-
|
2606
|
+
util.float = float; // requires modules optionally and hides the call from bundlers
|
2611
2607
|
|
2612
|
-
|
2613
|
-
* An immuable empty array.
|
2614
|
-
* @memberof util
|
2615
|
-
* @type {Array.<*>}
|
2616
|
-
* @const
|
2617
|
-
*/
|
2608
|
+
util.inquire = inquire_1; // converts to / from utf8 encoded strings
|
2618
2609
|
|
2619
|
-
|
2620
|
-
/* istanbul ignore next */
|
2621
|
-
[]; // used on prototypes
|
2610
|
+
util.utf8 = utf8$2; // provides a node-like buffer pool in the browser
|
2622
2611
|
|
2623
|
-
|
2624
|
-
* An immutable empty object.
|
2625
|
-
* @type {Object}
|
2626
|
-
* @const
|
2627
|
-
*/
|
2612
|
+
util.pool = pool_1; // utility to work with the low and high bits of a 64 bit value
|
2628
2613
|
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2614
|
+
util.LongBits = requireLongbits();
|
2615
|
+
/**
|
2616
|
+
* Whether running within node or not.
|
2617
|
+
* @memberof util
|
2618
|
+
* @type {boolean}
|
2619
|
+
*/
|
2632
2620
|
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2621
|
+
util.isNode = Boolean(typeof commonjsGlobal !== "undefined" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node);
|
2622
|
+
/**
|
2623
|
+
* Global object reference.
|
2624
|
+
* @memberof util
|
2625
|
+
* @type {Object}
|
2626
|
+
*/
|
2639
2627
|
|
2640
|
-
|
2641
|
-
/* istanbul ignore next */
|
2642
|
-
function isInteger(value) {
|
2643
|
-
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
2644
|
-
};
|
2645
|
-
/**
|
2646
|
-
* Tests if the specified value is a string.
|
2647
|
-
* @param {*} value Value to test
|
2648
|
-
* @returns {boolean} `true` if the value is a string
|
2649
|
-
*/
|
2628
|
+
util.global = util.isNode && commonjsGlobal || typeof window !== "undefined" && window || typeof self !== "undefined" && self || commonjsGlobal; // eslint-disable-line no-invalid-this
|
2650
2629
|
|
2630
|
+
/**
|
2631
|
+
* An immuable empty array.
|
2632
|
+
* @memberof util
|
2633
|
+
* @type {Array.<*>}
|
2634
|
+
* @const
|
2635
|
+
*/
|
2651
2636
|
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
/**
|
2656
|
-
* Tests if the specified value is a non-null object.
|
2657
|
-
* @param {*} value Value to test
|
2658
|
-
* @returns {boolean} `true` if the value is a non-null object
|
2659
|
-
*/
|
2637
|
+
util.emptyArray = Object.freeze ? Object.freeze([]) :
|
2638
|
+
/* istanbul ignore next */
|
2639
|
+
[]; // used on prototypes
|
2660
2640
|
|
2641
|
+
/**
|
2642
|
+
* An immutable empty object.
|
2643
|
+
* @type {Object}
|
2644
|
+
* @const
|
2645
|
+
*/
|
2661
2646
|
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
/**
|
2666
|
-
* Checks if a property on a message is considered to be present.
|
2667
|
-
* This is an alias of {@link util.isSet}.
|
2668
|
-
* @function
|
2669
|
-
* @param {Object} obj Plain object or message instance
|
2670
|
-
* @param {string} prop Property name
|
2671
|
-
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
2672
|
-
*/
|
2647
|
+
util.emptyObject = Object.freeze ? Object.freeze({}) :
|
2648
|
+
/* istanbul ignore next */
|
2649
|
+
{}; // used on prototypes
|
2673
2650
|
|
2651
|
+
/**
|
2652
|
+
* Tests if the specified value is an integer.
|
2653
|
+
* @function
|
2654
|
+
* @param {*} value Value to test
|
2655
|
+
* @returns {boolean} `true` if the value is an integer
|
2656
|
+
*/
|
2674
2657
|
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
2686
|
-
return false;
|
2687
|
-
};
|
2688
|
-
/**
|
2689
|
-
* Any compatible Buffer instance.
|
2690
|
-
* This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
|
2691
|
-
* @interface Buffer
|
2692
|
-
* @extends Uint8Array
|
2693
|
-
*/
|
2658
|
+
util.isInteger = Number.isInteger ||
|
2659
|
+
/* istanbul ignore next */
|
2660
|
+
function isInteger(value) {
|
2661
|
+
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
2662
|
+
};
|
2663
|
+
/**
|
2664
|
+
* Tests if the specified value is a string.
|
2665
|
+
* @param {*} value Value to test
|
2666
|
+
* @returns {boolean} `true` if the value is a string
|
2667
|
+
*/
|
2694
2668
|
|
2695
|
-
/**
|
2696
|
-
* Node's Buffer class if available.
|
2697
|
-
* @type {Constructor<Buffer>}
|
2698
|
-
*/
|
2699
2669
|
|
2670
|
+
util.isString = function isString(value) {
|
2671
|
+
return typeof value === "string" || value instanceof String;
|
2672
|
+
};
|
2673
|
+
/**
|
2674
|
+
* Tests if the specified value is a non-null object.
|
2675
|
+
* @param {*} value Value to test
|
2676
|
+
* @returns {boolean} `true` if the value is a non-null object
|
2677
|
+
*/
|
2700
2678
|
|
2701
|
-
util.Buffer = function () {
|
2702
|
-
try {
|
2703
|
-
var Buffer = util.inquire("buffer").Buffer; // refuse to use non-node buffers if not explicitly assigned (perf reasons):
|
2704
2679
|
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2712
|
-
|
2680
|
+
util.isObject = function isObject(value) {
|
2681
|
+
return value && typeof value === "object";
|
2682
|
+
};
|
2683
|
+
/**
|
2684
|
+
* Checks if a property on a message is considered to be present.
|
2685
|
+
* This is an alias of {@link util.isSet}.
|
2686
|
+
* @function
|
2687
|
+
* @param {Object} obj Plain object or message instance
|
2688
|
+
* @param {string} prop Property name
|
2689
|
+
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
2690
|
+
*/
|
2713
2691
|
|
2714
2692
|
|
2715
|
-
|
2693
|
+
util.isset =
|
2694
|
+
/**
|
2695
|
+
* Checks if a property on a message is considered to be present.
|
2696
|
+
* @param {Object} obj Plain object or message instance
|
2697
|
+
* @param {string} prop Property name
|
2698
|
+
* @returns {boolean} `true` if considered to be present, otherwise `false`
|
2699
|
+
*/
|
2700
|
+
util.isSet = function isSet(obj, prop) {
|
2701
|
+
var value = obj[prop];
|
2702
|
+
if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins
|
2703
|
+
return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
|
2704
|
+
return false;
|
2705
|
+
};
|
2706
|
+
/**
|
2707
|
+
* Any compatible Buffer instance.
|
2708
|
+
* This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.
|
2709
|
+
* @interface Buffer
|
2710
|
+
* @extends Uint8Array
|
2711
|
+
*/
|
2716
2712
|
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
* @returns {Uint8Array|Buffer} Buffer
|
2722
|
-
*/
|
2713
|
+
/**
|
2714
|
+
* Node's Buffer class if available.
|
2715
|
+
* @type {Constructor<Buffer>}
|
2716
|
+
*/
|
2723
2717
|
|
2724
|
-
util.newBuffer = function newBuffer(sizeOrArray) {
|
2725
|
-
/* istanbul ignore next */
|
2726
|
-
return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray);
|
2727
|
-
};
|
2728
|
-
/**
|
2729
|
-
* Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
|
2730
|
-
* @type {Constructor<Uint8Array>}
|
2731
|
-
*/
|
2732
2718
|
|
2719
|
+
util.Buffer = function () {
|
2720
|
+
try {
|
2721
|
+
var Buffer = util.inquire("buffer").Buffer; // refuse to use non-node buffers if not explicitly assigned (perf reasons):
|
2733
2722
|
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
* @property {number} high High bits
|
2743
|
-
* @property {boolean} unsigned Whether unsigned or not
|
2744
|
-
*/
|
2723
|
+
return Buffer.prototype.utf8Write ? Buffer :
|
2724
|
+
/* istanbul ignore next */
|
2725
|
+
null;
|
2726
|
+
} catch (e) {
|
2727
|
+
/* istanbul ignore next */
|
2728
|
+
return null;
|
2729
|
+
}
|
2730
|
+
}(); // Internal alias of or polyfull for Buffer.from.
|
2745
2731
|
|
2746
|
-
/**
|
2747
|
-
* Long.js's Long class if available.
|
2748
|
-
* @type {Constructor<Long>}
|
2749
|
-
*/
|
2750
2732
|
|
2751
|
-
|
2752
|
-
/* istanbul ignore next */
|
2753
|
-
util.global.dcodeIO &&
|
2754
|
-
/* istanbul ignore next */
|
2755
|
-
util.global.dcodeIO.Long ||
|
2756
|
-
/* istanbul ignore next */
|
2757
|
-
util.global.Long || util.inquire("long");
|
2758
|
-
/**
|
2759
|
-
* Regular expression used to verify 2 bit (`bool`) map keys.
|
2760
|
-
* @type {RegExp}
|
2761
|
-
* @const
|
2762
|
-
*/
|
2733
|
+
util._Buffer_from = null; // Internal alias of or polyfill for Buffer.allocUnsafe.
|
2763
2734
|
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2735
|
+
util._Buffer_allocUnsafe = null;
|
2736
|
+
/**
|
2737
|
+
* Creates a new buffer of whatever type supported by the environment.
|
2738
|
+
* @param {number|number[]} [sizeOrArray=0] Buffer size or number array
|
2739
|
+
* @returns {Uint8Array|Buffer} Buffer
|
2740
|
+
*/
|
2770
2741
|
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2742
|
+
util.newBuffer = function newBuffer(sizeOrArray) {
|
2743
|
+
/* istanbul ignore next */
|
2744
|
+
return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray);
|
2745
|
+
};
|
2746
|
+
/**
|
2747
|
+
* Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.
|
2748
|
+
* @type {Constructor<Uint8Array>}
|
2749
|
+
*/
|
2777
2750
|
|
2778
|
-
util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
|
2779
|
-
/**
|
2780
|
-
* Converts a number or long to an 8 characters long hash string.
|
2781
|
-
* @param {Long|number} value Value to convert
|
2782
|
-
* @returns {string} Hash
|
2783
|
-
*/
|
2784
2751
|
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2752
|
+
util.Array = typeof Uint8Array !== "undefined" ? Uint8Array
|
2753
|
+
/* istanbul ignore next */
|
2754
|
+
: Array;
|
2755
|
+
/**
|
2756
|
+
* Any compatible Long instance.
|
2757
|
+
* This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.
|
2758
|
+
* @interface Long
|
2759
|
+
* @property {number} low Low bits
|
2760
|
+
* @property {number} high High bits
|
2761
|
+
* @property {boolean} unsigned Whether unsigned or not
|
2762
|
+
*/
|
2794
2763
|
|
2764
|
+
/**
|
2765
|
+
* Long.js's Long class if available.
|
2766
|
+
* @type {Constructor<Long>}
|
2767
|
+
*/
|
2795
2768
|
|
2796
|
-
|
2797
|
-
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
|
2803
|
-
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
*/
|
2769
|
+
util.Long =
|
2770
|
+
/* istanbul ignore next */
|
2771
|
+
util.global.dcodeIO &&
|
2772
|
+
/* istanbul ignore next */
|
2773
|
+
util.global.dcodeIO.Long ||
|
2774
|
+
/* istanbul ignore next */
|
2775
|
+
util.global.Long || util.inquire("long");
|
2776
|
+
/**
|
2777
|
+
* Regular expression used to verify 2 bit (`bool`) map keys.
|
2778
|
+
* @type {RegExp}
|
2779
|
+
* @const
|
2780
|
+
*/
|
2809
2781
|
|
2782
|
+
util.key2Re = /^true|false|0|1$/;
|
2783
|
+
/**
|
2784
|
+
* Regular expression used to verify 32 bit (`int32` etc.) map keys.
|
2785
|
+
* @type {RegExp}
|
2786
|
+
* @const
|
2787
|
+
*/
|
2810
2788
|
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2789
|
+
util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
|
2790
|
+
/**
|
2791
|
+
* Regular expression used to verify 64 bit (`int64` etc.) map keys.
|
2792
|
+
* @type {RegExp}
|
2793
|
+
* @const
|
2794
|
+
*/
|
2814
2795
|
|
2815
|
-
|
2816
|
-
|
2796
|
+
util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
|
2797
|
+
/**
|
2798
|
+
* Converts a number or long to an 8 characters long hash string.
|
2799
|
+
* @param {Long|number} value Value to convert
|
2800
|
+
* @returns {string} Hash
|
2801
|
+
*/
|
2817
2802
|
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2803
|
+
util.longToHash = function longToHash(value) {
|
2804
|
+
return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash;
|
2805
|
+
};
|
2806
|
+
/**
|
2807
|
+
* Converts an 8 characters long hash string to a long or number.
|
2808
|
+
* @param {string} hash Hash
|
2809
|
+
* @param {boolean} [unsigned=false] Whether unsigned or not
|
2810
|
+
* @returns {Long|number} Original value
|
2811
|
+
*/
|
2824
2812
|
|
2825
|
-
util.lcFirst = function lcFirst(str) {
|
2826
|
-
return str.charAt(0).toLowerCase() + str.substring(1);
|
2827
|
-
};
|
2828
|
-
/**
|
2829
|
-
* Creates a custom error constructor.
|
2830
|
-
* @memberof util
|
2831
|
-
* @param {string} name Error name
|
2832
|
-
* @returns {Constructor<Error>} Custom error constructor
|
2833
|
-
*/
|
2834
2813
|
|
2814
|
+
util.longFromHash = function longFromHash(hash, unsigned) {
|
2815
|
+
var bits = util.LongBits.fromHash(hash);
|
2816
|
+
if (util.Long) return util.Long.fromBits(bits.lo, bits.hi, unsigned);
|
2817
|
+
return bits.toNumber(Boolean(unsigned));
|
2818
|
+
};
|
2819
|
+
/**
|
2820
|
+
* Merges the properties of the source object into the destination object.
|
2821
|
+
* @memberof util
|
2822
|
+
* @param {Object.<string,*>} dst Destination object
|
2823
|
+
* @param {Object.<string,*>} src Source object
|
2824
|
+
* @param {boolean} [ifNotSet=false] Merges only if the key is not already set
|
2825
|
+
* @returns {Object.<string,*>} Destination object
|
2826
|
+
*/
|
2835
2827
|
|
2836
|
-
function newError(name) {
|
2837
|
-
function CustomError(message, properties) {
|
2838
|
-
if (!(this instanceof CustomError)) return new CustomError(message, properties); // Error.call(this, message);
|
2839
|
-
// ^ just returns a new error instance because the ctor can be called as a function
|
2840
2828
|
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
}
|
2845
|
-
});
|
2846
|
-
/* istanbul ignore next */
|
2829
|
+
function merge(dst, src, ifNotSet) {
|
2830
|
+
// used by converters
|
2831
|
+
for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === undefined || !ifNotSet) dst[keys[i]] = src[keys[i]];
|
2847
2832
|
|
2848
|
-
|
2849
|
-
Error.captureStackTrace(this, CustomError);else Object.defineProperty(this, "stack", {
|
2850
|
-
value: new Error().stack || ""
|
2851
|
-
});
|
2852
|
-
if (properties) merge(this, properties);
|
2833
|
+
return dst;
|
2853
2834
|
}
|
2854
2835
|
|
2855
|
-
|
2856
|
-
|
2857
|
-
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2836
|
+
util.merge = merge;
|
2837
|
+
/**
|
2838
|
+
* Converts the first character of a string to lower case.
|
2839
|
+
* @param {string} str String to convert
|
2840
|
+
* @returns {string} Converted string
|
2841
|
+
*/
|
2861
2842
|
|
2862
|
-
|
2863
|
-
return
|
2843
|
+
util.lcFirst = function lcFirst(str) {
|
2844
|
+
return str.charAt(0).toLowerCase() + str.substring(1);
|
2864
2845
|
};
|
2846
|
+
/**
|
2847
|
+
* Creates a custom error constructor.
|
2848
|
+
* @memberof util
|
2849
|
+
* @param {string} name Error name
|
2850
|
+
* @returns {Constructor<Error>} Custom error constructor
|
2851
|
+
*/
|
2865
2852
|
|
2866
|
-
return CustomError;
|
2867
|
-
}
|
2868
2853
|
|
2869
|
-
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
* @memberof util
|
2874
|
-
* @extends Error
|
2875
|
-
* @template T extends Message<T>
|
2876
|
-
* @constructor
|
2877
|
-
* @param {string} message Error message
|
2878
|
-
* @param {Object.<string,*>} [properties] Additional properties
|
2879
|
-
* @example
|
2880
|
-
* try {
|
2881
|
-
* MyMessage.decode(someBuffer); // throws if required fields are missing
|
2882
|
-
* } catch (e) {
|
2883
|
-
* if (e instanceof ProtocolError && e.instance)
|
2884
|
-
* console.log("decoded so far: " + JSON.stringify(e.instance));
|
2885
|
-
* }
|
2886
|
-
*/
|
2854
|
+
function newError(name) {
|
2855
|
+
function CustomError(message, properties) {
|
2856
|
+
if (!(this instanceof CustomError)) return new CustomError(message, properties); // Error.call(this, message);
|
2857
|
+
// ^ just returns a new error instance because the ctor can be called as a function
|
2887
2858
|
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2859
|
+
Object.defineProperty(this, "message", {
|
2860
|
+
get: function () {
|
2861
|
+
return message;
|
2862
|
+
}
|
2863
|
+
});
|
2864
|
+
/* istanbul ignore next */
|
2894
2865
|
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2866
|
+
if (Error.captureStackTrace) // node
|
2867
|
+
Error.captureStackTrace(this, CustomError);else Object.defineProperty(this, "stack", {
|
2868
|
+
value: new Error().stack || ""
|
2869
|
+
});
|
2870
|
+
if (properties) merge(this, properties);
|
2871
|
+
}
|
2901
2872
|
|
2902
|
-
|
2903
|
-
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2873
|
+
CustomError.prototype = Object.create(Error.prototype, {
|
2874
|
+
constructor: {
|
2875
|
+
value: CustomError,
|
2876
|
+
writable: true,
|
2877
|
+
enumerable: false,
|
2878
|
+
configurable: true
|
2879
|
+
},
|
2880
|
+
name: {
|
2881
|
+
get() {
|
2882
|
+
return name;
|
2883
|
+
},
|
2907
2884
|
|
2908
|
-
|
2909
|
-
|
2885
|
+
set: undefined,
|
2886
|
+
enumerable: false,
|
2887
|
+
// configurable: false would accurately preserve the behavior of
|
2888
|
+
// the original, but I'm guessing that was not intentional.
|
2889
|
+
// For an actual error subclass, this property would
|
2890
|
+
// be configurable.
|
2891
|
+
configurable: true
|
2892
|
+
},
|
2893
|
+
toString: {
|
2894
|
+
value() {
|
2895
|
+
return this.name + ": " + this.message;
|
2896
|
+
},
|
2897
|
+
|
2898
|
+
writable: true,
|
2899
|
+
enumerable: false,
|
2900
|
+
configurable: true
|
2901
|
+
}
|
2902
|
+
});
|
2903
|
+
return CustomError;
|
2904
|
+
}
|
2910
2905
|
|
2911
|
-
|
2906
|
+
util.newError = newError;
|
2912
2907
|
/**
|
2908
|
+
* Constructs a new protocol error.
|
2909
|
+
* @classdesc Error subclass indicating a protocol specifc error.
|
2910
|
+
* @memberof util
|
2911
|
+
* @extends Error
|
2912
|
+
* @template T extends Message<T>
|
2913
|
+
* @constructor
|
2914
|
+
* @param {string} message Error message
|
2915
|
+
* @param {Object.<string,*>} [properties] Additional properties
|
2916
|
+
* @example
|
2917
|
+
* try {
|
2918
|
+
* MyMessage.decode(someBuffer); // throws if required fields are missing
|
2919
|
+
* } catch (e) {
|
2920
|
+
* if (e instanceof ProtocolError && e.instance)
|
2921
|
+
* console.log("decoded so far: " + JSON.stringify(e.instance));
|
2922
|
+
* }
|
2923
|
+
*/
|
2924
|
+
|
2925
|
+
util.ProtocolError = newError("ProtocolError");
|
2926
|
+
/**
|
2927
|
+
* So far decoded message instance.
|
2928
|
+
* @name util.ProtocolError#instance
|
2929
|
+
* @type {Message<T>}
|
2930
|
+
*/
|
2931
|
+
|
2932
|
+
/**
|
2933
|
+
* A OneOf getter as returned by {@link util.oneOfGetter}.
|
2934
|
+
* @typedef OneOfGetter
|
2935
|
+
* @type {function}
|
2913
2936
|
* @returns {string|undefined} Set field name, if any
|
2914
|
-
* @this Object
|
2915
|
-
* @ignore
|
2916
2937
|
*/
|
2917
2938
|
|
2939
|
+
/**
|
2940
|
+
* Builds a getter for a oneof's present field name.
|
2941
|
+
* @param {string[]} fieldNames Field names
|
2942
|
+
* @returns {OneOfGetter} Unbound getter
|
2943
|
+
*/
|
2918
2944
|
|
2919
|
-
|
2920
|
-
|
2921
|
-
for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) return keys[i];
|
2922
|
-
};
|
2923
|
-
};
|
2924
|
-
/**
|
2925
|
-
* A OneOf setter as returned by {@link util.oneOfSetter}.
|
2926
|
-
* @typedef OneOfSetter
|
2927
|
-
* @type {function}
|
2928
|
-
* @param {string|undefined} value Field name
|
2929
|
-
* @returns {undefined}
|
2930
|
-
*/
|
2945
|
+
util.oneOfGetter = function getOneOf(fieldNames) {
|
2946
|
+
var fieldMap = {};
|
2931
2947
|
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2936
|
-
|
2948
|
+
for (var i = 0; i < fieldNames.length; ++i) fieldMap[fieldNames[i]] = 1;
|
2949
|
+
/**
|
2950
|
+
* @returns {string|undefined} Set field name, if any
|
2951
|
+
* @this Object
|
2952
|
+
* @ignore
|
2953
|
+
*/
|
2937
2954
|
|
2938
2955
|
|
2939
|
-
|
2956
|
+
return function () {
|
2957
|
+
// eslint-disable-line consistent-return
|
2958
|
+
for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) return keys[i];
|
2959
|
+
};
|
2960
|
+
};
|
2940
2961
|
/**
|
2941
|
-
*
|
2962
|
+
* A OneOf setter as returned by {@link util.oneOfSetter}.
|
2963
|
+
* @typedef OneOfSetter
|
2964
|
+
* @type {function}
|
2965
|
+
* @param {string|undefined} value Field name
|
2942
2966
|
* @returns {undefined}
|
2943
|
-
* @this Object
|
2944
|
-
* @ignore
|
2945
2967
|
*/
|
2946
|
-
|
2947
|
-
|
2968
|
+
|
2969
|
+
/**
|
2970
|
+
* Builds a setter for a oneof's present field name.
|
2971
|
+
* @param {string[]} fieldNames Field names
|
2972
|
+
* @returns {OneOfSetter} Unbound setter
|
2973
|
+
*/
|
2974
|
+
|
2975
|
+
|
2976
|
+
util.oneOfSetter = function setOneOf(fieldNames) {
|
2977
|
+
/**
|
2978
|
+
* @param {string} name Field name
|
2979
|
+
* @returns {undefined}
|
2980
|
+
* @this Object
|
2981
|
+
* @ignore
|
2982
|
+
*/
|
2983
|
+
return function (name) {
|
2984
|
+
for (var i = 0; i < fieldNames.length; ++i) if (fieldNames[i] !== name) delete this[fieldNames[i]];
|
2985
|
+
};
|
2948
2986
|
};
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
*/
|
2987
|
+
/**
|
2988
|
+
* Default conversion options used for {@link Message#toJSON} implementations.
|
2989
|
+
*
|
2990
|
+
* These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:
|
2991
|
+
*
|
2992
|
+
* - Longs become strings
|
2993
|
+
* - Enums become string keys
|
2994
|
+
* - Bytes become base64 encoded strings
|
2995
|
+
* - (Sub-)Messages become plain objects
|
2996
|
+
* - Maps become plain objects with all string keys
|
2997
|
+
* - Repeated fields become arrays
|
2998
|
+
* - NaN and Infinity for float and double fields become strings
|
2999
|
+
*
|
3000
|
+
* @type {IConversionOptions}
|
3001
|
+
* @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json
|
3002
|
+
*/
|
2966
3003
|
|
2967
3004
|
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
3005
|
+
util.toJSONOptions = {
|
3006
|
+
longs: String,
|
3007
|
+
enums: String,
|
3008
|
+
bytes: String,
|
3009
|
+
json: true
|
3010
|
+
}; // Sets up buffer utility according to the environment (called in index-minimal)
|
2974
3011
|
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
3012
|
+
util._configure = function () {
|
3013
|
+
var Buffer = util.Buffer;
|
3014
|
+
/* istanbul ignore if */
|
2978
3015
|
|
2979
|
-
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
|
3016
|
+
if (!Buffer) {
|
3017
|
+
util._Buffer_from = util._Buffer_allocUnsafe = null;
|
3018
|
+
return;
|
3019
|
+
} // because node 4.x buffers are incompatible & immutable
|
3020
|
+
// see: https://github.com/dcodeIO/protobuf.js/pull/665
|
2984
3021
|
|
2985
3022
|
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
3023
|
+
util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||
|
3024
|
+
/* istanbul ignore next */
|
3025
|
+
function Buffer_from(value, encoding) {
|
3026
|
+
return new Buffer(value, encoding);
|
3027
|
+
};
|
2991
3028
|
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
3029
|
+
util._Buffer_allocUnsafe = Buffer.allocUnsafe ||
|
3030
|
+
/* istanbul ignore next */
|
3031
|
+
function Buffer_allocUnsafe(size) {
|
3032
|
+
return new Buffer(size);
|
3033
|
+
};
|
2996
3034
|
};
|
2997
|
-
};
|
2998
|
-
|
3035
|
+
})(minimal);
|
3036
|
+
|
3037
|
+
return minimal;
|
3038
|
+
}
|
2999
3039
|
|
3000
3040
|
var writer$2 = Writer$1;
|
3001
|
-
var util$4 =
|
3041
|
+
var util$4 = requireMinimal();
|
3002
3042
|
var BufferWriter$1; // cyclic
|
3003
3043
|
|
3004
3044
|
var LongBits$1 = util$4.LongBits,
|
@@ -3478,7 +3518,7 @@ var writer_buffer = BufferWriter; // extends Writer
|
|
3478
3518
|
|
3479
3519
|
var Writer = writer$2;
|
3480
3520
|
(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
|
3481
|
-
var util$3 =
|
3521
|
+
var util$3 = requireMinimal();
|
3482
3522
|
/**
|
3483
3523
|
* Constructs a new buffer writer instance.
|
3484
3524
|
* @classdesc Wire format writer using node buffers.
|
@@ -3548,7 +3588,7 @@ BufferWriter.prototype.string = function write_string_buffer(value) {
|
|
3548
3588
|
BufferWriter._configure();
|
3549
3589
|
|
3550
3590
|
var reader = Reader$1;
|
3551
|
-
var util$2 =
|
3591
|
+
var util$2 = requireMinimal();
|
3552
3592
|
var BufferReader$1; // cyclic
|
3553
3593
|
|
3554
3594
|
var LongBits = util$2.LongBits,
|
@@ -3961,7 +4001,7 @@ var reader_buffer = BufferReader; // extends Reader
|
|
3961
4001
|
|
3962
4002
|
var Reader = reader;
|
3963
4003
|
(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
|
3964
|
-
var util$1 =
|
4004
|
+
var util$1 = requireMinimal();
|
3965
4005
|
/**
|
3966
4006
|
* Constructs a new buffer reader instance.
|
3967
4007
|
* @classdesc Wire format reader using node buffers.
|
@@ -4006,7 +4046,7 @@ BufferReader._configure();
|
|
4006
4046
|
var rpc = {};
|
4007
4047
|
|
4008
4048
|
var service = Service;
|
4009
|
-
var util =
|
4049
|
+
var util = requireMinimal(); // Extends EventEmitter
|
4010
4050
|
|
4011
4051
|
(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
|
4012
4052
|
/**
|
@@ -4198,7 +4238,7 @@ var roots = {};
|
|
4198
4238
|
protobuf.Reader = reader;
|
4199
4239
|
protobuf.BufferReader = reader_buffer; // Utility
|
4200
4240
|
|
4201
|
-
protobuf.util =
|
4241
|
+
protobuf.util = requireMinimal();
|
4202
4242
|
protobuf.rpc = rpc;
|
4203
4243
|
protobuf.roots = roots;
|
4204
4244
|
protobuf.configure = configure;
|
@@ -4221,7 +4261,10 @@ var roots = {};
|
|
4221
4261
|
configure();
|
4222
4262
|
})(indexMinimal);
|
4223
4263
|
|
4224
|
-
|
4264
|
+
(function (module) {
|
4265
|
+
|
4266
|
+
module.exports = indexMinimal;
|
4267
|
+
})(minimal$1);
|
4225
4268
|
|
4226
4269
|
/* eslint-disable */
|
4227
4270
|
|
@@ -4233,10 +4276,10 @@ var globalThis$2 = (() => {
|
|
4233
4276
|
throw 'Unable to locate global object';
|
4234
4277
|
})();
|
4235
4278
|
|
4236
|
-
if (minimal.util.Long !== long) {
|
4237
|
-
minimal.util.Long = long;
|
4279
|
+
if (minimal$1.exports.util.Long !== long) {
|
4280
|
+
minimal$1.exports.util.Long = long;
|
4238
4281
|
|
4239
|
-
minimal.configure();
|
4282
|
+
minimal$1.exports.configure();
|
4240
4283
|
}
|
4241
4284
|
|
4242
4285
|
/* eslint-disable */
|
@@ -4749,7 +4792,7 @@ function createBaseRoom() {
|
|
4749
4792
|
|
4750
4793
|
const Room$1 = {
|
4751
4794
|
encode(message) {
|
4752
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
4795
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
4753
4796
|
|
4754
4797
|
if (message.sid !== '') {
|
4755
4798
|
writer.uint32(10).string(message.sid);
|
@@ -4795,7 +4838,7 @@ const Room$1 = {
|
|
4795
4838
|
},
|
4796
4839
|
|
4797
4840
|
decode(input, length) {
|
4798
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
4841
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
4799
4842
|
let end = length === undefined ? reader.len : reader.pos + length;
|
4800
4843
|
const message = createBaseRoom();
|
4801
4844
|
|
@@ -4916,7 +4959,7 @@ function createBaseCodec() {
|
|
4916
4959
|
|
4917
4960
|
const Codec = {
|
4918
4961
|
encode(message) {
|
4919
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
4962
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
4920
4963
|
|
4921
4964
|
if (message.mime !== '') {
|
4922
4965
|
writer.uint32(10).string(message.mime);
|
@@ -4930,7 +4973,7 @@ const Codec = {
|
|
4930
4973
|
},
|
4931
4974
|
|
4932
4975
|
decode(input, length) {
|
4933
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
4976
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
4934
4977
|
let end = length === undefined ? reader.len : reader.pos + length;
|
4935
4978
|
const message = createBaseCodec();
|
4936
4979
|
|
@@ -4992,7 +5035,7 @@ function createBaseParticipantPermission() {
|
|
4992
5035
|
|
4993
5036
|
const ParticipantPermission = {
|
4994
5037
|
encode(message) {
|
4995
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5038
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
4996
5039
|
|
4997
5040
|
if (message.canSubscribe === true) {
|
4998
5041
|
writer.uint32(8).bool(message.canSubscribe);
|
@@ -5018,7 +5061,7 @@ const ParticipantPermission = {
|
|
5018
5061
|
},
|
5019
5062
|
|
5020
5063
|
decode(input, length) {
|
5021
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5064
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5022
5065
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5023
5066
|
const message = createBaseParticipantPermission();
|
5024
5067
|
|
@@ -5107,7 +5150,7 @@ function createBaseParticipantInfo() {
|
|
5107
5150
|
|
5108
5151
|
const ParticipantInfo = {
|
5109
5152
|
encode(message) {
|
5110
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5153
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5111
5154
|
|
5112
5155
|
if (message.sid !== '') {
|
5113
5156
|
writer.uint32(10).string(message.sid);
|
@@ -5157,7 +5200,7 @@ const ParticipantInfo = {
|
|
5157
5200
|
},
|
5158
5201
|
|
5159
5202
|
decode(input, length) {
|
5160
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5203
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5161
5204
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5162
5205
|
const message = createBaseParticipantInfo();
|
5163
5206
|
|
@@ -5287,7 +5330,7 @@ function createBaseSimulcastCodecInfo() {
|
|
5287
5330
|
|
5288
5331
|
const SimulcastCodecInfo = {
|
5289
5332
|
encode(message) {
|
5290
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5333
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5291
5334
|
|
5292
5335
|
if (message.mimeType !== '') {
|
5293
5336
|
writer.uint32(10).string(message.mimeType);
|
@@ -5309,7 +5352,7 @@ const SimulcastCodecInfo = {
|
|
5309
5352
|
},
|
5310
5353
|
|
5311
5354
|
decode(input, length) {
|
5312
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5355
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5313
5356
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5314
5357
|
const message = createBaseSimulcastCodecInfo();
|
5315
5358
|
|
@@ -5399,7 +5442,7 @@ function createBaseTrackInfo() {
|
|
5399
5442
|
|
5400
5443
|
const TrackInfo = {
|
5401
5444
|
encode(message) {
|
5402
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5445
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5403
5446
|
|
5404
5447
|
if (message.sid !== '') {
|
5405
5448
|
writer.uint32(10).string(message.sid);
|
@@ -5457,7 +5500,7 @@ const TrackInfo = {
|
|
5457
5500
|
},
|
5458
5501
|
|
5459
5502
|
decode(input, length) {
|
5460
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5503
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5461
5504
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5462
5505
|
const message = createBaseTrackInfo();
|
5463
5506
|
|
@@ -5608,7 +5651,7 @@ function createBaseVideoLayer() {
|
|
5608
5651
|
|
5609
5652
|
const VideoLayer = {
|
5610
5653
|
encode(message) {
|
5611
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5654
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5612
5655
|
|
5613
5656
|
if (message.quality !== 0) {
|
5614
5657
|
writer.uint32(8).int32(message.quality);
|
@@ -5634,7 +5677,7 @@ const VideoLayer = {
|
|
5634
5677
|
},
|
5635
5678
|
|
5636
5679
|
decode(input, length) {
|
5637
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5680
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5638
5681
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5639
5682
|
const message = createBaseVideoLayer();
|
5640
5683
|
|
@@ -5715,7 +5758,7 @@ function createBaseDataPacket() {
|
|
5715
5758
|
|
5716
5759
|
const DataPacket = {
|
5717
5760
|
encode(message) {
|
5718
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5761
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5719
5762
|
|
5720
5763
|
if (message.kind !== 0) {
|
5721
5764
|
writer.uint32(8).int32(message.kind);
|
@@ -5733,7 +5776,7 @@ const DataPacket = {
|
|
5733
5776
|
},
|
5734
5777
|
|
5735
5778
|
decode(input, length) {
|
5736
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5779
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5737
5780
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5738
5781
|
const message = createBaseDataPacket();
|
5739
5782
|
|
@@ -5798,7 +5841,7 @@ function createBaseActiveSpeakerUpdate() {
|
|
5798
5841
|
|
5799
5842
|
const ActiveSpeakerUpdate = {
|
5800
5843
|
encode(message) {
|
5801
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5844
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5802
5845
|
|
5803
5846
|
for (const v of message.speakers) {
|
5804
5847
|
SpeakerInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -5808,7 +5851,7 @@ const ActiveSpeakerUpdate = {
|
|
5808
5851
|
},
|
5809
5852
|
|
5810
5853
|
decode(input, length) {
|
5811
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5854
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5812
5855
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5813
5856
|
const message = createBaseActiveSpeakerUpdate();
|
5814
5857
|
|
@@ -5867,7 +5910,7 @@ function createBaseSpeakerInfo() {
|
|
5867
5910
|
|
5868
5911
|
const SpeakerInfo = {
|
5869
5912
|
encode(message) {
|
5870
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5913
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5871
5914
|
|
5872
5915
|
if (message.sid !== '') {
|
5873
5916
|
writer.uint32(10).string(message.sid);
|
@@ -5885,7 +5928,7 @@ const SpeakerInfo = {
|
|
5885
5928
|
},
|
5886
5929
|
|
5887
5930
|
decode(input, length) {
|
5888
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
5931
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5889
5932
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5890
5933
|
const message = createBaseSpeakerInfo();
|
5891
5934
|
|
@@ -5952,7 +5995,7 @@ function createBaseUserPacket() {
|
|
5952
5995
|
|
5953
5996
|
const UserPacket = {
|
5954
5997
|
encode(message) {
|
5955
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
5998
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
5956
5999
|
|
5957
6000
|
if (message.participantSid !== '') {
|
5958
6001
|
writer.uint32(10).string(message.participantSid);
|
@@ -5970,7 +6013,7 @@ const UserPacket = {
|
|
5970
6013
|
},
|
5971
6014
|
|
5972
6015
|
decode(input, length) {
|
5973
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6016
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
5974
6017
|
let end = length === undefined ? reader.len : reader.pos + length;
|
5975
6018
|
const message = createBaseUserPacket();
|
5976
6019
|
|
@@ -6042,7 +6085,7 @@ function createBaseParticipantTracks() {
|
|
6042
6085
|
|
6043
6086
|
const ParticipantTracks = {
|
6044
6087
|
encode(message) {
|
6045
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6088
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6046
6089
|
|
6047
6090
|
if (message.participantSid !== '') {
|
6048
6091
|
writer.uint32(10).string(message.participantSid);
|
@@ -6056,7 +6099,7 @@ const ParticipantTracks = {
|
|
6056
6099
|
},
|
6057
6100
|
|
6058
6101
|
decode(input, length) {
|
6059
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6102
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6060
6103
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6061
6104
|
const message = createBaseParticipantTracks();
|
6062
6105
|
|
@@ -6128,7 +6171,7 @@ function createBaseClientInfo() {
|
|
6128
6171
|
|
6129
6172
|
const ClientInfo = {
|
6130
6173
|
encode(message) {
|
6131
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6174
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6132
6175
|
|
6133
6176
|
if (message.sdk !== 0) {
|
6134
6177
|
writer.uint32(8).int32(message.sdk);
|
@@ -6170,7 +6213,7 @@ const ClientInfo = {
|
|
6170
6213
|
},
|
6171
6214
|
|
6172
6215
|
decode(input, length) {
|
6173
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6216
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6174
6217
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6175
6218
|
const message = createBaseClientInfo();
|
6176
6219
|
|
@@ -6280,7 +6323,7 @@ function createBaseClientConfiguration() {
|
|
6280
6323
|
|
6281
6324
|
const ClientConfiguration = {
|
6282
6325
|
encode(message) {
|
6283
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6326
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6284
6327
|
|
6285
6328
|
if (message.video !== undefined) {
|
6286
6329
|
VideoConfiguration.encode(message.video, writer.uint32(10).fork()).ldelim();
|
@@ -6302,7 +6345,7 @@ const ClientConfiguration = {
|
|
6302
6345
|
},
|
6303
6346
|
|
6304
6347
|
decode(input, length) {
|
6305
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6348
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6306
6349
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6307
6350
|
const message = createBaseClientConfiguration();
|
6308
6351
|
|
@@ -6374,7 +6417,7 @@ function createBaseVideoConfiguration() {
|
|
6374
6417
|
|
6375
6418
|
const VideoConfiguration = {
|
6376
6419
|
encode(message) {
|
6377
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6420
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6378
6421
|
|
6379
6422
|
if (message.hardwareEncoder !== 0) {
|
6380
6423
|
writer.uint32(8).int32(message.hardwareEncoder);
|
@@ -6384,7 +6427,7 @@ const VideoConfiguration = {
|
|
6384
6427
|
},
|
6385
6428
|
|
6386
6429
|
decode(input, length) {
|
6387
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6430
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6388
6431
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6389
6432
|
const message = createBaseVideoConfiguration();
|
6390
6433
|
|
@@ -6435,7 +6478,7 @@ function createBaseDisabledCodecs() {
|
|
6435
6478
|
|
6436
6479
|
const DisabledCodecs = {
|
6437
6480
|
encode(message) {
|
6438
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6481
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6439
6482
|
|
6440
6483
|
for (const v of message.codecs) {
|
6441
6484
|
Codec.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -6445,7 +6488,7 @@ const DisabledCodecs = {
|
|
6445
6488
|
},
|
6446
6489
|
|
6447
6490
|
decode(input, length) {
|
6448
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6491
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6449
6492
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6450
6493
|
const message = createBaseDisabledCodecs();
|
6451
6494
|
|
@@ -6535,16 +6578,65 @@ function longToNumber(long) {
|
|
6535
6578
|
return long.toNumber();
|
6536
6579
|
}
|
6537
6580
|
|
6538
|
-
if (minimal.util.Long !== long) {
|
6539
|
-
minimal.util.Long = long;
|
6581
|
+
if (minimal$1.exports.util.Long !== long) {
|
6582
|
+
minimal$1.exports.util.Long = long;
|
6540
6583
|
|
6541
|
-
minimal.configure();
|
6584
|
+
minimal$1.exports.configure();
|
6542
6585
|
}
|
6543
6586
|
|
6544
6587
|
function isSet$1(value) {
|
6545
6588
|
return value !== null && value !== undefined;
|
6546
6589
|
}
|
6547
6590
|
|
6591
|
+
function _asyncIterator(iterable) {
|
6592
|
+
var method,
|
6593
|
+
async,
|
6594
|
+
sync,
|
6595
|
+
retry = 2;
|
6596
|
+
|
6597
|
+
for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) {
|
6598
|
+
if (async && null != (method = iterable[async])) return method.call(iterable);
|
6599
|
+
if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
|
6600
|
+
async = "@@asyncIterator", sync = "@@iterator";
|
6601
|
+
}
|
6602
|
+
|
6603
|
+
throw new TypeError("Object is not async iterable");
|
6604
|
+
}
|
6605
|
+
|
6606
|
+
function AsyncFromSyncIterator(s) {
|
6607
|
+
function AsyncFromSyncIteratorContinuation(r) {
|
6608
|
+
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
6609
|
+
var done = r.done;
|
6610
|
+
return Promise.resolve(r.value).then(function (value) {
|
6611
|
+
return {
|
6612
|
+
value: value,
|
6613
|
+
done: done
|
6614
|
+
};
|
6615
|
+
});
|
6616
|
+
}
|
6617
|
+
|
6618
|
+
return AsyncFromSyncIterator = function (s) {
|
6619
|
+
this.s = s, this.n = s.next;
|
6620
|
+
}, AsyncFromSyncIterator.prototype = {
|
6621
|
+
s: null,
|
6622
|
+
n: null,
|
6623
|
+
next: function () {
|
6624
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
6625
|
+
},
|
6626
|
+
return: function (value) {
|
6627
|
+
var ret = this.s.return;
|
6628
|
+
return void 0 === ret ? Promise.resolve({
|
6629
|
+
value: value,
|
6630
|
+
done: !0
|
6631
|
+
}) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
|
6632
|
+
},
|
6633
|
+
throw: function (value) {
|
6634
|
+
var thr = this.s.return;
|
6635
|
+
return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
|
6636
|
+
}
|
6637
|
+
}, new AsyncFromSyncIterator(s);
|
6638
|
+
}
|
6639
|
+
|
6548
6640
|
function ownKeys(object, enumerableOnly) {
|
6549
6641
|
var keys = Object.keys(object);
|
6550
6642
|
|
@@ -6715,7 +6807,7 @@ function createBaseSignalRequest() {
|
|
6715
6807
|
|
6716
6808
|
const SignalRequest = {
|
6717
6809
|
encode(message) {
|
6718
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
6810
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6719
6811
|
|
6720
6812
|
if (message.offer !== undefined) {
|
6721
6813
|
SessionDescription.encode(message.offer, writer.uint32(10).fork()).ldelim();
|
@@ -6769,7 +6861,7 @@ const SignalRequest = {
|
|
6769
6861
|
},
|
6770
6862
|
|
6771
6863
|
decode(input, length) {
|
6772
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
6864
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6773
6865
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6774
6866
|
const message = createBaseSignalRequest();
|
6775
6867
|
|
@@ -6910,7 +7002,7 @@ function createBaseSignalResponse() {
|
|
6910
7002
|
|
6911
7003
|
const SignalResponse = {
|
6912
7004
|
encode(message) {
|
6913
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7005
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
6914
7006
|
|
6915
7007
|
if (message.join !== undefined) {
|
6916
7008
|
JoinResponse.encode(message.join, writer.uint32(10).fork()).ldelim();
|
@@ -6980,7 +7072,7 @@ const SignalResponse = {
|
|
6980
7072
|
},
|
6981
7073
|
|
6982
7074
|
decode(input, length) {
|
6983
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7075
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
6984
7076
|
let end = length === undefined ? reader.len : reader.pos + length;
|
6985
7077
|
const message = createBaseSignalResponse();
|
6986
7078
|
|
@@ -7138,7 +7230,7 @@ function createBaseSimulcastCodec() {
|
|
7138
7230
|
|
7139
7231
|
const SimulcastCodec = {
|
7140
7232
|
encode(message) {
|
7141
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7233
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7142
7234
|
|
7143
7235
|
if (message.codec !== '') {
|
7144
7236
|
writer.uint32(10).string(message.codec);
|
@@ -7156,7 +7248,7 @@ const SimulcastCodec = {
|
|
7156
7248
|
},
|
7157
7249
|
|
7158
7250
|
decode(input, length) {
|
7159
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7251
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7160
7252
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7161
7253
|
const message = createBaseSimulcastCodec();
|
7162
7254
|
|
@@ -7231,7 +7323,7 @@ function createBaseAddTrackRequest() {
|
|
7231
7323
|
|
7232
7324
|
const AddTrackRequest = {
|
7233
7325
|
encode(message) {
|
7234
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7326
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7235
7327
|
|
7236
7328
|
if (message.cid !== '') {
|
7237
7329
|
writer.uint32(10).string(message.cid);
|
@@ -7281,7 +7373,7 @@ const AddTrackRequest = {
|
|
7281
7373
|
},
|
7282
7374
|
|
7283
7375
|
decode(input, length) {
|
7284
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7376
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7285
7377
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7286
7378
|
const message = createBaseAddTrackRequest();
|
7287
7379
|
|
@@ -7414,7 +7506,7 @@ function createBaseTrickleRequest() {
|
|
7414
7506
|
|
7415
7507
|
const TrickleRequest = {
|
7416
7508
|
encode(message) {
|
7417
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7509
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7418
7510
|
|
7419
7511
|
if (message.candidateInit !== '') {
|
7420
7512
|
writer.uint32(10).string(message.candidateInit);
|
@@ -7428,7 +7520,7 @@ const TrickleRequest = {
|
|
7428
7520
|
},
|
7429
7521
|
|
7430
7522
|
decode(input, length) {
|
7431
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7523
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7432
7524
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7433
7525
|
const message = createBaseTrickleRequest();
|
7434
7526
|
|
@@ -7487,7 +7579,7 @@ function createBaseMuteTrackRequest() {
|
|
7487
7579
|
|
7488
7580
|
const MuteTrackRequest = {
|
7489
7581
|
encode(message) {
|
7490
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7582
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7491
7583
|
|
7492
7584
|
if (message.sid !== '') {
|
7493
7585
|
writer.uint32(10).string(message.sid);
|
@@ -7501,7 +7593,7 @@ const MuteTrackRequest = {
|
|
7501
7593
|
},
|
7502
7594
|
|
7503
7595
|
decode(input, length) {
|
7504
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7596
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7505
7597
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7506
7598
|
const message = createBaseMuteTrackRequest();
|
7507
7599
|
|
@@ -7567,7 +7659,7 @@ function createBaseJoinResponse() {
|
|
7567
7659
|
|
7568
7660
|
const JoinResponse = {
|
7569
7661
|
encode(message) {
|
7570
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7662
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7571
7663
|
|
7572
7664
|
if (message.room !== undefined) {
|
7573
7665
|
Room$1.encode(message.room, writer.uint32(10).fork()).ldelim();
|
@@ -7609,7 +7701,7 @@ const JoinResponse = {
|
|
7609
7701
|
},
|
7610
7702
|
|
7611
7703
|
decode(input, length) {
|
7612
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7704
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7613
7705
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7614
7706
|
const message = createBaseJoinResponse();
|
7615
7707
|
|
@@ -7729,7 +7821,7 @@ function createBaseTrackPublishedResponse() {
|
|
7729
7821
|
|
7730
7822
|
const TrackPublishedResponse = {
|
7731
7823
|
encode(message) {
|
7732
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7824
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7733
7825
|
|
7734
7826
|
if (message.cid !== '') {
|
7735
7827
|
writer.uint32(10).string(message.cid);
|
@@ -7743,7 +7835,7 @@ const TrackPublishedResponse = {
|
|
7743
7835
|
},
|
7744
7836
|
|
7745
7837
|
decode(input, length) {
|
7746
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7838
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7747
7839
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7748
7840
|
const message = createBaseTrackPublishedResponse();
|
7749
7841
|
|
@@ -7801,7 +7893,7 @@ function createBaseTrackUnpublishedResponse() {
|
|
7801
7893
|
|
7802
7894
|
const TrackUnpublishedResponse = {
|
7803
7895
|
encode(message) {
|
7804
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7896
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7805
7897
|
|
7806
7898
|
if (message.trackSid !== '') {
|
7807
7899
|
writer.uint32(10).string(message.trackSid);
|
@@ -7811,7 +7903,7 @@ const TrackUnpublishedResponse = {
|
|
7811
7903
|
},
|
7812
7904
|
|
7813
7905
|
decode(input, length) {
|
7814
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7906
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7815
7907
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7816
7908
|
const message = createBaseTrackUnpublishedResponse();
|
7817
7909
|
|
@@ -7863,7 +7955,7 @@ function createBaseSessionDescription() {
|
|
7863
7955
|
|
7864
7956
|
const SessionDescription = {
|
7865
7957
|
encode(message) {
|
7866
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
7958
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7867
7959
|
|
7868
7960
|
if (message.type !== '') {
|
7869
7961
|
writer.uint32(10).string(message.type);
|
@@ -7877,7 +7969,7 @@ const SessionDescription = {
|
|
7877
7969
|
},
|
7878
7970
|
|
7879
7971
|
decode(input, length) {
|
7880
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
7972
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7881
7973
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7882
7974
|
const message = createBaseSessionDescription();
|
7883
7975
|
|
@@ -7935,7 +8027,7 @@ function createBaseParticipantUpdate() {
|
|
7935
8027
|
|
7936
8028
|
const ParticipantUpdate = {
|
7937
8029
|
encode(message) {
|
7938
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8030
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
7939
8031
|
|
7940
8032
|
for (const v of message.participants) {
|
7941
8033
|
ParticipantInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -7945,7 +8037,7 @@ const ParticipantUpdate = {
|
|
7945
8037
|
},
|
7946
8038
|
|
7947
8039
|
decode(input, length) {
|
7948
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8040
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
7949
8041
|
let end = length === undefined ? reader.len : reader.pos + length;
|
7950
8042
|
const message = createBaseParticipantUpdate();
|
7951
8043
|
|
@@ -8004,7 +8096,7 @@ function createBaseUpdateSubscription() {
|
|
8004
8096
|
|
8005
8097
|
const UpdateSubscription = {
|
8006
8098
|
encode(message) {
|
8007
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8099
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8008
8100
|
|
8009
8101
|
for (const v of message.trackSids) {
|
8010
8102
|
writer.uint32(10).string(v);
|
@@ -8022,7 +8114,7 @@ const UpdateSubscription = {
|
|
8022
8114
|
},
|
8023
8115
|
|
8024
8116
|
decode(input, length) {
|
8025
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8117
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8026
8118
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8027
8119
|
const message = createBaseUpdateSubscription();
|
8028
8120
|
|
@@ -8103,7 +8195,7 @@ function createBaseUpdateTrackSettings() {
|
|
8103
8195
|
|
8104
8196
|
const UpdateTrackSettings = {
|
8105
8197
|
encode(message) {
|
8106
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8198
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8107
8199
|
|
8108
8200
|
for (const v of message.trackSids) {
|
8109
8201
|
writer.uint32(10).string(v);
|
@@ -8129,7 +8221,7 @@ const UpdateTrackSettings = {
|
|
8129
8221
|
},
|
8130
8222
|
|
8131
8223
|
decode(input, length) {
|
8132
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8224
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8133
8225
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8134
8226
|
const message = createBaseUpdateTrackSettings();
|
8135
8227
|
|
@@ -8215,7 +8307,7 @@ function createBaseLeaveRequest() {
|
|
8215
8307
|
|
8216
8308
|
const LeaveRequest = {
|
8217
8309
|
encode(message) {
|
8218
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8310
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8219
8311
|
|
8220
8312
|
if (message.canReconnect === true) {
|
8221
8313
|
writer.uint32(8).bool(message.canReconnect);
|
@@ -8229,7 +8321,7 @@ const LeaveRequest = {
|
|
8229
8321
|
},
|
8230
8322
|
|
8231
8323
|
decode(input, length) {
|
8232
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8324
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8233
8325
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8234
8326
|
const message = createBaseLeaveRequest();
|
8235
8327
|
|
@@ -8288,7 +8380,7 @@ function createBaseUpdateVideoLayers() {
|
|
8288
8380
|
|
8289
8381
|
const UpdateVideoLayers = {
|
8290
8382
|
encode(message) {
|
8291
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8383
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8292
8384
|
|
8293
8385
|
if (message.trackSid !== '') {
|
8294
8386
|
writer.uint32(10).string(message.trackSid);
|
@@ -8302,7 +8394,7 @@ const UpdateVideoLayers = {
|
|
8302
8394
|
},
|
8303
8395
|
|
8304
8396
|
decode(input, length) {
|
8305
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8397
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8306
8398
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8307
8399
|
const message = createBaseUpdateVideoLayers();
|
8308
8400
|
|
@@ -8368,7 +8460,7 @@ function createBaseICEServer() {
|
|
8368
8460
|
|
8369
8461
|
const ICEServer = {
|
8370
8462
|
encode(message) {
|
8371
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8463
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8372
8464
|
|
8373
8465
|
for (const v of message.urls) {
|
8374
8466
|
writer.uint32(10).string(v);
|
@@ -8386,7 +8478,7 @@ const ICEServer = {
|
|
8386
8478
|
},
|
8387
8479
|
|
8388
8480
|
decode(input, length) {
|
8389
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8481
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8390
8482
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8391
8483
|
const message = createBaseICEServer();
|
8392
8484
|
|
@@ -8457,7 +8549,7 @@ function createBaseSpeakersChanged() {
|
|
8457
8549
|
|
8458
8550
|
const SpeakersChanged = {
|
8459
8551
|
encode(message) {
|
8460
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8552
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8461
8553
|
|
8462
8554
|
for (const v of message.speakers) {
|
8463
8555
|
SpeakerInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -8467,7 +8559,7 @@ const SpeakersChanged = {
|
|
8467
8559
|
},
|
8468
8560
|
|
8469
8561
|
decode(input, length) {
|
8470
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8562
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8471
8563
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8472
8564
|
const message = createBaseSpeakersChanged();
|
8473
8565
|
|
@@ -8524,7 +8616,7 @@ function createBaseRoomUpdate() {
|
|
8524
8616
|
|
8525
8617
|
const RoomUpdate = {
|
8526
8618
|
encode(message) {
|
8527
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8619
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8528
8620
|
|
8529
8621
|
if (message.room !== undefined) {
|
8530
8622
|
Room$1.encode(message.room, writer.uint32(10).fork()).ldelim();
|
@@ -8534,7 +8626,7 @@ const RoomUpdate = {
|
|
8534
8626
|
},
|
8535
8627
|
|
8536
8628
|
decode(input, length) {
|
8537
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8629
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8538
8630
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8539
8631
|
const message = createBaseRoomUpdate();
|
8540
8632
|
|
@@ -8585,7 +8677,7 @@ function createBaseConnectionQualityInfo() {
|
|
8585
8677
|
|
8586
8678
|
const ConnectionQualityInfo = {
|
8587
8679
|
encode(message) {
|
8588
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8680
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8589
8681
|
|
8590
8682
|
if (message.participantSid !== '') {
|
8591
8683
|
writer.uint32(10).string(message.participantSid);
|
@@ -8603,7 +8695,7 @@ const ConnectionQualityInfo = {
|
|
8603
8695
|
},
|
8604
8696
|
|
8605
8697
|
decode(input, length) {
|
8606
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8698
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8607
8699
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8608
8700
|
const message = createBaseConnectionQualityInfo();
|
8609
8701
|
|
@@ -8668,7 +8760,7 @@ function createBaseConnectionQualityUpdate() {
|
|
8668
8760
|
|
8669
8761
|
const ConnectionQualityUpdate = {
|
8670
8762
|
encode(message) {
|
8671
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8763
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8672
8764
|
|
8673
8765
|
for (const v of message.updates) {
|
8674
8766
|
ConnectionQualityInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -8678,7 +8770,7 @@ const ConnectionQualityUpdate = {
|
|
8678
8770
|
},
|
8679
8771
|
|
8680
8772
|
decode(input, length) {
|
8681
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8773
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8682
8774
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8683
8775
|
const message = createBaseConnectionQualityUpdate();
|
8684
8776
|
|
@@ -8737,7 +8829,7 @@ function createBaseStreamStateInfo() {
|
|
8737
8829
|
|
8738
8830
|
const StreamStateInfo = {
|
8739
8831
|
encode(message) {
|
8740
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8832
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8741
8833
|
|
8742
8834
|
if (message.participantSid !== '') {
|
8743
8835
|
writer.uint32(10).string(message.participantSid);
|
@@ -8755,7 +8847,7 @@ const StreamStateInfo = {
|
|
8755
8847
|
},
|
8756
8848
|
|
8757
8849
|
decode(input, length) {
|
8758
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8850
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8759
8851
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8760
8852
|
const message = createBaseStreamStateInfo();
|
8761
8853
|
|
@@ -8820,7 +8912,7 @@ function createBaseStreamStateUpdate() {
|
|
8820
8912
|
|
8821
8913
|
const StreamStateUpdate = {
|
8822
8914
|
encode(message) {
|
8823
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8915
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8824
8916
|
|
8825
8917
|
for (const v of message.streamStates) {
|
8826
8918
|
StreamStateInfo.encode(v, writer.uint32(10).fork()).ldelim();
|
@@ -8830,7 +8922,7 @@ const StreamStateUpdate = {
|
|
8830
8922
|
},
|
8831
8923
|
|
8832
8924
|
decode(input, length) {
|
8833
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8925
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8834
8926
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8835
8927
|
const message = createBaseStreamStateUpdate();
|
8836
8928
|
|
@@ -8888,7 +8980,7 @@ function createBaseSubscribedQuality() {
|
|
8888
8980
|
|
8889
8981
|
const SubscribedQuality = {
|
8890
8982
|
encode(message) {
|
8891
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
8983
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8892
8984
|
|
8893
8985
|
if (message.quality !== 0) {
|
8894
8986
|
writer.uint32(8).int32(message.quality);
|
@@ -8902,7 +8994,7 @@ const SubscribedQuality = {
|
|
8902
8994
|
},
|
8903
8995
|
|
8904
8996
|
decode(input, length) {
|
8905
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
8997
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8906
8998
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8907
8999
|
const message = createBaseSubscribedQuality();
|
8908
9000
|
|
@@ -8961,7 +9053,7 @@ function createBaseSubscribedCodec() {
|
|
8961
9053
|
|
8962
9054
|
const SubscribedCodec = {
|
8963
9055
|
encode(message) {
|
8964
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9056
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
8965
9057
|
|
8966
9058
|
if (message.codec !== '') {
|
8967
9059
|
writer.uint32(10).string(message.codec);
|
@@ -8975,7 +9067,7 @@ const SubscribedCodec = {
|
|
8975
9067
|
},
|
8976
9068
|
|
8977
9069
|
decode(input, length) {
|
8978
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9070
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
8979
9071
|
let end = length === undefined ? reader.len : reader.pos + length;
|
8980
9072
|
const message = createBaseSubscribedCodec();
|
8981
9073
|
|
@@ -9041,7 +9133,7 @@ function createBaseSubscribedQualityUpdate() {
|
|
9041
9133
|
|
9042
9134
|
const SubscribedQualityUpdate = {
|
9043
9135
|
encode(message) {
|
9044
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9136
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9045
9137
|
|
9046
9138
|
if (message.trackSid !== '') {
|
9047
9139
|
writer.uint32(10).string(message.trackSid);
|
@@ -9059,7 +9151,7 @@ const SubscribedQualityUpdate = {
|
|
9059
9151
|
},
|
9060
9152
|
|
9061
9153
|
decode(input, length) {
|
9062
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9154
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9063
9155
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9064
9156
|
const message = createBaseSubscribedQualityUpdate();
|
9065
9157
|
|
@@ -9138,7 +9230,7 @@ function createBaseTrackPermission() {
|
|
9138
9230
|
|
9139
9231
|
const TrackPermission = {
|
9140
9232
|
encode(message) {
|
9141
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9233
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9142
9234
|
|
9143
9235
|
if (message.participantSid !== '') {
|
9144
9236
|
writer.uint32(10).string(message.participantSid);
|
@@ -9160,7 +9252,7 @@ const TrackPermission = {
|
|
9160
9252
|
},
|
9161
9253
|
|
9162
9254
|
decode(input, length) {
|
9163
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9255
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9164
9256
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9165
9257
|
const message = createBaseTrackPermission();
|
9166
9258
|
|
@@ -9239,7 +9331,7 @@ function createBaseSubscriptionPermission() {
|
|
9239
9331
|
|
9240
9332
|
const SubscriptionPermission = {
|
9241
9333
|
encode(message) {
|
9242
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9334
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9243
9335
|
|
9244
9336
|
if (message.allParticipants === true) {
|
9245
9337
|
writer.uint32(8).bool(message.allParticipants);
|
@@ -9253,7 +9345,7 @@ const SubscriptionPermission = {
|
|
9253
9345
|
},
|
9254
9346
|
|
9255
9347
|
decode(input, length) {
|
9256
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9348
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9257
9349
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9258
9350
|
const message = createBaseSubscriptionPermission();
|
9259
9351
|
|
@@ -9319,7 +9411,7 @@ function createBaseSubscriptionPermissionUpdate() {
|
|
9319
9411
|
|
9320
9412
|
const SubscriptionPermissionUpdate = {
|
9321
9413
|
encode(message) {
|
9322
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9414
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9323
9415
|
|
9324
9416
|
if (message.participantSid !== '') {
|
9325
9417
|
writer.uint32(10).string(message.participantSid);
|
@@ -9337,7 +9429,7 @@ const SubscriptionPermissionUpdate = {
|
|
9337
9429
|
},
|
9338
9430
|
|
9339
9431
|
decode(input, length) {
|
9340
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9432
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9341
9433
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9342
9434
|
const message = createBaseSubscriptionPermissionUpdate();
|
9343
9435
|
|
@@ -9405,7 +9497,7 @@ function createBaseSyncState() {
|
|
9405
9497
|
|
9406
9498
|
const SyncState = {
|
9407
9499
|
encode(message) {
|
9408
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9500
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9409
9501
|
|
9410
9502
|
if (message.answer !== undefined) {
|
9411
9503
|
SessionDescription.encode(message.answer, writer.uint32(10).fork()).ldelim();
|
@@ -9427,7 +9519,7 @@ const SyncState = {
|
|
9427
9519
|
},
|
9428
9520
|
|
9429
9521
|
decode(input, length) {
|
9430
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9522
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9431
9523
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9432
9524
|
const message = createBaseSyncState();
|
9433
9525
|
|
@@ -9512,7 +9604,7 @@ function createBaseDataChannelInfo() {
|
|
9512
9604
|
|
9513
9605
|
const DataChannelInfo = {
|
9514
9606
|
encode(message) {
|
9515
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9607
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9516
9608
|
|
9517
9609
|
if (message.label !== '') {
|
9518
9610
|
writer.uint32(10).string(message.label);
|
@@ -9530,7 +9622,7 @@ const DataChannelInfo = {
|
|
9530
9622
|
},
|
9531
9623
|
|
9532
9624
|
decode(input, length) {
|
9533
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9625
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9534
9626
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9535
9627
|
const message = createBaseDataChannelInfo();
|
9536
9628
|
|
@@ -9599,7 +9691,7 @@ function createBaseSimulateScenario() {
|
|
9599
9691
|
|
9600
9692
|
const SimulateScenario = {
|
9601
9693
|
encode(message) {
|
9602
|
-
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal.Writer.create();
|
9694
|
+
let writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : minimal$1.exports.Writer.create();
|
9603
9695
|
|
9604
9696
|
if (message.speakerUpdate !== undefined) {
|
9605
9697
|
writer.uint32(8).int32(message.speakerUpdate);
|
@@ -9625,7 +9717,7 @@ const SimulateScenario = {
|
|
9625
9717
|
},
|
9626
9718
|
|
9627
9719
|
decode(input, length) {
|
9628
|
-
const reader = input instanceof minimal.Reader ? input : new minimal.Reader(input);
|
9720
|
+
const reader = input instanceof minimal$1.exports.Reader ? input : new minimal$1.exports.Reader(input);
|
9629
9721
|
let end = length === undefined ? reader.len : reader.pos + length;
|
9630
9722
|
const message = createBaseSimulateScenario();
|
9631
9723
|
|
@@ -9696,10 +9788,10 @@ const SimulateScenario = {
|
|
9696
9788
|
|
9697
9789
|
};
|
9698
9790
|
|
9699
|
-
if (minimal.util.Long !== long) {
|
9700
|
-
minimal.util.Long = long;
|
9791
|
+
if (minimal$1.exports.util.Long !== long) {
|
9792
|
+
minimal$1.exports.util.Long = long;
|
9701
9793
|
|
9702
|
-
minimal.configure();
|
9794
|
+
minimal$1.exports.configure();
|
9703
9795
|
}
|
9704
9796
|
|
9705
9797
|
function isSet(value) {
|
@@ -10265,7 +10357,7 @@ function computeBitrate(currentStats, prevStats) {
|
|
10265
10357
|
return (bytesNow - bytesPrev) * 8 * 1000 / (currentStats.timestamp - prevStats.timestamp);
|
10266
10358
|
}
|
10267
10359
|
|
10268
|
-
var version$1 = "1.2.
|
10360
|
+
var version$1 = "1.2.6";
|
10269
10361
|
|
10270
10362
|
const version = version$1;
|
10271
10363
|
const protocolVersion = 8;
|
@@ -10376,8 +10468,8 @@ function getEmptyAudioStreamTrack() {
|
|
10376
10468
|
return emptyAudioStreamTrack;
|
10377
10469
|
}
|
10378
10470
|
class Future {
|
10379
|
-
constructor() {
|
10380
|
-
this.promise = new Promise((resolve, reject) => {
|
10471
|
+
constructor(promise) {
|
10472
|
+
this.promise = promise !== null && promise !== void 0 ? promise : new Promise((resolve, reject) => {
|
10381
10473
|
this.resolve = resolve;
|
10382
10474
|
this.reject = reject;
|
10383
10475
|
});
|
@@ -10569,9 +10661,27 @@ class DeviceManager {
|
|
10569
10661
|
|
10570
10662
|
async getDevices(kind) {
|
10571
10663
|
let requestPermissions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
10664
|
+
|
10665
|
+
var _a;
|
10666
|
+
|
10667
|
+
if (((_a = DeviceManager.userMediaPromiseMap) === null || _a === void 0 ? void 0 : _a.size) > 0) {
|
10668
|
+
livekitLogger.debug('awaiting getUserMedia promise');
|
10669
|
+
|
10670
|
+
try {
|
10671
|
+
if (kind) {
|
10672
|
+
await DeviceManager.userMediaPromiseMap.get(kind);
|
10673
|
+
} else {
|
10674
|
+
await Promise.all(DeviceManager.userMediaPromiseMap.values());
|
10675
|
+
}
|
10676
|
+
} catch (e) {
|
10677
|
+
livekitLogger.warn('error waiting for media permissons');
|
10678
|
+
}
|
10679
|
+
}
|
10680
|
+
|
10572
10681
|
let devices = await navigator.mediaDevices.enumerateDevices();
|
10573
10682
|
|
10574
|
-
if (requestPermissions
|
10683
|
+
if (requestPermissions && kind && ( // for safari we need to skip this check, as otherwise it will re-acquire user media and fail on iOS https://bugs.webkit.org/show_bug.cgi?id=179363
|
10684
|
+
!DeviceManager.userMediaPromiseMap.get(kind) || !isSafari())) {
|
10575
10685
|
const isDummyDeviceOrEmpty = devices.length === 0 || devices.some(device => {
|
10576
10686
|
const noLabel = device.label === '';
|
10577
10687
|
const isRelevant = kind ? device.kind === kind : true;
|
@@ -10631,6 +10741,7 @@ class DeviceManager {
|
|
10631
10741
|
|
10632
10742
|
}
|
10633
10743
|
DeviceManager.mediaDeviceKinds = ['audioinput', 'audiooutput', 'videoinput'];
|
10744
|
+
DeviceManager.userMediaPromiseMap = new Map();
|
10634
10745
|
|
10635
10746
|
var events = {exports: {}};
|
10636
10747
|
|
@@ -11944,6 +12055,8 @@ class LocalVideoTrack extends LocalTrack {
|
|
11944
12055
|
constructor(mediaTrack, constraints) {
|
11945
12056
|
let userProvidedTrack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
11946
12057
|
super(mediaTrack, Track.Kind.Video, constraints, userProvidedTrack);
|
12058
|
+
/* @internal */
|
12059
|
+
|
11947
12060
|
this.simulcastCodecs = new Map();
|
11948
12061
|
|
11949
12062
|
this.monitorSender = async () => {
|
@@ -12020,9 +12133,7 @@ class LocalVideoTrack extends LocalTrack {
|
|
12020
12133
|
|
12021
12134
|
this.simulcastCodecs.forEach(trackInfo => {
|
12022
12135
|
trackInfo.mediaStreamTrack.stop();
|
12023
|
-
trackInfo.sender = undefined;
|
12024
12136
|
});
|
12025
|
-
this.simulcastCodecs.clear();
|
12026
12137
|
super.stop();
|
12027
12138
|
}
|
12028
12139
|
|
@@ -12187,24 +12298,45 @@ class LocalVideoTrack extends LocalTrack {
|
|
12187
12298
|
|
12188
12299
|
this.subscribedCodecs = codecs;
|
12189
12300
|
const newCodecs = [];
|
12301
|
+
var _iteratorAbruptCompletion = false;
|
12302
|
+
var _didIteratorError = false;
|
12190
12303
|
|
12191
|
-
|
12192
|
-
if (!this.codec || this.codec === codec.codec) {
|
12193
|
-
await this.setPublishingLayers(codec.qualities);
|
12194
|
-
} else {
|
12195
|
-
const simulcastCodecInfo = this.simulcastCodecs.get(codec.codec);
|
12196
|
-
livekitLogger.debug("try setPublishingCodec for ".concat(codec.codec), simulcastCodecInfo);
|
12304
|
+
var _iteratorError;
|
12197
12305
|
|
12198
|
-
|
12199
|
-
|
12200
|
-
|
12201
|
-
|
12202
|
-
|
12306
|
+
try {
|
12307
|
+
for (var _iterator = _asyncIterator(codecs), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
|
12308
|
+
const codec = _step.value;
|
12309
|
+
|
12310
|
+
if (!this.codec || this.codec === codec.codec) {
|
12311
|
+
await this.setPublishingLayers(codec.qualities);
|
12312
|
+
} else {
|
12313
|
+
const simulcastCodecInfo = this.simulcastCodecs.get(codec.codec);
|
12314
|
+
livekitLogger.debug("try setPublishingCodec for ".concat(codec.codec), simulcastCodecInfo);
|
12315
|
+
|
12316
|
+
if (!simulcastCodecInfo || !simulcastCodecInfo.sender) {
|
12317
|
+
for (const q of codec.qualities) {
|
12318
|
+
if (q.enabled) {
|
12319
|
+
newCodecs.push(codec.codec);
|
12320
|
+
break;
|
12321
|
+
}
|
12203
12322
|
}
|
12323
|
+
} else if (simulcastCodecInfo.encodings) {
|
12324
|
+
livekitLogger.debug("try setPublishingLayersForSender ".concat(codec.codec));
|
12325
|
+
await setPublishingLayersForSender(simulcastCodecInfo.sender, simulcastCodecInfo.encodings, codec.qualities);
|
12204
12326
|
}
|
12205
|
-
}
|
12206
|
-
|
12207
|
-
|
12327
|
+
}
|
12328
|
+
}
|
12329
|
+
} catch (err) {
|
12330
|
+
_didIteratorError = true;
|
12331
|
+
_iteratorError = err;
|
12332
|
+
} finally {
|
12333
|
+
try {
|
12334
|
+
if (_iteratorAbruptCompletion && _iterator.return != null) {
|
12335
|
+
await _iterator.return();
|
12336
|
+
}
|
12337
|
+
} finally {
|
12338
|
+
if (_didIteratorError) {
|
12339
|
+
throw _iteratorError;
|
12208
12340
|
}
|
12209
12341
|
}
|
12210
12342
|
}
|
@@ -13618,6 +13750,7 @@ function sortPresets(presets) {
|
|
13618
13750
|
class RemoteTrackPublication extends TrackPublication {
|
13619
13751
|
constructor() {
|
13620
13752
|
super(...arguments);
|
13753
|
+
this.track = undefined;
|
13621
13754
|
/** @internal */
|
13622
13755
|
|
13623
13756
|
this.allowed = true;
|
@@ -14041,6 +14174,17 @@ class RemoteParticipant extends Participant {
|
|
14041
14174
|
publication = new RemoteTrackPublication(kind, ti.sid, ti.name);
|
14042
14175
|
publication.updateInfo(ti);
|
14043
14176
|
newTracks.set(ti.sid, publication);
|
14177
|
+
const existingTrackOfSource = Array.from(this.tracks.values()).find(publishedTrack => publishedTrack.source === (publication === null || publication === void 0 ? void 0 : publication.source));
|
14178
|
+
|
14179
|
+
if (existingTrackOfSource) {
|
14180
|
+
livekitLogger.warn("received a second track publication for ".concat(this.identity, " with the same source: ").concat(publication.source), {
|
14181
|
+
oldTrack: existingTrackOfSource,
|
14182
|
+
newTrack: publication,
|
14183
|
+
participant: this,
|
14184
|
+
participantInfo: info
|
14185
|
+
});
|
14186
|
+
}
|
14187
|
+
|
14044
14188
|
this.addTrackPublication(publication);
|
14045
14189
|
} else {
|
14046
14190
|
publication.updateInfo(ti);
|
@@ -14051,15 +14195,6 @@ class RemoteParticipant extends Participant {
|
|
14051
14195
|
|
14052
14196
|
newTracks.forEach(publication => {
|
14053
14197
|
this.emit(ParticipantEvent.TrackPublished, publication);
|
14054
|
-
const existingTrackOfSource = Array.from(this.tracks.values()).find(publishedTrack => publishedTrack.source === publication.source);
|
14055
|
-
|
14056
|
-
if (existingTrackOfSource) {
|
14057
|
-
livekitLogger.warn("received a second track publication for ".concat(this.identity, " with the same source: ").concat(publication.source), {
|
14058
|
-
oldTrack: existingTrackOfSource,
|
14059
|
-
newTrack: publication,
|
14060
|
-
participant: this
|
14061
|
-
});
|
14062
|
-
}
|
14063
14198
|
}); // detect removed tracks
|
14064
14199
|
|
14065
14200
|
this.tracks.forEach(publication => {
|
@@ -14198,10 +14333,30 @@ class LocalParticipant extends Participant {
|
|
14198
14333
|
}
|
14199
14334
|
|
14200
14335
|
const newCodecs = await pub.videoTrack.setPublishingCodecs(update.subscribedCodecs);
|
14336
|
+
var _iteratorAbruptCompletion = false;
|
14337
|
+
var _didIteratorError = false;
|
14201
14338
|
|
14202
|
-
|
14203
|
-
|
14204
|
-
|
14339
|
+
var _iteratorError;
|
14340
|
+
|
14341
|
+
try {
|
14342
|
+
for (var _iterator = _asyncIterator(newCodecs), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
|
14343
|
+
const codec = _step.value;
|
14344
|
+
livekitLogger.debug("publish ".concat(codec, " for ").concat(pub.videoTrack.sid));
|
14345
|
+
await this.publishAdditionalCodecForTrack(pub.videoTrack, codec, pub.options);
|
14346
|
+
}
|
14347
|
+
} catch (err) {
|
14348
|
+
_didIteratorError = true;
|
14349
|
+
_iteratorError = err;
|
14350
|
+
} finally {
|
14351
|
+
try {
|
14352
|
+
if (_iteratorAbruptCompletion && _iterator.return != null) {
|
14353
|
+
await _iterator.return();
|
14354
|
+
}
|
14355
|
+
} finally {
|
14356
|
+
if (_didIteratorError) {
|
14357
|
+
throw _iteratorError;
|
14358
|
+
}
|
14359
|
+
}
|
14205
14360
|
}
|
14206
14361
|
} else if (update.subscribedQualities.length > 0) {
|
14207
14362
|
(_b = pub.videoTrack) === null || _b === void 0 ? void 0 : _b.setPublishingLayers(update.subscribedQualities);
|
@@ -14889,13 +15044,25 @@ class LocalParticipant extends Participant {
|
|
14889
15044
|
|
14890
15045
|
if (this.engine.publisher && this.engine.publisher.pc.connectionState !== 'closed' && track.sender) {
|
14891
15046
|
try {
|
14892
|
-
this.engine.
|
14893
|
-
|
15047
|
+
this.engine.removeTrack(track.sender);
|
15048
|
+
|
15049
|
+
if (track instanceof LocalVideoTrack) {
|
15050
|
+
for (const [, trackInfo] of track.simulcastCodecs) {
|
15051
|
+
if (trackInfo.sender) {
|
15052
|
+
this.engine.removeTrack(trackInfo.sender);
|
15053
|
+
trackInfo.sender = undefined;
|
15054
|
+
}
|
15055
|
+
}
|
15056
|
+
|
15057
|
+
track.simulcastCodecs.clear();
|
15058
|
+
}
|
14894
15059
|
} catch (e) {
|
14895
|
-
livekitLogger.warn('failed to
|
15060
|
+
livekitLogger.warn('failed to unpublish track', {
|
14896
15061
|
error: e,
|
14897
15062
|
method: 'unpublishTrack'
|
14898
15063
|
});
|
15064
|
+
} finally {
|
15065
|
+
this.engine.negotiate();
|
14899
15066
|
}
|
14900
15067
|
}
|
14901
15068
|
|
@@ -19766,6 +19933,13 @@ var parser = parser$1;
|
|
19766
19933
|
var writer = writer$1;
|
19767
19934
|
var write = writer;
|
19768
19935
|
var parse = parser.parse;
|
19936
|
+
parser.parseParams;
|
19937
|
+
parser.parseFmtpConfig; // Alias of parseParams().
|
19938
|
+
|
19939
|
+
parser.parsePayloads;
|
19940
|
+
parser.parseRemoteCandidates;
|
19941
|
+
parser.parseImageAttributes;
|
19942
|
+
parser.parseSimulcastStreamList;
|
19769
19943
|
|
19770
19944
|
/** @internal */
|
19771
19945
|
|
@@ -20222,18 +20396,48 @@ class RTCEngine extends events.exports.EventEmitter {
|
|
20222
20396
|
|
20223
20397
|
return new Promise((resolve, reject) => {
|
20224
20398
|
const publicationTimeout = setTimeout(() => {
|
20399
|
+
delete this.pendingTrackResolvers[req.cid];
|
20225
20400
|
reject(new ConnectionError('publication of local track timed out, no response from server'));
|
20226
|
-
},
|
20227
|
-
|
20228
|
-
|
20229
|
-
|
20230
|
-
|
20401
|
+
}, 10000);
|
20402
|
+
this.pendingTrackResolvers[req.cid] = {
|
20403
|
+
resolve: info => {
|
20404
|
+
clearTimeout(publicationTimeout);
|
20405
|
+
resolve(info);
|
20406
|
+
},
|
20407
|
+
reject: () => {
|
20408
|
+
clearTimeout(publicationTimeout);
|
20409
|
+
reject('Cancelled publication by calling unpublish');
|
20410
|
+
}
|
20231
20411
|
};
|
20232
|
-
|
20233
20412
|
this.client.sendAddTrack(req);
|
20234
20413
|
});
|
20235
20414
|
}
|
20236
20415
|
|
20416
|
+
removeTrack(sender) {
|
20417
|
+
var _a;
|
20418
|
+
|
20419
|
+
if (sender.track && this.pendingTrackResolvers[sender.track.id]) {
|
20420
|
+
const {
|
20421
|
+
reject
|
20422
|
+
} = this.pendingTrackResolvers[sender.track.id];
|
20423
|
+
|
20424
|
+
if (reject) {
|
20425
|
+
reject();
|
20426
|
+
}
|
20427
|
+
|
20428
|
+
delete this.pendingTrackResolvers[sender.track.id];
|
20429
|
+
}
|
20430
|
+
|
20431
|
+
try {
|
20432
|
+
(_a = this.publisher) === null || _a === void 0 ? void 0 : _a.pc.removeTrack(sender);
|
20433
|
+
} catch (e) {
|
20434
|
+
livekitLogger.warn('failed to remove track', {
|
20435
|
+
error: e,
|
20436
|
+
method: 'removeTrack'
|
20437
|
+
});
|
20438
|
+
}
|
20439
|
+
}
|
20440
|
+
|
20237
20441
|
updateMuteStatus(trackSid, muted) {
|
20238
20442
|
this.client.sendMuteTrack(trackSid, muted);
|
20239
20443
|
}
|
@@ -20409,7 +20613,9 @@ class RTCEngine extends events.exports.EventEmitter {
|
|
20409
20613
|
|
20410
20614
|
this.client.onLocalTrackPublished = res => {
|
20411
20615
|
livekitLogger.debug('received trackPublishedResponse', res);
|
20412
|
-
const
|
20616
|
+
const {
|
20617
|
+
resolve
|
20618
|
+
} = this.pendingTrackResolvers[res.cid];
|
20413
20619
|
|
20414
20620
|
if (!resolve) {
|
20415
20621
|
livekitLogger.error("missing track resolver for ".concat(res.cid));
|
@@ -20815,117 +21021,123 @@ class Room extends events.exports.EventEmitter {
|
|
20815
21021
|
this.metadata = undefined;
|
20816
21022
|
this.audioEnabled = true;
|
20817
21023
|
|
20818
|
-
this.connect =
|
20819
|
-
var _a, _b, _c, _d;
|
20820
|
-
|
21024
|
+
this.connect = (url, token, opts) => {
|
20821
21025
|
if (this.state === ConnectionState.Connected) {
|
20822
21026
|
// when the state is reconnecting or connected, this function returns immediately
|
20823
21027
|
livekitLogger.warn("already connected to room ".concat(this.name));
|
20824
|
-
return;
|
21028
|
+
return Promise.resolve();
|
20825
21029
|
}
|
20826
21030
|
|
20827
21031
|
if (this.connectFuture) {
|
20828
21032
|
return this.connectFuture.promise;
|
21033
|
+
} else if (this.reconnectFuture) {
|
21034
|
+
this.connectFuture = this.reconnectFuture;
|
21035
|
+
return this.connectFuture.promise;
|
20829
21036
|
}
|
20830
21037
|
|
20831
|
-
|
20832
|
-
|
20833
|
-
if (!this.abortController || this.abortController.signal.aborted) {
|
20834
|
-
this.abortController = new AbortController();
|
20835
|
-
} // recreate engine if previously disconnected
|
21038
|
+
const connectPromise = new Promise(async (resolve, reject) => {
|
21039
|
+
var _a, _b, _c, _d;
|
20836
21040
|
|
21041
|
+
this.setAndEmitConnectionState(ConnectionState.Connecting);
|
20837
21042
|
|
20838
|
-
|
20839
|
-
|
21043
|
+
if (!this.abortController || this.abortController.signal.aborted) {
|
21044
|
+
this.abortController = new AbortController();
|
21045
|
+
} // recreate engine if previously disconnected
|
20840
21046
|
|
20841
|
-
if (opts === null || opts === void 0 ? void 0 : opts.rtcConfig) {
|
20842
|
-
this.engine.rtcConfig = opts.rtcConfig;
|
20843
|
-
}
|
20844
21047
|
|
20845
|
-
|
21048
|
+
this.createEngine();
|
21049
|
+
this.acquireAudioContext();
|
20846
21050
|
|
20847
|
-
|
20848
|
-
|
20849
|
-
autoSubscribe: opts === null || opts === void 0 ? void 0 : opts.autoSubscribe,
|
20850
|
-
publishOnly: opts === null || opts === void 0 ? void 0 : opts.publishOnly,
|
20851
|
-
adaptiveStream: typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.adaptiveStream) === 'object' ? true : (_b = this.options) === null || _b === void 0 ? void 0 : _b.adaptiveStream
|
20852
|
-
}, this.abortController.signal);
|
20853
|
-
livekitLogger.debug("connected to Livekit Server version: ".concat(joinResponse.serverVersion, ", region: ").concat(joinResponse.serverRegion));
|
20854
|
-
|
20855
|
-
if (!joinResponse.serverVersion) {
|
20856
|
-
throw new UnsupportedServer('unknown server version');
|
21051
|
+
if (opts === null || opts === void 0 ? void 0 : opts.rtcConfig) {
|
21052
|
+
this.engine.rtcConfig = opts.rtcConfig;
|
20857
21053
|
}
|
20858
21054
|
|
20859
|
-
|
20860
|
-
livekitLogger.debug('disabling dynacast due to server version'); // dynacast has a bug in 0.15.1, so we cannot use it then
|
21055
|
+
this.connOptions = opts;
|
20861
21056
|
|
20862
|
-
|
20863
|
-
|
20864
|
-
|
20865
|
-
|
20866
|
-
|
20867
|
-
|
20868
|
-
|
21057
|
+
try {
|
21058
|
+
const joinResponse = await this.engine.join(url, token, {
|
21059
|
+
autoSubscribe: opts === null || opts === void 0 ? void 0 : opts.autoSubscribe,
|
21060
|
+
publishOnly: opts === null || opts === void 0 ? void 0 : opts.publishOnly,
|
21061
|
+
adaptiveStream: typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.adaptiveStream) === 'object' ? true : (_b = this.options) === null || _b === void 0 ? void 0 : _b.adaptiveStream
|
21062
|
+
}, this.abortController.signal);
|
21063
|
+
livekitLogger.debug("connected to Livekit Server version: ".concat(joinResponse.serverVersion, ", region: ").concat(joinResponse.serverRegion));
|
21064
|
+
|
21065
|
+
if (!joinResponse.serverVersion) {
|
21066
|
+
throw new UnsupportedServer('unknown server version');
|
21067
|
+
}
|
20869
21068
|
|
20870
|
-
|
21069
|
+
if (joinResponse.serverVersion === '0.15.1' && this.options.dynacast) {
|
21070
|
+
livekitLogger.debug('disabling dynacast due to server version'); // dynacast has a bug in 0.15.1, so we cannot use it then
|
20871
21071
|
|
20872
|
-
|
20873
|
-
if (info.sid !== this.localParticipant.sid && info.identity !== this.localParticipant.identity) {
|
20874
|
-
this.getOrCreateParticipant(info.sid, info);
|
20875
|
-
} else {
|
20876
|
-
livekitLogger.warn('received info to create local participant as remote participant', {
|
20877
|
-
info,
|
20878
|
-
localParticipant: this.localParticipant
|
20879
|
-
});
|
21072
|
+
this.options.dynacast = false;
|
20880
21073
|
}
|
20881
|
-
});
|
20882
|
-
this.name = joinResponse.room.name;
|
20883
|
-
this.sid = joinResponse.room.sid;
|
20884
|
-
this.metadata = joinResponse.room.metadata;
|
20885
|
-
this.emit(RoomEvent.SignalConnected);
|
20886
|
-
} catch (err) {
|
20887
|
-
this.recreateEngine();
|
20888
|
-
this.setAndEmitConnectionState(ConnectionState.Disconnected, new ConnectionError('could not establish signal connection'));
|
20889
|
-
throw err;
|
20890
|
-
} // don't return until ICE connected
|
20891
|
-
|
20892
|
-
|
20893
|
-
const connectTimeout = setTimeout(() => {
|
20894
|
-
// timeout
|
20895
|
-
this.recreateEngine();
|
20896
|
-
this.setAndEmitConnectionState(ConnectionState.Disconnected, new ConnectionError('could not connect PeerConnection after timeout'));
|
20897
|
-
}, maxICEConnectTimeout);
|
20898
|
-
|
20899
|
-
const abortHandler = () => {
|
20900
|
-
livekitLogger.warn('closing engine');
|
20901
|
-
clearTimeout(connectTimeout);
|
20902
|
-
this.recreateEngine();
|
20903
|
-
this.setAndEmitConnectionState(ConnectionState.Disconnected, new ConnectionError('room connection has been cancelled'));
|
20904
|
-
};
|
20905
21074
|
|
20906
|
-
|
20907
|
-
|
20908
|
-
|
21075
|
+
const pi = joinResponse.participant;
|
21076
|
+
this.localParticipant.sid = pi.sid;
|
21077
|
+
this.localParticipant.identity = pi.identity;
|
21078
|
+
this.localParticipant.updateInfo(pi); // forward metadata changed for the local participant
|
20909
21079
|
|
20910
|
-
|
20911
|
-
this.engine.once(EngineEvent.Connected, () => {
|
20912
|
-
var _a, _b;
|
21080
|
+
this.localParticipant.on(ParticipantEvent.ParticipantMetadataChanged, this.onLocalParticipantMetadataChanged).on(ParticipantEvent.TrackMuted, this.onLocalTrackMuted).on(ParticipantEvent.TrackUnmuted, this.onLocalTrackUnmuted).on(ParticipantEvent.LocalTrackPublished, this.onLocalTrackPublished).on(ParticipantEvent.LocalTrackUnpublished, this.onLocalTrackUnpublished).on(ParticipantEvent.ConnectionQualityChanged, this.onLocalConnectionQualityChanged).on(ParticipantEvent.MediaDevicesError, this.onMediaDevicesError).on(ParticipantEvent.ParticipantPermissionsChanged, this.onLocalParticipantPermissionsChanged); // populate remote participants, these should not trigger new events
|
20913
21081
|
|
20914
|
-
|
20915
|
-
|
21082
|
+
joinResponse.otherParticipants.forEach(info => {
|
21083
|
+
if (info.sid !== this.localParticipant.sid && info.identity !== this.localParticipant.identity) {
|
21084
|
+
this.getOrCreateParticipant(info.sid, info);
|
21085
|
+
} else {
|
21086
|
+
livekitLogger.warn('received info to create local participant as remote participant', {
|
21087
|
+
info,
|
21088
|
+
localParticipant: this.localParticipant
|
21089
|
+
});
|
21090
|
+
}
|
21091
|
+
});
|
21092
|
+
this.name = joinResponse.room.name;
|
21093
|
+
this.sid = joinResponse.room.sid;
|
21094
|
+
this.metadata = joinResponse.room.metadata;
|
21095
|
+
this.emit(RoomEvent.SignalConnected);
|
21096
|
+
} catch (err) {
|
21097
|
+
this.recreateEngine();
|
21098
|
+
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
|
21099
|
+
reject(new ConnectionError('could not establish signal connection'));
|
21100
|
+
return;
|
21101
|
+
} // don't return until ICE connected
|
21102
|
+
|
21103
|
+
|
21104
|
+
const connectTimeout = setTimeout(() => {
|
21105
|
+
// timeout
|
21106
|
+
this.recreateEngine();
|
21107
|
+
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
|
21108
|
+
reject(new ConnectionError('could not connect PeerConnection after timeout'));
|
21109
|
+
}, maxICEConnectTimeout);
|
21110
|
+
|
21111
|
+
const abortHandler = () => {
|
21112
|
+
livekitLogger.warn('closing engine');
|
21113
|
+
clearTimeout(connectTimeout);
|
21114
|
+
this.recreateEngine();
|
21115
|
+
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish);
|
21116
|
+
reject(new ConnectionError('room connection has been cancelled'));
|
21117
|
+
};
|
20916
21118
|
|
20917
|
-
if (
|
20918
|
-
|
20919
|
-
(_b = navigator.mediaDevices) === null || _b === void 0 ? void 0 : _b.addEventListener('devicechange', this.handleDeviceChange);
|
21119
|
+
if ((_c = this.abortController) === null || _c === void 0 ? void 0 : _c.signal.aborted) {
|
21120
|
+
abortHandler();
|
20920
21121
|
}
|
20921
21122
|
|
20922
|
-
this.
|
20923
|
-
|
21123
|
+
(_d = this.abortController) === null || _d === void 0 ? void 0 : _d.signal.addEventListener('abort', abortHandler);
|
21124
|
+
this.engine.once(EngineEvent.Connected, () => {
|
21125
|
+
var _a, _b;
|
20924
21126
|
|
20925
|
-
|
20926
|
-
|
20927
|
-
|
20928
|
-
|
21127
|
+
clearTimeout(connectTimeout);
|
21128
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.signal.removeEventListener('abort', abortHandler); // also hook unload event
|
21129
|
+
|
21130
|
+
if (isWeb()) {
|
21131
|
+
window.addEventListener('beforeunload', this.onBeforeUnload);
|
21132
|
+
(_b = navigator.mediaDevices) === null || _b === void 0 ? void 0 : _b.addEventListener('devicechange', this.handleDeviceChange);
|
21133
|
+
}
|
21134
|
+
|
21135
|
+
this.setAndEmitConnectionState(ConnectionState.Connected);
|
21136
|
+
resolve();
|
21137
|
+
});
|
21138
|
+
}).finally(() => this.connectFuture = undefined);
|
21139
|
+
this.connectFuture = new Future(connectPromise);
|
21140
|
+
return this.connectFuture.promise;
|
20929
21141
|
};
|
20930
21142
|
/**
|
20931
21143
|
* disconnects the room, emits [[RoomEvent.Disconnected]]
|
@@ -20935,21 +21147,23 @@ class Room extends events.exports.EventEmitter {
|
|
20935
21147
|
this.disconnect = async function () {
|
20936
21148
|
let stopTracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
20937
21149
|
|
20938
|
-
var _a, _b;
|
21150
|
+
var _a, _b, _c;
|
20939
21151
|
|
20940
21152
|
livekitLogger.info('disconnect from room', {
|
20941
21153
|
identity: _this.localParticipant.identity
|
20942
21154
|
});
|
20943
21155
|
|
20944
|
-
if (_this.state === ConnectionState.Connecting) {
|
21156
|
+
if (_this.state === ConnectionState.Connecting || _this.state === ConnectionState.Reconnecting) {
|
20945
21157
|
// try aborting pending connection attempt
|
20946
21158
|
livekitLogger.warn('abort connection attempt');
|
20947
|
-
(_a = _this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
20948
|
-
|
21159
|
+
(_a = _this.abortController) === null || _a === void 0 ? void 0 : _a.abort(); // in case the abort controller didn't manage to cancel the connection attempt, reject the connect promise explicitly
|
21160
|
+
|
21161
|
+
(_b = _this.connectFuture) === null || _b === void 0 ? void 0 : _b.reject(new ConnectionError('Client initiated disconnect'));
|
21162
|
+
_this.connectFuture = undefined;
|
20949
21163
|
} // send leave
|
20950
21164
|
|
20951
21165
|
|
20952
|
-
if ((
|
21166
|
+
if ((_c = _this.engine) === null || _c === void 0 ? void 0 : _c.client.isConnected) {
|
20953
21167
|
await _this.engine.client.sendLeave();
|
20954
21168
|
} // close engine (also closes client)
|
20955
21169
|
|
@@ -20970,7 +21184,11 @@ class Room extends events.exports.EventEmitter {
|
|
20970
21184
|
};
|
20971
21185
|
|
20972
21186
|
this.handleRestarting = () => {
|
20973
|
-
|
21187
|
+
if (!this.reconnectFuture) {
|
21188
|
+
this.reconnectFuture = new Future();
|
21189
|
+
} // also unwind existing participants & existing subscriptions
|
21190
|
+
|
21191
|
+
|
20974
21192
|
for (const p of this.participants.values()) {
|
20975
21193
|
this.handleParticipantDisconnected(p.sid, p);
|
20976
21194
|
}
|
@@ -20981,11 +21199,15 @@ class Room extends events.exports.EventEmitter {
|
|
20981
21199
|
};
|
20982
21200
|
|
20983
21201
|
this.handleRestarted = async joinResponse => {
|
21202
|
+
var _a;
|
21203
|
+
|
20984
21204
|
livekitLogger.debug("reconnected to server", {
|
20985
21205
|
region: joinResponse.serverRegion
|
20986
21206
|
});
|
20987
21207
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
20988
|
-
this.emit(RoomEvent.Reconnected);
|
21208
|
+
this.emit(RoomEvent.Reconnected);
|
21209
|
+
(_a = this.reconnectFuture) === null || _a === void 0 ? void 0 : _a.resolve();
|
21210
|
+
this.reconnectFuture = undefined; // rehydrate participants
|
20989
21211
|
|
20990
21212
|
if (joinResponse.participant) {
|
20991
21213
|
// with a restart, the sid will have changed, we'll map our understanding to it
|
@@ -21043,10 +21265,7 @@ class Room extends events.exports.EventEmitter {
|
|
21043
21265
|
|
21044
21266
|
if (info.state === ParticipantInfo_State.DISCONNECTED) {
|
21045
21267
|
this.handleParticipantDisconnected(info.sid, remoteParticipant);
|
21046
|
-
} else if (isNewParticipant) {
|
21047
|
-
// fire connected event
|
21048
|
-
this.emitWhenConnected(RoomEvent.ParticipantConnected, remoteParticipant);
|
21049
|
-
} else {
|
21268
|
+
} else if (!isNewParticipant) {
|
21050
21269
|
// just update, no events
|
21051
21270
|
remoteParticipant.updateInfo(info);
|
21052
21271
|
}
|
@@ -21269,11 +21488,19 @@ class Room extends events.exports.EventEmitter {
|
|
21269
21488
|
}).on(EngineEvent.Disconnected, reason => {
|
21270
21489
|
this.handleDisconnect(this.options.stopLocalTrackOnUnpublish, reason);
|
21271
21490
|
}).on(EngineEvent.ActiveSpeakersUpdate, this.handleActiveSpeakersUpdate).on(EngineEvent.DataPacketReceived, this.handleDataPacket).on(EngineEvent.Resuming, () => {
|
21491
|
+
if (!this.reconnectFuture) {
|
21492
|
+
this.reconnectFuture = new Future();
|
21493
|
+
}
|
21494
|
+
|
21272
21495
|
if (this.setAndEmitConnectionState(ConnectionState.Reconnecting)) {
|
21273
21496
|
this.emit(RoomEvent.Reconnecting);
|
21274
21497
|
}
|
21275
21498
|
}).on(EngineEvent.Resumed, () => {
|
21499
|
+
var _a;
|
21500
|
+
|
21276
21501
|
this.setAndEmitConnectionState(ConnectionState.Connected);
|
21502
|
+
(_a = this.reconnectFuture) === null || _a === void 0 ? void 0 : _a.resolve();
|
21503
|
+
this.reconnectFuture = undefined;
|
21277
21504
|
this.emit(RoomEvent.Reconnected);
|
21278
21505
|
this.updateSubscriptions();
|
21279
21506
|
}).on(EngineEvent.SignalResumed, () => {
|
@@ -21482,13 +21709,15 @@ class Room extends events.exports.EventEmitter {
|
|
21482
21709
|
}
|
21483
21710
|
|
21484
21711
|
onTrackAdded(mediaTrack, stream, receiver) {
|
21485
|
-
// don't fire onSubscribed when connecting
|
21712
|
+
var _a, _b; // don't fire onSubscribed when connecting
|
21486
21713
|
// WebRTC fires onTrack as soon as setRemoteDescription is called on the offer
|
21487
21714
|
// at that time, ICE connectivity has not been established so the track is not
|
21488
21715
|
// technically subscribed.
|
21489
21716
|
// We'll defer these events until when the room is connected or eventually disconnected.
|
21490
|
-
|
21491
|
-
|
21717
|
+
|
21718
|
+
|
21719
|
+
if (this.connectFuture || this.reconnectFuture) {
|
21720
|
+
Promise.allSettled([(_a = this.connectFuture) === null || _a === void 0 ? void 0 : _a.promise, (_b = this.reconnectFuture) === null || _b === void 0 ? void 0 : _b.promise]).then(() => {
|
21492
21721
|
this.onTrackAdded(mediaTrack, stream, receiver);
|
21493
21722
|
});
|
21494
21723
|
return;
|
@@ -21527,10 +21756,17 @@ class Room extends events.exports.EventEmitter {
|
|
21527
21756
|
let shouldStopTracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
21528
21757
|
let reason = arguments.length > 1 ? arguments[1] : undefined;
|
21529
21758
|
|
21530
|
-
var _a;
|
21759
|
+
var _a, _b;
|
21531
21760
|
|
21532
21761
|
if (this.state === ConnectionState.Disconnected) {
|
21533
21762
|
return;
|
21763
|
+
} // reject potentially ongoing reconnection attempt
|
21764
|
+
|
21765
|
+
|
21766
|
+
if (this.connectFuture === this.reconnectFuture) {
|
21767
|
+
(_a = this.connectFuture) === null || _a === void 0 ? void 0 : _a.reject(undefined);
|
21768
|
+
this.connectFuture = undefined;
|
21769
|
+
this.reconnectFuture = undefined;
|
21534
21770
|
}
|
21535
21771
|
|
21536
21772
|
this.participants.forEach(p => {
|
@@ -21564,7 +21800,7 @@ class Room extends events.exports.EventEmitter {
|
|
21564
21800
|
|
21565
21801
|
if (isWeb()) {
|
21566
21802
|
window.removeEventListener('beforeunload', this.onBeforeUnload);
|
21567
|
-
(
|
21803
|
+
(_b = navigator.mediaDevices) === null || _b === void 0 ? void 0 : _b.removeEventListener('devicechange', this.handleDeviceChange);
|
21568
21804
|
}
|
21569
21805
|
|
21570
21806
|
this.setAndEmitConnectionState(ConnectionState.Disconnected);
|
@@ -21623,7 +21859,10 @@ class Room extends events.exports.EventEmitter {
|
|
21623
21859
|
this.participants.set(id, participant);
|
21624
21860
|
|
21625
21861
|
if (info) {
|
21626
|
-
this.identityToSid.set(info.identity, info.sid);
|
21862
|
+
this.identityToSid.set(info.identity, info.sid); // if we have valid info and the participant wasn't in the map before, we can assume the participant is new
|
21863
|
+
// firing here to make sure that `ParticipantConnected` fires before the initial track events
|
21864
|
+
|
21865
|
+
this.emitWhenConnected(RoomEvent.ParticipantConnected, participant);
|
21627
21866
|
} // also forward events
|
21628
21867
|
// trackPublished is only fired for tracks added after both local participant
|
21629
21868
|
// and remote participant joined the room
|
@@ -21719,41 +21958,12 @@ class Room extends events.exports.EventEmitter {
|
|
21719
21958
|
}
|
21720
21959
|
}
|
21721
21960
|
|
21722
|
-
setAndEmitConnectionState(state
|
21961
|
+
setAndEmitConnectionState(state) {
|
21723
21962
|
if (state === this.state) {
|
21724
21963
|
// unchanged
|
21725
21964
|
return false;
|
21726
21965
|
}
|
21727
21966
|
|
21728
|
-
switch (state) {
|
21729
|
-
case ConnectionState.Connecting:
|
21730
|
-
case ConnectionState.Reconnecting:
|
21731
|
-
if (!this.connectFuture) {
|
21732
|
-
// reuse existing connect future if possible
|
21733
|
-
this.connectFuture = new Future();
|
21734
|
-
}
|
21735
|
-
|
21736
|
-
break;
|
21737
|
-
|
21738
|
-
case ConnectionState.Connected:
|
21739
|
-
if (this.connectFuture) {
|
21740
|
-
this.connectFuture.resolve();
|
21741
|
-
this.connectFuture = undefined;
|
21742
|
-
}
|
21743
|
-
|
21744
|
-
break;
|
21745
|
-
|
21746
|
-
case ConnectionState.Disconnected:
|
21747
|
-
if (this.connectFuture) {
|
21748
|
-
error !== null && error !== void 0 ? error : error = new Error('disconnected from Room');
|
21749
|
-
this.connectFuture.reject(error);
|
21750
|
-
this.connectFuture = undefined;
|
21751
|
-
}
|
21752
|
-
|
21753
|
-
break;
|
21754
|
-
|
21755
|
-
}
|
21756
|
-
|
21757
21967
|
this.state = state;
|
21758
21968
|
this.emit(RoomEvent.ConnectionStateChanged, this.state);
|
21759
21969
|
return true;
|
@@ -21801,8 +22011,22 @@ async function createLocalTracks(options) {
|
|
21801
22011
|
(_a = options.audio) !== null && _a !== void 0 ? _a : options.audio = true;
|
21802
22012
|
(_b = options.video) !== null && _b !== void 0 ? _b : options.video = true;
|
21803
22013
|
const opts = mergeDefaultOptions(options, audioDefaults, videoDefaults);
|
21804
|
-
const constraints = constraintsForOptions(opts);
|
21805
|
-
|
22014
|
+
const constraints = constraintsForOptions(opts); // Keep a reference to the promise on DeviceManager and await it in getLocalDevices()
|
22015
|
+
// works around iOS Safari Bug https://bugs.webkit.org/show_bug.cgi?id=179363
|
22016
|
+
|
22017
|
+
const mediaPromise = navigator.mediaDevices.getUserMedia(constraints);
|
22018
|
+
|
22019
|
+
if (options.audio) {
|
22020
|
+
DeviceManager.userMediaPromiseMap.set('audioinput', mediaPromise);
|
22021
|
+
mediaPromise.catch(() => DeviceManager.userMediaPromiseMap.delete('audioinput'));
|
22022
|
+
}
|
22023
|
+
|
22024
|
+
if (options.video) {
|
22025
|
+
DeviceManager.userMediaPromiseMap.set('videoinput', mediaPromise);
|
22026
|
+
mediaPromise.catch(() => DeviceManager.userMediaPromiseMap.delete('videoinput'));
|
22027
|
+
}
|
22028
|
+
|
22029
|
+
const stream = await mediaPromise;
|
21806
22030
|
return stream.getTracks().map(mediaStreamTrack => {
|
21807
22031
|
const isAudio = mediaStreamTrack.kind === 'audio';
|
21808
22032
|
isAudio ? options.audio : options.video;
|