twilio-video 2.18.2 → 2.20.0
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/CHANGELOG.md +81 -0
- package/LICENSE.md +1 -1
- package/README.md +1 -1
- package/dist/twilio-video.js +1000 -796
- package/dist/twilio-video.min.js +23 -23
- package/es5/connect.js +24 -3
- package/es5/connect.js.map +1 -1
- package/es5/encodingparameters.js +5 -1
- package/es5/encodingparameters.js.map +1 -1
- package/es5/localparticipant.js +4 -0
- package/es5/localparticipant.js.map +1 -1
- package/es5/media/track/localmediatrack.js +2 -0
- package/es5/media/track/localmediatrack.js.map +1 -1
- package/es5/media/track/sender.js +50 -2
- package/es5/media/track/sender.js.map +1 -1
- package/es5/preflight/getturncredentials.js +14 -9
- package/es5/preflight/getturncredentials.js.map +1 -1
- package/es5/preflight/preflighttest.js +115 -75
- package/es5/preflight/preflighttest.js.map +1 -1
- package/es5/signaling/v2/cancelableroomsignalingpromise.js +2 -0
- package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
- package/es5/signaling/v2/iceconnectionmonitor.js +3 -7
- package/es5/signaling/v2/iceconnectionmonitor.js.map +1 -1
- package/es5/signaling/v2/localparticipant.js +35 -1
- package/es5/signaling/v2/localparticipant.js.map +1 -1
- package/es5/signaling/v2/networkqualitysignaling.js +20 -1
- package/es5/signaling/v2/networkqualitysignaling.js.map +1 -1
- package/es5/signaling/v2/peerconnection.js +268 -145
- package/es5/signaling/v2/peerconnection.js.map +1 -1
- package/es5/signaling/v2/peerconnectionmanager.js +8 -0
- package/es5/signaling/v2/peerconnectionmanager.js.map +1 -1
- package/es5/signaling/v2/publisherhintsignaling.js +85 -0
- package/es5/signaling/v2/publisherhintsignaling.js.map +1 -0
- package/es5/signaling/v2/renderhintssignaling.js +28 -17
- package/es5/signaling/v2/renderhintssignaling.js.map +1 -1
- package/es5/signaling/v2/room.js +33 -1
- package/es5/signaling/v2/room.js.map +1 -1
- package/es5/signaling/v2/twilioconnectiontransport.js +6 -8
- package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
- package/es5/util/cancelablepromise.js +11 -0
- package/es5/util/cancelablepromise.js.map +1 -1
- package/es5/util/constants.js +1 -0
- package/es5/util/constants.js.map +1 -1
- package/es5/util/index.js +22 -6
- package/es5/util/index.js.map +1 -1
- package/es5/util/sdp/index.js +31 -95
- package/es5/util/sdp/index.js.map +1 -1
- package/es5/util/sdp/issue8329.js +1 -2
- package/es5/util/sdp/issue8329.js.map +1 -1
- package/es5/util/sdp/simulcast.js +6 -29
- package/es5/util/sdp/simulcast.js.map +1 -1
- package/es5/util/sdp/{trackmatcher/mid.js → trackmatcher.js} +11 -11
- package/es5/util/sdp/trackmatcher.js.map +1 -0
- package/lib/connect.js +29 -3
- package/lib/encodingparameters.js +5 -1
- package/lib/localparticipant.js +5 -0
- package/lib/media/track/localmediatrack.js +2 -0
- package/lib/media/track/sender.js +36 -2
- package/lib/preflight/getturncredentials.ts +18 -9
- package/lib/preflight/preflighttest.ts +110 -74
- package/lib/signaling/v2/cancelableroomsignalingpromise.js +2 -0
- package/lib/signaling/v2/iceconnectionmonitor.js +3 -8
- package/lib/signaling/v2/localparticipant.js +41 -1
- package/lib/signaling/v2/networkqualitysignaling.js +24 -1
- package/lib/signaling/v2/peerconnection.js +270 -157
- package/lib/signaling/v2/peerconnectionmanager.js +9 -0
- package/lib/signaling/v2/publisherhintsignaling.js +71 -0
- package/lib/signaling/v2/renderhintssignaling.js +28 -17
- package/lib/signaling/v2/room.js +37 -1
- package/lib/signaling/v2/twilioconnectiontransport.js +7 -10
- package/lib/util/cancelablepromise.js +12 -0
- package/lib/util/constants.js +1 -0
- package/lib/util/index.js +21 -6
- package/lib/util/sdp/index.js +30 -102
- package/lib/util/sdp/issue8329.js +2 -3
- package/lib/util/sdp/simulcast.js +6 -31
- package/lib/util/sdp/{trackmatcher/mid.js → trackmatcher.js} +6 -6
- package/package.json +3 -3
- package/tsconfig.json +1 -1
- package/tsdef/PreflightTypes.d.ts +6 -2
- package/tsdef/index.d.ts +2 -2
- package/tsdef/preflighttest.d.ts +1 -1
- package/tsdef/twilio-video-tests.ts +19 -0
- package/tsdef/types.d.ts +6 -1
- package/es5/util/sdp/trackmatcher/identity.js +0 -25
- package/es5/util/sdp/trackmatcher/identity.js.map +0 -1
- package/es5/util/sdp/trackmatcher/mid.js.map +0 -1
- package/es5/util/sdp/trackmatcher/ordered.js +0 -111
- package/es5/util/sdp/trackmatcher/ordered.js.map +0 -1
- package/lib/util/sdp/trackmatcher/identity.js +0 -24
- package/lib/util/sdp/trackmatcher/ordered.js +0 -120
package/dist/twilio-video.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! twilio-video.js 2.
|
|
1
|
+
/*! twilio-video.js 2.20.0
|
|
2
2
|
|
|
3
3
|
The following license applies to all parts of this software except as
|
|
4
4
|
documented below.
|
|
5
5
|
|
|
6
|
-
Copyright (C) 2019-
|
|
6
|
+
Copyright (C) 2019-2022 Twilio, inc.
|
|
7
7
|
All rights reserved.
|
|
8
8
|
|
|
9
9
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -83,7 +83,7 @@ function createCancelableRoomPromise(getLocalTracks, createLocalParticipant, cre
|
|
|
83
83
|
}
|
|
84
84
|
module.exports = createCancelableRoomPromise;
|
|
85
85
|
|
|
86
|
-
},{"./util/cancelablepromise":
|
|
86
|
+
},{"./util/cancelablepromise":120}],2:[function(require,module,exports){
|
|
87
87
|
'use strict';
|
|
88
88
|
var MediaStreamTrack = require('@twilio/webrtc').MediaStreamTrack;
|
|
89
89
|
var _a = require('@twilio/webrtc/lib/util'), guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion;
|
|
@@ -272,6 +272,15 @@ function connect(token, options) {
|
|
|
272
272
|
// The warning is displayed only for the first call to connect() per browser session.
|
|
273
273
|
// Additionally, the options that are no longer needed will be removed.
|
|
274
274
|
deprecateOptions(options, log, deprecatedConnectOptionsProps);
|
|
275
|
+
var adaptiveSimulcast = options.preferredVideoCodecs === 'auto';
|
|
276
|
+
if (adaptiveSimulcast) {
|
|
277
|
+
// NOTE(mpatwardhan): enable adaptiveSimulcast.
|
|
278
|
+
options.preferredVideoCodecs = [{ codec: 'VP8', simulcast: true, adaptiveSimulcast: true }];
|
|
279
|
+
}
|
|
280
|
+
if (options.maxVideoBitrate && adaptiveSimulcast) {
|
|
281
|
+
log.error('ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"');
|
|
282
|
+
return CancelablePromise.reject(E.ILLEGAL_INVOKE('connect', 'ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"'));
|
|
283
|
+
}
|
|
275
284
|
options = Object.assign({
|
|
276
285
|
automaticSubscription: true,
|
|
277
286
|
createLocalTracks: createLocalTracks,
|
|
@@ -394,7 +403,7 @@ function connect(token, options) {
|
|
|
394
403
|
var encodingParameters = new EncodingParametersImpl({
|
|
395
404
|
maxAudioBitrate: options.maxAudioBitrate,
|
|
396
405
|
maxVideoBitrate: options.maxVideoBitrate
|
|
397
|
-
});
|
|
406
|
+
}, adaptiveSimulcast);
|
|
398
407
|
var preferredCodecs = {
|
|
399
408
|
audio: options.preferredAudioCodecs.map(normalizeCodecSettings),
|
|
400
409
|
video: options.preferredVideoCodecs.map(normalizeCodecSettings)
|
|
@@ -479,6 +488,7 @@ function connect(token, options) {
|
|
|
479
488
|
* effect for fixed bitrate codecs; Based on our tests, Chrome, Firefox and Safari
|
|
480
489
|
* all seem to support an average bitrate range of 20000 bps (20 kbps) to
|
|
481
490
|
* 8000000 bps (8 mbps) for a 720p VideoTrack
|
|
491
|
+
* This parameter must not be set when when preferredVideoCodecs is set to `auto`.
|
|
482
492
|
* @property {?string} [name=null] - Set to connect to a {@link Room} by name
|
|
483
493
|
* @property {boolean|NetworkQualityConfiguration} [networkQuality=false] - Whether to enable the Network
|
|
484
494
|
* Quality API or not. This only takes effect in Group Rooms. Pass a {@link NetworkQualityConfiguration}
|
|
@@ -494,8 +504,11 @@ function connect(token, options) {
|
|
|
494
504
|
* for the list of supported signaling regions.
|
|
495
505
|
* @property {Array<AudioCodec|AudioCodecSettings>} [preferredAudioCodecs=[]] - Preferred audio codecs;
|
|
496
506
|
* An empty array preserves the current audio codec preference order.
|
|
497
|
-
* @property {Array<VideoCodec|VideoCodecSettings
|
|
498
|
-
* Preferred video codecs;
|
|
507
|
+
* @property {Array<VideoCodec|VideoCodecSettings>|VideoEncodingMode} [preferredVideoCodecs=[]] -
|
|
508
|
+
* Preferred video codecs; when set to 'VideoEncodingMode.Auto', SDK manages the video codec,
|
|
509
|
+
* by preferring VP8 simulcast in group rooms. It also enables adaptive simulcast, which allows SDK
|
|
510
|
+
* to turn off simulcast layers that are not needed for efficient bandwidth and CPU usage.
|
|
511
|
+
* An empty array preserves the current video codec.
|
|
499
512
|
* preference order. If you want to set a preferred video codec on a Group Room,
|
|
500
513
|
* you will need to create the Room using the REST API and set the
|
|
501
514
|
* <code>VideoCodecs</code> property.
|
|
@@ -633,6 +646,14 @@ var AudioCodec = {
|
|
|
633
646
|
PCMA: 'PCMA',
|
|
634
647
|
PCMU: 'PCMU'
|
|
635
648
|
};
|
|
649
|
+
/**
|
|
650
|
+
* Names of the supported VideoEncodingMode.
|
|
651
|
+
* @enum {string}
|
|
652
|
+
*/
|
|
653
|
+
// eslint-disable-next-line
|
|
654
|
+
var VideoEncodingMode = {
|
|
655
|
+
Auto: 'auto',
|
|
656
|
+
};
|
|
636
657
|
/**
|
|
637
658
|
* Names of the supported video codecs.
|
|
638
659
|
* @enum {string}
|
|
@@ -971,7 +992,7 @@ function normalizeCodecSettings(nameOrSettings) {
|
|
|
971
992
|
}
|
|
972
993
|
module.exports = connect;
|
|
973
994
|
|
|
974
|
-
},{"./cancelableroompromise":1,"./createlocaltracks":4,"./encodingparameters":9,"./localparticipant":12,"./media/track/es5":14,"./networkqualityconfiguration":42,"./room":54,"./signaling/v2":68,"./util":
|
|
995
|
+
},{"./cancelableroompromise":1,"./createlocaltracks":4,"./encodingparameters":9,"./localparticipant":12,"./media/track/es5":14,"./networkqualityconfiguration":42,"./room":54,"./signaling/v2":68,"./util":127,"./util/cancelablepromise":120,"./util/constants":121,"./util/eventobserver":125,"./util/insightspublisher":128,"./util/insightspublisher/null":129,"./util/log":131,"./util/validate":144,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],3:[function(require,module,exports){
|
|
975
996
|
'use strict';
|
|
976
997
|
var defaultCreateLocalTracks = require('./createlocaltracks');
|
|
977
998
|
var _a = require('./util/constants'), DEFAULT_LOG_LEVEL = _a.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _a.DEFAULT_LOGGER_NAME;
|
|
@@ -1084,7 +1105,7 @@ module.exports = {
|
|
|
1084
1105
|
video: createLocalVideoTrack
|
|
1085
1106
|
};
|
|
1086
1107
|
|
|
1087
|
-
},{"./createlocaltracks":4,"./util/constants":
|
|
1108
|
+
},{"./createlocaltracks":4,"./util/constants":121}],4:[function(require,module,exports){
|
|
1088
1109
|
'use strict';
|
|
1089
1110
|
var asLocalTrack = require('./util').asLocalTrack;
|
|
1090
1111
|
var buildLogLevels = require('./util').buildLogLevels;
|
|
@@ -1245,7 +1266,7 @@ function createLocalTracks(options) {
|
|
|
1245
1266
|
*/
|
|
1246
1267
|
module.exports = createLocalTracks;
|
|
1247
1268
|
|
|
1248
|
-
},{"./media/track/es5":14,"./util":
|
|
1269
|
+
},{"./media/track/es5":14,"./util":127,"./util/constants":121,"./util/log":131,"./webaudio/workaround180748":148,"@twilio/webrtc":151}],5:[function(require,module,exports){
|
|
1249
1270
|
'use strict';
|
|
1250
1271
|
var __extends = (this && this.__extends) || (function () {
|
|
1251
1272
|
var extendStatics = function (d, b) {
|
|
@@ -1444,7 +1465,7 @@ var DataTrackSender = /** @class */ (function (_super) {
|
|
|
1444
1465
|
}(DataTrackTransceiver));
|
|
1445
1466
|
module.exports = DataTrackSender;
|
|
1446
1467
|
|
|
1447
|
-
},{"../util":
|
|
1468
|
+
},{"../util":127,"./transceiver":7}],7:[function(require,module,exports){
|
|
1448
1469
|
'use strict';
|
|
1449
1470
|
var __extends = (this && this.__extends) || (function () {
|
|
1450
1471
|
var extendStatics = function (d, b) {
|
|
@@ -1504,7 +1525,7 @@ var DataTrackTransceiver = /** @class */ (function (_super) {
|
|
|
1504
1525
|
}(TrackTransceiver));
|
|
1505
1526
|
module.exports = DataTrackTransceiver;
|
|
1506
1527
|
|
|
1507
|
-
},{"../transceiver":
|
|
1528
|
+
},{"../transceiver":116}],8:[function(require,module,exports){
|
|
1508
1529
|
'use strict';
|
|
1509
1530
|
var __extends = (this && this.__extends) || (function () {
|
|
1510
1531
|
var extendStatics = function (d, b) {
|
|
@@ -1601,7 +1622,7 @@ var DataTransport = /** @class */ (function (_super) {
|
|
|
1601
1622
|
*/
|
|
1602
1623
|
module.exports = DataTransport;
|
|
1603
1624
|
|
|
1604
|
-
},{"events":
|
|
1625
|
+
},{"events":178}],9:[function(require,module,exports){
|
|
1605
1626
|
'use strict';
|
|
1606
1627
|
var __extends = (this && this.__extends) || (function () {
|
|
1607
1628
|
var extendStatics = function (d, b) {
|
|
@@ -1633,8 +1654,9 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
|
|
|
1633
1654
|
/**
|
|
1634
1655
|
* Construct an {@link EncodingParametersImpl}.
|
|
1635
1656
|
* @param {EncodingParamters} encodingParameters - Initial {@link EncodingParameters}
|
|
1657
|
+
* @param {Boolean} adaptiveSimulcast - true if adaptive simulcast was enabled by connect options.
|
|
1636
1658
|
*/
|
|
1637
|
-
function EncodingParametersImpl(encodingParameters) {
|
|
1659
|
+
function EncodingParametersImpl(encodingParameters, adaptiveSimulcast) {
|
|
1638
1660
|
var _this = _super.call(this) || this;
|
|
1639
1661
|
encodingParameters = Object.assign({
|
|
1640
1662
|
maxAudioBitrate: null,
|
|
@@ -1648,6 +1670,9 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
|
|
|
1648
1670
|
maxVideoBitrate: {
|
|
1649
1671
|
value: encodingParameters.maxVideoBitrate,
|
|
1650
1672
|
writable: true
|
|
1673
|
+
},
|
|
1674
|
+
adaptiveSimulcast: {
|
|
1675
|
+
value: adaptiveSimulcast
|
|
1651
1676
|
}
|
|
1652
1677
|
});
|
|
1653
1678
|
return _this;
|
|
@@ -1695,13 +1720,13 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
|
|
|
1695
1720
|
*/
|
|
1696
1721
|
module.exports = EncodingParametersImpl;
|
|
1697
1722
|
|
|
1698
|
-
},{"events":
|
|
1723
|
+
},{"events":178}],10:[function(require,module,exports){
|
|
1699
1724
|
'use strict';
|
|
1700
1725
|
var EventEmitter = require('events').EventEmitter;
|
|
1701
1726
|
var hidePrivateAndCertainPublicPropertiesInClass = require('./util').hidePrivateAndCertainPublicPropertiesInClass;
|
|
1702
1727
|
module.exports = hidePrivateAndCertainPublicPropertiesInClass(EventEmitter, ['domain']);
|
|
1703
1728
|
|
|
1704
|
-
},{"./util":
|
|
1729
|
+
},{"./util":127,"events":178}],11:[function(require,module,exports){
|
|
1705
1730
|
'use strict';
|
|
1706
1731
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1707
1732
|
var preflighttest_1 = require("./preflight/preflighttest");
|
|
@@ -1764,7 +1789,7 @@ module.exports = {
|
|
|
1764
1789
|
LocalDataTrack: LocalDataTrack
|
|
1765
1790
|
};
|
|
1766
1791
|
|
|
1767
|
-
},{"../package.json":
|
|
1792
|
+
},{"../package.json":199,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":48,"./util/support":140,"./vendor/loglevel":145}],12:[function(require,module,exports){
|
|
1768
1793
|
'use strict';
|
|
1769
1794
|
var __extends = (this && this.__extends) || (function () {
|
|
1770
1795
|
var extendStatics = function (d, b) {
|
|
@@ -2266,6 +2291,10 @@ var LocalParticipant = /** @class */ (function (_super) {
|
|
|
2266
2291
|
throw E.INVALID_TYPE('encodingParameters', 'EncodingParameters, null or undefined');
|
|
2267
2292
|
}
|
|
2268
2293
|
if (encodingParameters) {
|
|
2294
|
+
if (this._signaling.getParameters().adaptiveSimulcast && encodingParameters.maxVideoBitrate) {
|
|
2295
|
+
// eslint-disable-next-line new-cap
|
|
2296
|
+
throw E.INVALID_TYPE('encodingParameters', 'encodingParameters.maxVideoBitrate is not compatible with "preferredVideoCodecs=auto"');
|
|
2297
|
+
}
|
|
2269
2298
|
['maxAudioBitrate', 'maxVideoBitrate'].forEach(function (prop) {
|
|
2270
2299
|
if (typeof encodingParameters[prop] !== 'undefined'
|
|
2271
2300
|
&& typeof encodingParameters[prop] !== 'number'
|
|
@@ -2439,7 +2468,7 @@ function getTrackPublication(trackPublications, track) {
|
|
|
2439
2468
|
}
|
|
2440
2469
|
module.exports = LocalParticipant;
|
|
2441
2470
|
|
|
2442
|
-
},{"./media/track/es5":14,"./media/track/localaudiotrackpublication":20,"./media/track/localdatatrackpublication":22,"./media/track/localvideotrackpublication":26,"./participant":43,"./util":
|
|
2471
|
+
},{"./media/track/es5":14,"./media/track/localaudiotrackpublication":20,"./media/track/localdatatrackpublication":22,"./media/track/localvideotrackpublication":26,"./participant":43,"./util":127,"./util/constants":121,"./util/validate":144,"@twilio/webrtc":151}],13:[function(require,module,exports){
|
|
2443
2472
|
'use strict';
|
|
2444
2473
|
var __extends = (this && this.__extends) || (function () {
|
|
2445
2474
|
var extendStatics = function (d, b) {
|
|
@@ -2628,7 +2657,7 @@ function LocalAudioTrack(mediaStreamTrack, options) {
|
|
|
2628
2657
|
inherits(LocalAudioTrack, LocalAudioTrackClass);
|
|
2629
2658
|
module.exports = LocalAudioTrack;
|
|
2630
2659
|
|
|
2631
|
-
},{"../localaudiotrack":19,"util":
|
|
2660
|
+
},{"../localaudiotrack":19,"util":197}],16:[function(require,module,exports){
|
|
2632
2661
|
// eslint-disable-next-line no-warning-comments
|
|
2633
2662
|
// TODO(mroberts): Remove this when we go to the next major version. This is
|
|
2634
2663
|
// only in place so that we can support ES6 classes without requiring `new`.
|
|
@@ -2643,7 +2672,7 @@ function LocalDataTrack(options) {
|
|
|
2643
2672
|
inherits(LocalDataTrack, LocalDataTrackClass);
|
|
2644
2673
|
module.exports = LocalDataTrack;
|
|
2645
2674
|
|
|
2646
|
-
},{"../localdatatrack":21,"util":
|
|
2675
|
+
},{"../localdatatrack":21,"util":197}],17:[function(require,module,exports){
|
|
2647
2676
|
// eslint-disable-next-line no-warning-comments
|
|
2648
2677
|
// TODO(mroberts): Remove this when we go to the next major version. This is
|
|
2649
2678
|
// only in place so that we can support ES6 classes without requiring `new`.
|
|
@@ -2658,7 +2687,7 @@ function LocalVideoTrack(mediaStreamTrack, options) {
|
|
|
2658
2687
|
inherits(LocalVideoTrack, LocalVideoTrackClass);
|
|
2659
2688
|
module.exports = LocalVideoTrack;
|
|
2660
2689
|
|
|
2661
|
-
},{"../localvideotrack":25,"util":
|
|
2690
|
+
},{"../localvideotrack":25,"util":197}],18:[function(require,module,exports){
|
|
2662
2691
|
'use strict';
|
|
2663
2692
|
var __extends = (this && this.__extends) || (function () {
|
|
2664
2693
|
var extendStatics = function (d, b) {
|
|
@@ -2770,7 +2799,7 @@ var Track = /** @class */ (function (_super) {
|
|
|
2770
2799
|
*/
|
|
2771
2800
|
module.exports = Track;
|
|
2772
2801
|
|
|
2773
|
-
},{"../../eventemitter":10,"../../util":
|
|
2802
|
+
},{"../../eventemitter":10,"../../util":127,"../../util/constants":121,"../../util/log":131}],19:[function(require,module,exports){
|
|
2774
2803
|
'use strict';
|
|
2775
2804
|
var __extends = (this && this.__extends) || (function () {
|
|
2776
2805
|
var extendStatics = function (d, b) {
|
|
@@ -3462,6 +3491,8 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
|
|
|
3462
3491
|
addMediaStreamTrackListeners();
|
|
3463
3492
|
trackChangeInProgress.resolve();
|
|
3464
3493
|
trackChangeInProgress = null;
|
|
3494
|
+
}).catch(function (error) {
|
|
3495
|
+
log.error('failed to restart track: ', error);
|
|
3465
3496
|
});
|
|
3466
3497
|
}
|
|
3467
3498
|
// NOTE(mmalavalli): If the MediaStreamTrack ends before the DOM is visible,
|
|
@@ -3513,7 +3544,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
|
|
|
3513
3544
|
}
|
|
3514
3545
|
module.exports = mixinLocalMediaTrack;
|
|
3515
3546
|
|
|
3516
|
-
},{"../../util":
|
|
3547
|
+
},{"../../util":127,"../../util/constants":121,"../../util/detectsilentaudio":122,"../../util/detectsilentvideo":123,"../../util/documentvisibilitymonitor.js":124,"../../util/localmediarestartdeferreds":130,"../../webaudio/workaround180748":148,"./sender":37,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],24:[function(require,module,exports){
|
|
3517
3548
|
/* eslint new-cap:0 */
|
|
3518
3549
|
'use strict';
|
|
3519
3550
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -3627,7 +3658,7 @@ var LocalTrackPublication = /** @class */ (function (_super) {
|
|
|
3627
3658
|
}(TrackPublication));
|
|
3628
3659
|
module.exports = LocalTrackPublication;
|
|
3629
3660
|
|
|
3630
|
-
},{"../../util/constants":
|
|
3661
|
+
},{"../../util/constants":121,"./trackpublication":38}],25:[function(require,module,exports){
|
|
3631
3662
|
'use strict';
|
|
3632
3663
|
var __extends = (this && this.__extends) || (function () {
|
|
3633
3664
|
var extendStatics = function (d, b) {
|
|
@@ -3974,7 +4005,7 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
|
|
|
3974
4005
|
*/
|
|
3975
4006
|
module.exports = LocalVideoTrack;
|
|
3976
4007
|
|
|
3977
|
-
},{"../../util":
|
|
4008
|
+
},{"../../util":127,"../../util/detectsilentvideo":123,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":164}],26:[function(require,module,exports){
|
|
3978
4009
|
'use strict';
|
|
3979
4010
|
var __extends = (this && this.__extends) || (function () {
|
|
3980
4011
|
var extendStatics = function (d, b) {
|
|
@@ -4384,7 +4415,7 @@ function shimMediaElement(el, onUnintentionallyPaused) {
|
|
|
4384
4415
|
}
|
|
4385
4416
|
module.exports = MediaTrack;
|
|
4386
4417
|
|
|
4387
|
-
},{"../../util":
|
|
4418
|
+
},{"../../util":127,"../../util/localmediarestartdeferreds":130,"./":18,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],28:[function(require,module,exports){
|
|
4388
4419
|
'use strict';
|
|
4389
4420
|
var __extends = (this && this.__extends) || (function () {
|
|
4390
4421
|
var extendStatics = function (d, b) {
|
|
@@ -4776,7 +4807,7 @@ var RemoteDataTrack = /** @class */ (function (_super) {
|
|
|
4776
4807
|
*/
|
|
4777
4808
|
module.exports = RemoteDataTrack;
|
|
4778
4809
|
|
|
4779
|
-
},{"../../util/constants":
|
|
4810
|
+
},{"../../util/constants":121,"./":18}],32:[function(require,module,exports){
|
|
4780
4811
|
'use strict';
|
|
4781
4812
|
var __extends = (this && this.__extends) || (function () {
|
|
4782
4813
|
var extendStatics = function (d, b) {
|
|
@@ -5124,7 +5155,7 @@ function playIfPausedWhileInBackground(remoteMediaTrack) {
|
|
|
5124
5155
|
*/
|
|
5125
5156
|
module.exports = mixinRemoteMediaTrack;
|
|
5126
5157
|
|
|
5127
|
-
},{"../../util/constants":
|
|
5158
|
+
},{"../../util/constants":121,"../../util/documentvisibilitymonitor.js":124,"@twilio/webrtc/lib/util":164}],34:[function(require,module,exports){
|
|
5128
5159
|
'use strict';
|
|
5129
5160
|
var __extends = (this && this.__extends) || (function () {
|
|
5130
5161
|
var extendStatics = function (d, b) {
|
|
@@ -5753,7 +5784,7 @@ function maybeUpdateDimensionHint(remoteVideoTrack) {
|
|
|
5753
5784
|
*/
|
|
5754
5785
|
module.exports = RemoteVideoTrack;
|
|
5755
5786
|
|
|
5756
|
-
},{"../../util/documentvisibilitymonitor.js":
|
|
5787
|
+
},{"../../util/documentvisibilitymonitor.js":124,"../../util/nullobserver.js":134,"../../util/timeout":141,"./remotemediatrack":33,"./videotrack":41}],36:[function(require,module,exports){
|
|
5757
5788
|
'use strict';
|
|
5758
5789
|
var __extends = (this && this.__extends) || (function () {
|
|
5759
5790
|
var extendStatics = function (d, b) {
|
|
@@ -5842,10 +5873,27 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
5842
5873
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5843
5874
|
};
|
|
5844
5875
|
})();
|
|
5876
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
5877
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5878
|
+
if (!m) return o;
|
|
5879
|
+
var i = m.call(o), r, ar = [], e;
|
|
5880
|
+
try {
|
|
5881
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
5882
|
+
}
|
|
5883
|
+
catch (error) { e = { error: error }; }
|
|
5884
|
+
finally {
|
|
5885
|
+
try {
|
|
5886
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
5887
|
+
}
|
|
5888
|
+
finally { if (e) throw e.error; }
|
|
5889
|
+
}
|
|
5890
|
+
return ar;
|
|
5891
|
+
};
|
|
5845
5892
|
var MediaTrackTransceiver = require('./transceiver');
|
|
5846
5893
|
/**
|
|
5847
5894
|
* A {@link MediaTrackSender} represents one or more local RTCRtpSenders.
|
|
5848
5895
|
* @extends MediaTrackTransceiver
|
|
5896
|
+
* @emits MediaTrackSender#replaced
|
|
5849
5897
|
*/
|
|
5850
5898
|
var MediaTrackSender = /** @class */ (function (_super) {
|
|
5851
5899
|
__extends(MediaTrackSender, _super);
|
|
@@ -5862,6 +5910,9 @@ var MediaTrackSender = /** @class */ (function (_super) {
|
|
|
5862
5910
|
_senders: {
|
|
5863
5911
|
value: new Set()
|
|
5864
5912
|
},
|
|
5913
|
+
_senderToPublisherHintCallbacks: {
|
|
5914
|
+
value: new Map()
|
|
5915
|
+
},
|
|
5865
5916
|
isPublishing: {
|
|
5866
5917
|
get: function () {
|
|
5867
5918
|
return !!this._clones.size;
|
|
@@ -5899,7 +5950,7 @@ var MediaTrackSender = /** @class */ (function (_super) {
|
|
|
5899
5950
|
return Promise.all(clones.map(function (clone) {
|
|
5900
5951
|
return clone.setMediaStreamTrack(mediaStreamTrack.clone());
|
|
5901
5952
|
}).concat(senders.map(function (sender) {
|
|
5902
|
-
return
|
|
5953
|
+
return _this._replaceTrack(sender, mediaStreamTrack);
|
|
5903
5954
|
}))).finally(function () {
|
|
5904
5955
|
_this._track = mediaStreamTrack;
|
|
5905
5956
|
});
|
|
@@ -5907,10 +5958,14 @@ var MediaTrackSender = /** @class */ (function (_super) {
|
|
|
5907
5958
|
/**
|
|
5908
5959
|
* Add an RTCRtpSender.
|
|
5909
5960
|
* @param {RTCRtpSender} sender
|
|
5961
|
+
* @param {?()=>Promise<string>} publisherHintCallback
|
|
5910
5962
|
* @returns {this}
|
|
5911
5963
|
*/
|
|
5912
|
-
MediaTrackSender.prototype.addSender = function (sender) {
|
|
5964
|
+
MediaTrackSender.prototype.addSender = function (sender, publisherHintCallback) {
|
|
5913
5965
|
this._senders.add(sender);
|
|
5966
|
+
if (publisherHintCallback) {
|
|
5967
|
+
this._senderToPublisherHintCallbacks.set(sender, publisherHintCallback);
|
|
5968
|
+
}
|
|
5914
5969
|
return this;
|
|
5915
5970
|
};
|
|
5916
5971
|
/**
|
|
@@ -5920,10 +5975,34 @@ var MediaTrackSender = /** @class */ (function (_super) {
|
|
|
5920
5975
|
*/
|
|
5921
5976
|
MediaTrackSender.prototype.removeSender = function (sender) {
|
|
5922
5977
|
this._senders.delete(sender);
|
|
5978
|
+
this._senderToPublisherHintCallbacks.delete(sender);
|
|
5923
5979
|
return this;
|
|
5924
5980
|
};
|
|
5981
|
+
/**
|
|
5982
|
+
* Applies given encodings, or resets encodings if none specified.
|
|
5983
|
+
* @param {Array<{enabled: boolean, layer_index: number}>|null} encodings
|
|
5984
|
+
* @returns {Promise<string>}
|
|
5985
|
+
*/
|
|
5986
|
+
MediaTrackSender.prototype.setPublisherHint = function (encodings) {
|
|
5987
|
+
// Note(mpatwardhan): since publisher hint applies only to group rooms we only look at 1st call callback.
|
|
5988
|
+
var _a = __read(Array.from(this._senderToPublisherHintCallbacks.values()), 1), publisherHintCallback = _a[0];
|
|
5989
|
+
return publisherHintCallback ? publisherHintCallback(encodings) : Promise.resolve('COULD_NOT_APPLY_HINT');
|
|
5990
|
+
};
|
|
5991
|
+
MediaTrackSender.prototype._replaceTrack = function (sender, mediaStreamTrack) {
|
|
5992
|
+
var _this = this;
|
|
5993
|
+
return sender.replaceTrack(mediaStreamTrack).then(function (replaceTrackResult) {
|
|
5994
|
+
// clear any publisherHints and apply default encodings.
|
|
5995
|
+
_this.setPublisherHint(null).catch(function () { });
|
|
5996
|
+
_this.emit('replaced');
|
|
5997
|
+
return replaceTrackResult;
|
|
5998
|
+
});
|
|
5999
|
+
};
|
|
5925
6000
|
return MediaTrackSender;
|
|
5926
6001
|
}(MediaTrackTransceiver));
|
|
6002
|
+
/**
|
|
6003
|
+
* The {@link MediaTrackSender} replaced the underlying mediaStreamTrack
|
|
6004
|
+
* @event MediaTrackSender#replaced
|
|
6005
|
+
*/
|
|
5927
6006
|
module.exports = MediaTrackSender;
|
|
5928
6007
|
|
|
5929
6008
|
},{"./transceiver":39}],38:[function(require,module,exports){
|
|
@@ -6023,7 +6102,7 @@ var TrackPublication = /** @class */ (function (_super) {
|
|
|
6023
6102
|
*/
|
|
6024
6103
|
module.exports = TrackPublication;
|
|
6025
6104
|
|
|
6026
|
-
},{"../../eventemitter":10,"../../util":
|
|
6105
|
+
},{"../../eventemitter":10,"../../util":127,"../../util/constants":121,"../../util/log":131}],39:[function(require,module,exports){
|
|
6027
6106
|
'use strict';
|
|
6028
6107
|
var __extends = (this && this.__extends) || (function () {
|
|
6029
6108
|
var extendStatics = function (d, b) {
|
|
@@ -6090,7 +6169,7 @@ var MediaTrackTransceiver = /** @class */ (function (_super) {
|
|
|
6090
6169
|
}(TrackTransceiver));
|
|
6091
6170
|
module.exports = MediaTrackTransceiver;
|
|
6092
6171
|
|
|
6093
|
-
},{"../../transceiver":
|
|
6172
|
+
},{"../../transceiver":116}],40:[function(require,module,exports){
|
|
6094
6173
|
'use strict';
|
|
6095
6174
|
var __extends = (this && this.__extends) || (function () {
|
|
6096
6175
|
var extendStatics = function (d, b) {
|
|
@@ -6245,7 +6324,7 @@ var VideoProcessorEventObserver = /** @class */ (function (_super) {
|
|
|
6245
6324
|
}(EventEmitter));
|
|
6246
6325
|
module.exports = VideoProcessorEventObserver;
|
|
6247
6326
|
|
|
6248
|
-
},{"../../util/constants":
|
|
6327
|
+
},{"../../util/constants":121,"events":178}],41:[function(require,module,exports){
|
|
6249
6328
|
'use strict';
|
|
6250
6329
|
var __extends = (this && this.__extends) || (function () {
|
|
6251
6330
|
var extendStatics = function (d, b) {
|
|
@@ -6759,7 +6838,7 @@ function dimensionsChanged(track, elem) {
|
|
|
6759
6838
|
*/
|
|
6760
6839
|
module.exports = VideoTrack;
|
|
6761
6840
|
|
|
6762
|
-
},{"../../util/constants":
|
|
6841
|
+
},{"../../util/constants":121,"./mediatrack":27,"./videoprocessoreventobserver":40}],42:[function(require,module,exports){
|
|
6763
6842
|
'use strict';
|
|
6764
6843
|
var __extends = (this && this.__extends) || (function () {
|
|
6765
6844
|
var extendStatics = function (d, b) {
|
|
@@ -6858,7 +6937,7 @@ var NetworkQualityConfigurationImpl = /** @class */ (function (_super) {
|
|
|
6858
6937
|
}(EventEmitter));
|
|
6859
6938
|
module.exports = NetworkQualityConfigurationImpl;
|
|
6860
6939
|
|
|
6861
|
-
},{"./util":
|
|
6940
|
+
},{"./util":127,"./util/constants":121,"events":178}],43:[function(require,module,exports){
|
|
6862
6941
|
'use strict';
|
|
6863
6942
|
var __extends = (this && this.__extends) || (function () {
|
|
6864
6943
|
var extendStatics = function (d, b) {
|
|
@@ -7475,7 +7554,7 @@ function reemitTrackPublicationEvents(participant, publication) {
|
|
|
7475
7554
|
}
|
|
7476
7555
|
module.exports = Participant;
|
|
7477
7556
|
|
|
7478
|
-
},{"./eventemitter":10,"./media/track/remoteaudiotrack":29,"./media/track/remoteaudiotrackpublication":30,"./media/track/remotedatatrack":31,"./media/track/remotedatatrackpublication":32,"./media/track/remotevideotrack":35,"./media/track/remotevideotrackpublication":36,"./util":
|
|
7557
|
+
},{"./eventemitter":10,"./media/track/remoteaudiotrack":29,"./media/track/remoteaudiotrackpublication":30,"./media/track/remotedatatrack":31,"./media/track/remotedatatrackpublication":32,"./media/track/remotevideotrack":35,"./media/track/remotevideotrackpublication":36,"./util":127}],44:[function(require,module,exports){
|
|
7479
7558
|
"use strict";
|
|
7480
7559
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7481
7560
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -7633,8 +7712,10 @@ function extractSelectedActiveCandidatePair(stats) {
|
|
|
7633
7712
|
"use strict";
|
|
7634
7713
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7635
7714
|
exports.getTurnCredentials = void 0;
|
|
7715
|
+
/* eslint-disable camelcase */
|
|
7636
7716
|
var TwilioConnection = require('../twilioconnection.js');
|
|
7637
7717
|
var ICE_VERSION = require('../util/constants').ICE_VERSION;
|
|
7718
|
+
var _a = require('../util/twilio-video-errors'), createTwilioError = _a.createTwilioError, SignalingConnectionError = _a.SignalingConnectionError;
|
|
7638
7719
|
var events_1 = require("events");
|
|
7639
7720
|
function getTurnCredentials(token, wsServer) {
|
|
7640
7721
|
return new Promise(function (resolve, reject) {
|
|
@@ -7652,27 +7733,30 @@ function getTurnCredentials(token, wsServer) {
|
|
|
7652
7733
|
};
|
|
7653
7734
|
var twilioConnection = new TwilioConnection(wsServer, connectionOptions);
|
|
7654
7735
|
var done = false;
|
|
7655
|
-
twilioConnection.once('close', function (
|
|
7736
|
+
twilioConnection.once('close', function () {
|
|
7656
7737
|
if (!done) {
|
|
7657
7738
|
done = true;
|
|
7658
|
-
reject(
|
|
7739
|
+
reject(new SignalingConnectionError());
|
|
7659
7740
|
}
|
|
7660
7741
|
});
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
if (
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
resolve(
|
|
7667
|
-
twilioConnection.close();
|
|
7742
|
+
twilioConnection.on('message', function (messageData) {
|
|
7743
|
+
var code = messageData.code, message = messageData.message, ice_servers = messageData.ice_servers, type = messageData.type;
|
|
7744
|
+
if ((type === 'iced' || type === 'error') && !done) {
|
|
7745
|
+
done = true;
|
|
7746
|
+
if (type === 'iced') {
|
|
7747
|
+
resolve(ice_servers);
|
|
7668
7748
|
}
|
|
7749
|
+
else {
|
|
7750
|
+
reject(createTwilioError(code, message));
|
|
7751
|
+
}
|
|
7752
|
+
twilioConnection.close();
|
|
7669
7753
|
}
|
|
7670
7754
|
});
|
|
7671
7755
|
});
|
|
7672
7756
|
}
|
|
7673
7757
|
exports.getTurnCredentials = getTurnCredentials;
|
|
7674
7758
|
|
|
7675
|
-
},{"../twilioconnection.js":
|
|
7759
|
+
},{"../twilioconnection.js":117,"../util/constants":121,"../util/twilio-video-errors":142,"events":178}],46:[function(require,module,exports){
|
|
7676
7760
|
"use strict";
|
|
7677
7761
|
var __read = (this && this.__read) || function (o, n) {
|
|
7678
7762
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -7791,6 +7875,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
7791
7875
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
7792
7876
|
};
|
|
7793
7877
|
})();
|
|
7878
|
+
var __assign = (this && this.__assign) || function () {
|
|
7879
|
+
__assign = Object.assign || function(t) {
|
|
7880
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7881
|
+
s = arguments[i];
|
|
7882
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7883
|
+
t[p] = s[p];
|
|
7884
|
+
}
|
|
7885
|
+
return t;
|
|
7886
|
+
};
|
|
7887
|
+
return __assign.apply(this, arguments);
|
|
7888
|
+
};
|
|
7794
7889
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7795
7890
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7796
7891
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -7845,6 +7940,7 @@ var MovingAverageDelta = require('../util/movingaveragedelta');
|
|
|
7845
7940
|
var EventObserver = require('../util/eventobserver');
|
|
7846
7941
|
var InsightsPublisher = require('../util/insightspublisher');
|
|
7847
7942
|
var _a = require('../util/sid'), createSID = _a.createSID, sessionSID = _a.sessionSID;
|
|
7943
|
+
var _b = require('../util/twilio-video-errors'), SignalingConnectionTimeoutError = _b.SignalingConnectionTimeoutError, MediaConnectionError = _b.MediaConnectionError;
|
|
7848
7944
|
var SECOND = 1000;
|
|
7849
7945
|
var DEFAULT_TEST_DURATION = 10 * SECOND;
|
|
7850
7946
|
/**
|
|
@@ -7861,25 +7957,25 @@ var PreflightProgress = {
|
|
|
7861
7957
|
*/
|
|
7862
7958
|
connected: 'connected',
|
|
7863
7959
|
/**
|
|
7864
|
-
*
|
|
7960
|
+
* SubscriberParticipant successfully subscribed to media tracks.
|
|
7865
7961
|
*/
|
|
7866
7962
|
mediaSubscribed: 'mediaSubscribed',
|
|
7867
7963
|
/**
|
|
7868
|
-
*
|
|
7964
|
+
* Media flow was detected.
|
|
7869
7965
|
*/
|
|
7870
7966
|
mediaStarted: 'mediaStarted',
|
|
7871
7967
|
/**
|
|
7872
|
-
*
|
|
7968
|
+
* Established DTLS connection. This is measured from RTCDtlsTransport `connecting` to `connected` state.
|
|
7873
7969
|
* On Safari, Support for measuring this is missing, this event will be not be emitted on Safari.
|
|
7874
7970
|
*/
|
|
7875
7971
|
dtlsConnected: 'dtlsConnected',
|
|
7876
7972
|
/**
|
|
7877
|
-
*
|
|
7973
|
+
* Established a PeerConnection, This is measured from PeerConnection `connecting` to `connected` state.
|
|
7878
7974
|
* On Firefox, Support for measuring this is missing, this event will be not be emitted on Firefox.
|
|
7879
7975
|
*/
|
|
7880
7976
|
peerConnectionConnected: 'peerConnectionConnected',
|
|
7881
7977
|
/**
|
|
7882
|
-
*
|
|
7978
|
+
* Established ICE connection. This is measured from ICE connection `checking` to `connected` state.
|
|
7883
7979
|
*/
|
|
7884
7980
|
iceConnected: 'iceConnected'
|
|
7885
7981
|
};
|
|
@@ -7913,6 +8009,7 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
7913
8009
|
_this._connectTiming = new timer_1.Timer();
|
|
7914
8010
|
_this._sentBytesMovingAverage = new MovingAverageDelta();
|
|
7915
8011
|
_this._packetLossMovingAverage = new MovingAverageDelta();
|
|
8012
|
+
_this._progressEvents = [];
|
|
7916
8013
|
_this._receivedBytesMovingAverage = new MovingAverageDelta();
|
|
7917
8014
|
var internalOptions = options;
|
|
7918
8015
|
var _a = internalOptions.environment, environment = _a === void 0 ? 'prod' : _a, _b = internalOptions.region, region = _b === void 0 ? 'gll' : _b, _c = internalOptions.duration, duration = _c === void 0 ? DEFAULT_TEST_DURATION : _c;
|
|
@@ -7934,7 +8031,7 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
7934
8031
|
PreflightTest.prototype.stop = function () {
|
|
7935
8032
|
this._stopped = true;
|
|
7936
8033
|
};
|
|
7937
|
-
PreflightTest.prototype._generatePreflightReport = function (collectedStats
|
|
8034
|
+
PreflightTest.prototype._generatePreflightReport = function (collectedStats) {
|
|
7938
8035
|
this._testTiming.stop();
|
|
7939
8036
|
return {
|
|
7940
8037
|
testTiming: this._testTiming.getTimeMeasurement(),
|
|
@@ -7952,12 +8049,12 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
7952
8049
|
},
|
|
7953
8050
|
selectedIceCandidatePairStats: collectedStats ? collectedStats.selectedIceCandidatePairStats : null,
|
|
7954
8051
|
iceCandidateStats: collectedStats ? collectedStats.iceCandidateStats : [],
|
|
8052
|
+
progressEvents: this._progressEvents,
|
|
7955
8053
|
// NOTE(mpatwardhan): internal properties.
|
|
7956
|
-
error: error === null || error === void 0 ? void 0 : error.toString(),
|
|
7957
8054
|
mos: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.mos),
|
|
7958
8055
|
};
|
|
7959
8056
|
};
|
|
7960
|
-
PreflightTest.prototype._executePreflightStep = function (stepName, step) {
|
|
8057
|
+
PreflightTest.prototype._executePreflightStep = function (stepName, step, timeoutError) {
|
|
7961
8058
|
return __awaiter(this, void 0, void 0, function () {
|
|
7962
8059
|
var MAX_STEP_DURATION, stepPromise, timer, timeoutPromise, result;
|
|
7963
8060
|
return __generator(this, function (_a) {
|
|
@@ -7972,7 +8069,7 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
7972
8069
|
timer = null;
|
|
7973
8070
|
timeoutPromise = new Promise(function (_resolve, reject) {
|
|
7974
8071
|
timer = setTimeout(function () {
|
|
7975
|
-
reject(new Error(
|
|
8072
|
+
reject(timeoutError || new Error(stepName + " timeout."));
|
|
7976
8073
|
}, MAX_STEP_DURATION);
|
|
7977
8074
|
});
|
|
7978
8075
|
_a.label = 1;
|
|
@@ -7992,42 +8089,51 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
7992
8089
|
});
|
|
7993
8090
|
});
|
|
7994
8091
|
};
|
|
7995
|
-
PreflightTest.prototype.
|
|
8092
|
+
PreflightTest.prototype._collectNetworkTimings = function (pc) {
|
|
7996
8093
|
var _this = this;
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
_this._iceTiming.stop();
|
|
8003
|
-
_this.emit('progress', PreflightProgress.iceConnected);
|
|
8004
|
-
}
|
|
8005
|
-
});
|
|
8006
|
-
// firefox does not support connectionstatechange.
|
|
8007
|
-
pc.addEventListener('connectionstatechange', function () {
|
|
8008
|
-
if (pc.connectionState === 'connecting') {
|
|
8009
|
-
_this._peerConnectionTiming.start();
|
|
8010
|
-
}
|
|
8011
|
-
if (pc.connectionState === 'connected') {
|
|
8012
|
-
_this._peerConnectionTiming.stop();
|
|
8013
|
-
_this.emit('progress', PreflightProgress.peerConnectionConnected);
|
|
8014
|
-
}
|
|
8015
|
-
});
|
|
8016
|
-
// Safari does not expose sender.transport.
|
|
8017
|
-
var senders = pc.getSenders();
|
|
8018
|
-
var transport = senders.map(function (sender) { return sender.transport; }).find(notEmpty);
|
|
8019
|
-
if (typeof transport !== 'undefined') {
|
|
8020
|
-
var dtlsTransport_1 = transport;
|
|
8021
|
-
dtlsTransport_1.addEventListener('statechange', function () {
|
|
8022
|
-
if (dtlsTransport_1.state === 'connecting') {
|
|
8023
|
-
_this._dtlsTiming.start();
|
|
8094
|
+
return new Promise(function (resolve) {
|
|
8095
|
+
var dtlsTransport;
|
|
8096
|
+
pc.addEventListener('iceconnectionstatechange', function () {
|
|
8097
|
+
if (pc.iceConnectionState === 'checking') {
|
|
8098
|
+
_this._iceTiming.start();
|
|
8024
8099
|
}
|
|
8025
|
-
if (
|
|
8026
|
-
_this.
|
|
8027
|
-
_this.
|
|
8100
|
+
if (pc.iceConnectionState === 'connected') {
|
|
8101
|
+
_this._iceTiming.stop();
|
|
8102
|
+
_this._updateProgress(PreflightProgress.iceConnected);
|
|
8103
|
+
if (!dtlsTransport || dtlsTransport && dtlsTransport.state === 'connected') {
|
|
8104
|
+
resolve();
|
|
8105
|
+
}
|
|
8028
8106
|
}
|
|
8029
8107
|
});
|
|
8030
|
-
|
|
8108
|
+
// firefox does not support connectionstatechange.
|
|
8109
|
+
pc.addEventListener('connectionstatechange', function () {
|
|
8110
|
+
if (pc.connectionState === 'connecting') {
|
|
8111
|
+
_this._peerConnectionTiming.start();
|
|
8112
|
+
}
|
|
8113
|
+
if (pc.connectionState === 'connected') {
|
|
8114
|
+
_this._peerConnectionTiming.stop();
|
|
8115
|
+
_this._updateProgress(PreflightProgress.peerConnectionConnected);
|
|
8116
|
+
}
|
|
8117
|
+
});
|
|
8118
|
+
// Safari does not expose sender.transport.
|
|
8119
|
+
var senders = pc.getSenders();
|
|
8120
|
+
var transport = senders.map(function (sender) { return sender.transport; }).find(notEmpty);
|
|
8121
|
+
if (typeof transport !== 'undefined') {
|
|
8122
|
+
dtlsTransport = transport;
|
|
8123
|
+
dtlsTransport.addEventListener('statechange', function () {
|
|
8124
|
+
if (dtlsTransport.state === 'connecting') {
|
|
8125
|
+
_this._dtlsTiming.start();
|
|
8126
|
+
}
|
|
8127
|
+
if (dtlsTransport.state === 'connected') {
|
|
8128
|
+
_this._dtlsTiming.stop();
|
|
8129
|
+
_this._updateProgress(PreflightProgress.dtlsConnected);
|
|
8130
|
+
if (pc.iceConnectionState === 'connected') {
|
|
8131
|
+
resolve();
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
});
|
|
8135
|
+
}
|
|
8136
|
+
});
|
|
8031
8137
|
};
|
|
8032
8138
|
PreflightTest.prototype._setupInsights = function (_a) {
|
|
8033
8139
|
var token = _a.token, _b = _a.environment, environment = _b === void 0 ? constants_1.DEFAULT_ENVIRONMENT : _b, _c = _a.realm, realm = _c === void 0 ? constants_1.DEFAULT_REALM : _c;
|
|
@@ -8065,6 +8171,7 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8065
8171
|
payload: {
|
|
8066
8172
|
sessionSID: sessionSID,
|
|
8067
8173
|
preflightSID: createSID('PF'),
|
|
8174
|
+
progressEvents: JSON.stringify(report.progressEvents),
|
|
8068
8175
|
testTiming: report.testTiming,
|
|
8069
8176
|
dtlsTiming: report.networkTiming.dtls,
|
|
8070
8177
|
iceTiming: report.networkTiming.ice,
|
|
@@ -8088,7 +8195,7 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8088
8195
|
};
|
|
8089
8196
|
PreflightTest.prototype._runPreflightTest = function (token, environment, wsServer) {
|
|
8090
8197
|
return __awaiter(this, void 0, void 0, function () {
|
|
8091
|
-
var localTracks, pcs, reportToInsights, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1;
|
|
8198
|
+
var localTracks, pcs, reportToInsights, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1, preflightReport;
|
|
8092
8199
|
var _this = this;
|
|
8093
8200
|
return __generator(this, function (_a) {
|
|
8094
8201
|
switch (_a.label) {
|
|
@@ -8103,21 +8210,21 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8103
8210
|
return [4 /*yield*/, this._executePreflightStep('Acquire media', function () { return [syntheticaudio_1.syntheticAudio(), syntheticvideo_1.syntheticVideo({ width: 640, height: 480 })]; })];
|
|
8104
8211
|
case 2:
|
|
8105
8212
|
localTracks = _a.sent();
|
|
8106
|
-
this.
|
|
8213
|
+
this._updateProgress(PreflightProgress.mediaAcquired);
|
|
8107
8214
|
this.emit('debug', { localTracks: localTracks });
|
|
8108
8215
|
this._connectTiming.start();
|
|
8109
|
-
return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, wsServer); })];
|
|
8216
|
+
return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, wsServer); }, new SignalingConnectionTimeoutError())];
|
|
8110
8217
|
case 3:
|
|
8111
8218
|
iceServers = _a.sent();
|
|
8112
8219
|
this._connectTiming.stop();
|
|
8113
|
-
this.
|
|
8220
|
+
this._updateProgress(PreflightProgress.connected);
|
|
8114
8221
|
senderPC_1 = new RTCPeerConnection({ iceServers: iceServers, iceTransportPolicy: 'relay', bundlePolicy: 'max-bundle' });
|
|
8115
8222
|
receiverPC_1 = new RTCPeerConnection({ iceServers: iceServers, bundlePolicy: 'max-bundle' });
|
|
8116
8223
|
pcs.push(senderPC_1);
|
|
8117
8224
|
pcs.push(receiverPC_1);
|
|
8118
8225
|
this._mediaTiming.start();
|
|
8119
8226
|
return [4 /*yield*/, this._executePreflightStep('Setup Peer Connections', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8120
|
-
var remoteTracksPromise, offer, updatedOffer, answer
|
|
8227
|
+
var remoteTracksPromise, offer, updatedOffer, answer;
|
|
8121
8228
|
return __generator(this, function (_a) {
|
|
8122
8229
|
switch (_a.label) {
|
|
8123
8230
|
case 0:
|
|
@@ -8146,18 +8253,19 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8146
8253
|
return [4 /*yield*/, receiverPC_1.createAnswer()];
|
|
8147
8254
|
case 4:
|
|
8148
8255
|
answer = _a.sent();
|
|
8149
|
-
|
|
8150
|
-
return [4 /*yield*/, receiverPC_1.setLocalDescription(updatedAnswer)];
|
|
8256
|
+
return [4 /*yield*/, receiverPC_1.setLocalDescription(answer)];
|
|
8151
8257
|
case 5:
|
|
8152
8258
|
_a.sent();
|
|
8153
|
-
return [4 /*yield*/, senderPC_1.setRemoteDescription(
|
|
8259
|
+
return [4 /*yield*/, senderPC_1.setRemoteDescription(answer)];
|
|
8154
8260
|
case 6:
|
|
8155
8261
|
_a.sent();
|
|
8156
|
-
this.
|
|
8262
|
+
return [4 /*yield*/, this._collectNetworkTimings(senderPC_1)];
|
|
8263
|
+
case 7:
|
|
8264
|
+
_a.sent();
|
|
8157
8265
|
return [2 /*return*/, remoteTracksPromise];
|
|
8158
8266
|
}
|
|
8159
8267
|
});
|
|
8160
|
-
}); })];
|
|
8268
|
+
}); }, new MediaConnectionError())];
|
|
8161
8269
|
case 4:
|
|
8162
8270
|
remoteTracks_1 = _a.sent();
|
|
8163
8271
|
this.emit('debug', { remoteTracks: remoteTracks_1 });
|
|
@@ -8166,8 +8274,8 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8166
8274
|
track.addEventListener('mute', function () { return _this._log.warn(track.kind + ':muted'); });
|
|
8167
8275
|
track.addEventListener('unmute', function () { return _this._log.warn(track.kind + ':unmuted'); });
|
|
8168
8276
|
});
|
|
8169
|
-
this.
|
|
8170
|
-
return [4 /*yield*/, this._executePreflightStep('
|
|
8277
|
+
this._updateProgress(PreflightProgress.mediaSubscribed);
|
|
8278
|
+
return [4 /*yield*/, this._executePreflightStep('Wait for tracks to start', function () {
|
|
8171
8279
|
return new Promise(function (resolve) {
|
|
8172
8280
|
var element = document.createElement('video');
|
|
8173
8281
|
element.autoplay = true;
|
|
@@ -8178,15 +8286,15 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8178
8286
|
_this.emit('debugElement', element);
|
|
8179
8287
|
element.oncanplay = resolve;
|
|
8180
8288
|
});
|
|
8181
|
-
})];
|
|
8289
|
+
}, new MediaConnectionError())];
|
|
8182
8290
|
case 5:
|
|
8183
8291
|
_a.sent();
|
|
8184
8292
|
this._mediaTiming.stop();
|
|
8185
|
-
this.
|
|
8186
|
-
return [4 /*yield*/, this._executePreflightStep('
|
|
8293
|
+
this._updateProgress(PreflightProgress.mediaStarted);
|
|
8294
|
+
return [4 /*yield*/, this._executePreflightStep('Collect stats for duration', function () { return _this._collectRTCStatsForDuration(_this._testDuration, initCollectedStats(), senderPC_1, receiverPC_1); })];
|
|
8187
8295
|
case 6:
|
|
8188
8296
|
collectedStats_1 = _a.sent();
|
|
8189
|
-
return [4 /*yield*/, this._executePreflightStep('
|
|
8297
|
+
return [4 /*yield*/, this._executePreflightStep('Generate report', function () { return _this._generatePreflightReport(collectedStats_1); })];
|
|
8190
8298
|
case 7:
|
|
8191
8299
|
report = _a.sent();
|
|
8192
8300
|
reportToInsights({ report: report });
|
|
@@ -8194,9 +8302,9 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8194
8302
|
return [3 /*break*/, 10];
|
|
8195
8303
|
case 8:
|
|
8196
8304
|
error_1 = _a.sent();
|
|
8197
|
-
|
|
8198
|
-
reportToInsights({ report:
|
|
8199
|
-
this.emit('failed', error_1);
|
|
8305
|
+
preflightReport = this._generatePreflightReport();
|
|
8306
|
+
reportToInsights({ report: __assign(__assign({}, preflightReport), { error: error_1 === null || error_1 === void 0 ? void 0 : error_1.toString() }) });
|
|
8307
|
+
this.emit('failed', error_1, preflightReport);
|
|
8200
8308
|
return [3 /*break*/, 10];
|
|
8201
8309
|
case 9:
|
|
8202
8310
|
pcs.forEach(function (pc) { return pc.close(); });
|
|
@@ -8268,6 +8376,11 @@ var PreflightTest = /** @class */ (function (_super) {
|
|
|
8268
8376
|
});
|
|
8269
8377
|
});
|
|
8270
8378
|
};
|
|
8379
|
+
PreflightTest.prototype._updateProgress = function (name) {
|
|
8380
|
+
var duration = Date.now() - this._testTiming.getTimeMeasurement().start;
|
|
8381
|
+
this._progressEvents.push({ duration: duration, name: name });
|
|
8382
|
+
this.emit('progress', name);
|
|
8383
|
+
};
|
|
8271
8384
|
return PreflightTest;
|
|
8272
8385
|
}(EventEmitter));
|
|
8273
8386
|
exports.PreflightTest = PreflightTest;
|
|
@@ -8295,15 +8408,15 @@ function initCollectedStats() {
|
|
|
8295
8408
|
/**
|
|
8296
8409
|
* Represents stats for a numerical metric.
|
|
8297
8410
|
* @typedef {object} Stats
|
|
8298
|
-
* @property {number} [average] -
|
|
8299
|
-
* @property {number} [max] -
|
|
8300
|
-
* @property {number} [min] -
|
|
8411
|
+
* @property {number} [average] - Average value observed.
|
|
8412
|
+
* @property {number} [max] - Max value observed.
|
|
8413
|
+
* @property {number} [min] - Min value observed.
|
|
8301
8414
|
*/
|
|
8302
8415
|
/**
|
|
8303
8416
|
* Represents stats for a numerical metric.
|
|
8304
8417
|
* @typedef {object} SelectedIceCandidatePairStats
|
|
8305
|
-
* @property {RTCIceCandidateStats} [localCandidate] -
|
|
8306
|
-
* @property {RTCIceCandidateStats} [remoteCandidate] -
|
|
8418
|
+
* @property {RTCIceCandidateStats} [localCandidate] - Selected local ice candidate
|
|
8419
|
+
* @property {RTCIceCandidateStats} [remoteCandidate] - Selected local ice candidate
|
|
8307
8420
|
*/
|
|
8308
8421
|
/**
|
|
8309
8422
|
* Represents RTC related stats that were observed during preflight test
|
|
@@ -8312,6 +8425,12 @@ function initCollectedStats() {
|
|
|
8312
8425
|
* @property {Stats} [rtt] - Round trip time, to the server back to the client in milliseconds.
|
|
8313
8426
|
* @property {Stats} [packetLoss] - Packet loss as a percent of total packets sent.
|
|
8314
8427
|
*/
|
|
8428
|
+
/**
|
|
8429
|
+
* A {@link PreflightProgress} event with timing information.
|
|
8430
|
+
* @typedef {object} ProgressEvent
|
|
8431
|
+
* @property {number} [duration] - The duration of the event, measured from the start of the test.
|
|
8432
|
+
* @property {string} [name] - The {@link PreflightProgress} event name.
|
|
8433
|
+
*/
|
|
8315
8434
|
/**
|
|
8316
8435
|
* Represents report generated by {@link PreflightTest}.
|
|
8317
8436
|
* @typedef {object} PreflightTestReport
|
|
@@ -8319,7 +8438,9 @@ function initCollectedStats() {
|
|
|
8319
8438
|
* @property {NetworkTiming} [networkTiming] - Network related time measurements.
|
|
8320
8439
|
* @property {PreflightReportStats} [stats] - RTC related stats captured during the test.
|
|
8321
8440
|
* @property {Array<RTCIceCandidateStats>} [iceCandidateStats] - List of gathered ice candidates.
|
|
8322
|
-
* @property {SelectedIceCandidatePairStats} selectedIceCandidatePairStats -
|
|
8441
|
+
* @property {SelectedIceCandidatePairStats} selectedIceCandidatePairStats - Stats for the ice candidates that were used for the connection.
|
|
8442
|
+
* @property {Array<ProgressEvent>} [progressEvents] - {@link ProgressEvent} events detected during the test.
|
|
8443
|
+
* Use this information to determine which steps were completed and which ones were not.
|
|
8323
8444
|
*/
|
|
8324
8445
|
/**
|
|
8325
8446
|
* You may pass these options to {@link module:twilio-video.testPreflight} in order to override the
|
|
@@ -8335,17 +8456,20 @@ function initCollectedStats() {
|
|
|
8335
8456
|
*/
|
|
8336
8457
|
/**
|
|
8337
8458
|
* Preflight test has completed successfully.
|
|
8338
|
-
* @param {PreflightTestReport} report -
|
|
8459
|
+
* @param {PreflightTestReport} report - Results of the test.
|
|
8339
8460
|
* @event PreflightTest#completed
|
|
8340
8461
|
*/
|
|
8341
8462
|
/**
|
|
8342
|
-
* Preflight test has encountered a
|
|
8343
|
-
* @param {TwilioError|Error} error -
|
|
8463
|
+
* Preflight test has encountered a failure and is now stopped.
|
|
8464
|
+
* @param {TwilioError|Error} error - A TwilioError or a DOMException.
|
|
8465
|
+
* Possible TwilioErrors include Signaling and Media related errors which can be found
|
|
8466
|
+
* <a href="https://www.twilio.com/docs/video/build-js-video-application-recommendations-and-best-practices#connection-errors" target="_blank">here</a>.
|
|
8467
|
+
* @param {PreflightTestReport} report - Partial results gathered during the test. Use this information to help determine the cause of failure.
|
|
8344
8468
|
* @event PreflightTest#failed
|
|
8345
8469
|
*/
|
|
8346
8470
|
/**
|
|
8347
8471
|
* Emitted to indicate progress of the test
|
|
8348
|
-
* @param {PreflightProgress} progress -
|
|
8472
|
+
* @param {PreflightProgress} progress - Indicates the status completed.
|
|
8349
8473
|
* @event PreflightTest#progress
|
|
8350
8474
|
*/
|
|
8351
8475
|
/**
|
|
@@ -8354,17 +8478,17 @@ function initCollectedStats() {
|
|
|
8354
8478
|
* @description Run a preflight test. This method will start a test to check the quality of network connection.
|
|
8355
8479
|
* @memberof module:twilio-video
|
|
8356
8480
|
* @param {string} token - The Access Token string
|
|
8357
|
-
* @param {PreflightOptions} options -
|
|
8358
|
-
* @returns {PreflightTest} preflightTest -
|
|
8481
|
+
* @param {PreflightOptions} options - Options for the test
|
|
8482
|
+
* @returns {PreflightTest} preflightTest - An instance to be used to monitor progress of the test.
|
|
8359
8483
|
* @example
|
|
8360
8484
|
* var { runPreflight } = require('twilio-video');
|
|
8361
|
-
* var preflight = runPreflight();
|
|
8485
|
+
* var preflight = runPreflight(token, preflightOptions);
|
|
8362
8486
|
* preflightTest.on('progress', progress => {
|
|
8363
8487
|
* console.log('preflight progress:', progress);
|
|
8364
8488
|
* });
|
|
8365
8489
|
*
|
|
8366
|
-
* preflightTest.on('failed', error => {
|
|
8367
|
-
* console.error('preflight error:', error);
|
|
8490
|
+
* preflightTest.on('failed', (error, report) => {
|
|
8491
|
+
* console.error('preflight error:', error, report);
|
|
8368
8492
|
* });
|
|
8369
8493
|
*
|
|
8370
8494
|
* preflightTest.on('completed', report => {
|
|
@@ -8378,7 +8502,7 @@ function runPreflight(token, options) {
|
|
|
8378
8502
|
}
|
|
8379
8503
|
exports.runPreflight = runPreflight;
|
|
8380
8504
|
|
|
8381
|
-
},{"../eventemitter":10,"../util":
|
|
8505
|
+
},{"../eventemitter":10,"../util":127,"../util/constants":121,"../util/eventobserver":125,"../util/insightspublisher":128,"../util/log":131,"../util/movingaveragedelta":132,"../util/sid":139,"../util/twilio-video-errors":142,"./getCombinedConnectionStats":44,"./getturncredentials":45,"./makestat":46,"./mos":47,"./syntheticaudio":49,"./syntheticvideo":50,"./timer":51}],49:[function(require,module,exports){
|
|
8382
8506
|
"use strict";
|
|
8383
8507
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8384
8508
|
exports.syntheticAudio = void 0;
|
|
@@ -8401,7 +8525,7 @@ function syntheticAudio() {
|
|
|
8401
8525
|
}
|
|
8402
8526
|
exports.syntheticAudio = syntheticAudio;
|
|
8403
8527
|
|
|
8404
|
-
},{"../webaudio/audiocontext":
|
|
8528
|
+
},{"../webaudio/audiocontext":146}],50:[function(require,module,exports){
|
|
8405
8529
|
"use strict";
|
|
8406
8530
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8407
8531
|
exports.syntheticVideo = void 0;
|
|
@@ -8566,7 +8690,7 @@ var QueueingEventEmitter = /** @class */ (function (_super) {
|
|
|
8566
8690
|
}(EventEmitter));
|
|
8567
8691
|
module.exports = QueueingEventEmitter;
|
|
8568
8692
|
|
|
8569
|
-
},{"events":
|
|
8693
|
+
},{"events":178}],53:[function(require,module,exports){
|
|
8570
8694
|
'use strict';
|
|
8571
8695
|
var __extends = (this && this.__extends) || (function () {
|
|
8572
8696
|
var extendStatics = function (d, b) {
|
|
@@ -9403,7 +9527,7 @@ function handleSignalingEvents(room, signaling) {
|
|
|
9403
9527
|
}
|
|
9404
9528
|
module.exports = Room;
|
|
9405
9529
|
|
|
9406
|
-
},{"./eventemitter":10,"./remoteparticipant":53,"./stats/statsreport":
|
|
9530
|
+
},{"./eventemitter":10,"./remoteparticipant":53,"./stats/statsreport":113,"./util":127}],55:[function(require,module,exports){
|
|
9407
9531
|
/* eslint consistent-return:0 */
|
|
9408
9532
|
'use strict';
|
|
9409
9533
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -9573,7 +9697,7 @@ var Signaling = /** @class */ (function (_super) {
|
|
|
9573
9697
|
}(StateMachine));
|
|
9574
9698
|
module.exports = Signaling;
|
|
9575
9699
|
|
|
9576
|
-
},{"../statemachine":
|
|
9700
|
+
},{"../statemachine":85,"./participant":58,"./room":62}],56:[function(require,module,exports){
|
|
9577
9701
|
'use strict';
|
|
9578
9702
|
var __extends = (this && this.__extends) || (function () {
|
|
9579
9703
|
var extendStatics = function (d, b) {
|
|
@@ -10009,7 +10133,7 @@ var ParticipantSignaling = /** @class */ (function (_super) {
|
|
|
10009
10133
|
*/
|
|
10010
10134
|
module.exports = ParticipantSignaling;
|
|
10011
10135
|
|
|
10012
|
-
},{"../statemachine":
|
|
10136
|
+
},{"../statemachine":85,"../stats/networkqualitystats":100}],59:[function(require,module,exports){
|
|
10013
10137
|
'use strict';
|
|
10014
10138
|
var __extends = (this && this.__extends) || (function () {
|
|
10015
10139
|
var extendStatics = function (d, b) {
|
|
@@ -10082,7 +10206,7 @@ var RecordingSignaling = /** @class */ (function (_super) {
|
|
|
10082
10206
|
*/
|
|
10083
10207
|
module.exports = RecordingSignaling;
|
|
10084
10208
|
|
|
10085
|
-
},{"events":
|
|
10209
|
+
},{"events":178}],60:[function(require,module,exports){
|
|
10086
10210
|
'use strict';
|
|
10087
10211
|
var __extends = (this && this.__extends) || (function () {
|
|
10088
10212
|
var extendStatics = function (d, b) {
|
|
@@ -10508,7 +10632,7 @@ function maybeUpdateState(roomSignaling) {
|
|
|
10508
10632
|
}
|
|
10509
10633
|
module.exports = RoomSignaling;
|
|
10510
10634
|
|
|
10511
|
-
},{"../statemachine":
|
|
10635
|
+
},{"../statemachine":85,"../util":127,"../util/constants":121,"../util/log":131,"../util/timeout":141,"../util/twilio-video-errors":142,"./recording":59}],63:[function(require,module,exports){
|
|
10512
10636
|
'use strict';
|
|
10513
10637
|
var __extends = (this && this.__extends) || (function () {
|
|
10514
10638
|
var extendStatics = function (d, b) {
|
|
@@ -10691,7 +10815,7 @@ var TrackSignaling = /** @class */ (function (_super) {
|
|
|
10691
10815
|
*/
|
|
10692
10816
|
module.exports = TrackSignaling;
|
|
10693
10817
|
|
|
10694
|
-
},{"events":
|
|
10818
|
+
},{"events":178}],64:[function(require,module,exports){
|
|
10695
10819
|
'use strict';
|
|
10696
10820
|
var CancelablePromise = require('../../util/cancelablepromise');
|
|
10697
10821
|
var DefaultPeerConnectionManager = require('./peerconnectionmanager');
|
|
@@ -10705,6 +10829,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
|
|
|
10705
10829
|
RoomV2: DefaultRoomV2,
|
|
10706
10830
|
Transport: DefaultTransport
|
|
10707
10831
|
}, options);
|
|
10832
|
+
var adaptiveSimulcast = preferredCodecs.video[0] && preferredCodecs.video[0].adaptiveSimulcast === true;
|
|
10708
10833
|
var PeerConnectionManager = options.PeerConnectionManager, RoomV2 = options.RoomV2, Transport = options.Transport, iceServers = options.iceServers, log = options.log;
|
|
10709
10834
|
var peerConnectionManager = new PeerConnectionManager(encodingParameters, preferredCodecs, options);
|
|
10710
10835
|
var trackSenders = flatMap(localParticipant.tracks, function (trackV2) { return [trackV2.trackTransceiver]; });
|
|
@@ -10745,6 +10870,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
|
|
|
10745
10870
|
var renderHints = !!bandwidthProfile &&
|
|
10746
10871
|
(options.clientTrackSwitchOffControl !== 'disabled' || options.contentPreferencesMode !== 'disabled');
|
|
10747
10872
|
var transportOptions = Object.assign({
|
|
10873
|
+
adaptiveSimulcast: adaptiveSimulcast,
|
|
10748
10874
|
automaticSubscription: automaticSubscription,
|
|
10749
10875
|
dominantSpeaker: dominantSpeaker,
|
|
10750
10876
|
environment: environment,
|
|
@@ -10807,7 +10933,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
|
|
|
10807
10933
|
}
|
|
10808
10934
|
module.exports = createCancelableRoomSignalingPromise;
|
|
10809
10935
|
|
|
10810
|
-
},{"../../util":
|
|
10936
|
+
},{"../../util":127,"../../util/cancelablepromise":120,"../../util/twilio-video-errors":142,"./peerconnectionmanager":75,"./room":81,"./twilioconnectiontransport":84}],65:[function(require,module,exports){
|
|
10811
10937
|
'use strict';
|
|
10812
10938
|
var __extends = (this && this.__extends) || (function () {
|
|
10813
10939
|
var extendStatics = function (d, b) {
|
|
@@ -10953,7 +11079,7 @@ var IceBox = /** @class */ (function () {
|
|
|
10953
11079
|
}());
|
|
10954
11080
|
module.exports = IceBox;
|
|
10955
11081
|
|
|
10956
|
-
},{"../../util/filter":
|
|
11082
|
+
},{"../../util/filter":126}],67:[function(require,module,exports){
|
|
10957
11083
|
'use strict';
|
|
10958
11084
|
var _a = require('../../util/constants'), ICE_ACTIVITY_CHECK_PERIOD_MS = _a.ICE_ACTIVITY_CHECK_PERIOD_MS, ICE_INACTIVITY_THRESHOLD_MS = _a.ICE_INACTIVITY_THRESHOLD_MS;
|
|
10959
11085
|
/**
|
|
@@ -10997,13 +11123,6 @@ var IceConnectionMonitor = /** @class */ (function () {
|
|
|
10997
11123
|
}
|
|
10998
11124
|
IceConnectionMonitor.prototype._getActivePairStat = function (stats) {
|
|
10999
11125
|
var statsArray = Array.from(stats.values());
|
|
11000
|
-
var hasInBoundTracks = statsArray.find(function (stat) { return stat.type === 'inbound-rtp'; });
|
|
11001
|
-
if (!hasInBoundTracks) {
|
|
11002
|
-
// NOTE(mpatwardhan): when there are no tracks shared on a peerConnection
|
|
11003
|
-
// we may see inactivity on bytesReceived - but that is not real inactivity,
|
|
11004
|
-
// ignore it.
|
|
11005
|
-
return null;
|
|
11006
|
-
}
|
|
11007
11126
|
var activePairStats = statsArray.find(function (stat) { return stat.type === 'candidate-pair' && stat.nominated; });
|
|
11008
11127
|
// NOTE(mpatwardhan): sometimes (JSDK-2667) after getting disconnected while switching network
|
|
11009
11128
|
// we may not find active pair. Treat this as 0 bytesReceived so that we count it towards inactivity.
|
|
@@ -11057,6 +11176,9 @@ var IceConnectionMonitor = /** @class */ (function () {
|
|
|
11057
11176
|
if (!iceStats) {
|
|
11058
11177
|
return;
|
|
11059
11178
|
}
|
|
11179
|
+
// NOTE(mpatwardhan): We look at bytesReceived on active candidate pair as an indication of active ice connection.
|
|
11180
|
+
// As per spec (https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-bytesreceived) this value
|
|
11181
|
+
// includes RTCP traffic and is +ve even when there are no tracks subscribed to.
|
|
11060
11182
|
if (!_this._lastActivity || _this._lastActivity.bytesReceived !== iceStats.bytesReceived) {
|
|
11061
11183
|
_this._lastActivity = iceStats;
|
|
11062
11184
|
// detected activity, cancel scheduled callback if any.
|
|
@@ -11090,7 +11212,7 @@ var IceConnectionMonitor = /** @class */ (function () {
|
|
|
11090
11212
|
}());
|
|
11091
11213
|
module.exports = IceConnectionMonitor;
|
|
11092
11214
|
|
|
11093
|
-
},{"../../util/constants":
|
|
11215
|
+
},{"../../util/constants":121}],68:[function(require,module,exports){
|
|
11094
11216
|
'use strict';
|
|
11095
11217
|
var __extends = (this && this.__extends) || (function () {
|
|
11096
11218
|
var extendStatics = function (d, b) {
|
|
@@ -11174,7 +11296,9 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
11174
11296
|
})();
|
|
11175
11297
|
var LocalParticipantSignaling = require('../localparticipant');
|
|
11176
11298
|
var LocalTrackPublicationV2 = require('./localtrackpublication');
|
|
11177
|
-
var
|
|
11299
|
+
var DEFAULT_LOG_LEVEL = require('../../util/constants').DEFAULT_LOG_LEVEL;
|
|
11300
|
+
var Log = require('../../util/log');
|
|
11301
|
+
var _a = require('../../util'), buildLogLevels = _a.buildLogLevels, isDeepEqual = _a.isDeepEqual;
|
|
11178
11302
|
/**
|
|
11179
11303
|
* @extends ParticipantSignaling
|
|
11180
11304
|
* @property {BandwidthProfileOptions} bandwidthProfile
|
|
@@ -11193,9 +11317,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11193
11317
|
function LocalParticipantV2(encodingParameters, networkQualityConfiguration, options) {
|
|
11194
11318
|
var _this = this;
|
|
11195
11319
|
options = Object.assign({
|
|
11320
|
+
logLevel: DEFAULT_LOG_LEVEL,
|
|
11196
11321
|
LocalTrackPublicationV2: LocalTrackPublicationV2
|
|
11197
11322
|
}, options);
|
|
11198
11323
|
_this = _super.call(this) || this;
|
|
11324
|
+
var logLevels = buildLogLevels(options.logLevel);
|
|
11199
11325
|
Object.defineProperties(_this, {
|
|
11200
11326
|
_bandwidthProfile: {
|
|
11201
11327
|
value: null,
|
|
@@ -11214,6 +11340,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11214
11340
|
_LocalTrackPublicationV2: {
|
|
11215
11341
|
value: options.LocalTrackPublicationV2
|
|
11216
11342
|
},
|
|
11343
|
+
_log: {
|
|
11344
|
+
value: options.log
|
|
11345
|
+
? options.log.createLog('default', _this)
|
|
11346
|
+
: new Log('default', _this, logLevels, options.loggerName)
|
|
11347
|
+
},
|
|
11217
11348
|
_publishedRevision: {
|
|
11218
11349
|
writable: true,
|
|
11219
11350
|
value: 0
|
|
@@ -11257,6 +11388,9 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11257
11388
|
});
|
|
11258
11389
|
return _this;
|
|
11259
11390
|
}
|
|
11391
|
+
LocalParticipantV2.prototype.toString = function () {
|
|
11392
|
+
return "[LocalParticipantSignaling: " + this.sid + "]";
|
|
11393
|
+
};
|
|
11260
11394
|
/**
|
|
11261
11395
|
* Set the signalingRegion.
|
|
11262
11396
|
* @param {string} signalingRegion.
|
|
@@ -11280,6 +11414,13 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11280
11414
|
this.didUpdate();
|
|
11281
11415
|
}
|
|
11282
11416
|
};
|
|
11417
|
+
/**
|
|
11418
|
+
* returns current {@link EncodingParametersImpl}.
|
|
11419
|
+
* @returns {EncodingParametersImpl}
|
|
11420
|
+
*/
|
|
11421
|
+
LocalParticipantV2.prototype.getParameters = function () {
|
|
11422
|
+
return this._encodingParameters;
|
|
11423
|
+
};
|
|
11283
11424
|
/**
|
|
11284
11425
|
* Set the {@link EncodingParameters}.
|
|
11285
11426
|
* @param {?EncodingParameters} encodingParameters
|
|
@@ -11400,6 +11541,21 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11400
11541
|
LocalParticipantV2.prototype.setNetworkQualityConfiguration = function (networkQualityConfiguration) {
|
|
11401
11542
|
this.networkQualityConfiguration.update(networkQualityConfiguration);
|
|
11402
11543
|
};
|
|
11544
|
+
/**
|
|
11545
|
+
* updates encodings for simulcast layers.
|
|
11546
|
+
* @param {Track.SID} trackSid
|
|
11547
|
+
* @param {Array<{enabled: boolean, layer_index: number}>} encodings
|
|
11548
|
+
* @returns {Promise<string>} string indicating result of the operation. can be one of
|
|
11549
|
+
* "OK", "INVALID_HINT", "COULD_NOT_APPLY_HINT", "UNKNOWN_TRACK"
|
|
11550
|
+
*/
|
|
11551
|
+
LocalParticipantV2.prototype.setPublisherHint = function (trackSid, encodings) {
|
|
11552
|
+
var trackSignaling = Array.from(this.tracks.values()).find(function (trackPub) { return trackPub.sid === trackSid; });
|
|
11553
|
+
if (!trackSignaling) {
|
|
11554
|
+
this._log.warn("track:" + trackSid + " not found");
|
|
11555
|
+
return Promise.resolve('UNKNOWN_TRACK');
|
|
11556
|
+
}
|
|
11557
|
+
return trackSignaling.trackTransceiver.setPublisherHint(encodings);
|
|
11558
|
+
};
|
|
11403
11559
|
return LocalParticipantV2;
|
|
11404
11560
|
}(LocalParticipantSignaling));
|
|
11405
11561
|
/**
|
|
@@ -11437,7 +11593,7 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
|
|
|
11437
11593
|
*/
|
|
11438
11594
|
module.exports = LocalParticipantV2;
|
|
11439
11595
|
|
|
11440
|
-
},{"../../util":
|
|
11596
|
+
},{"../../util":127,"../../util/constants":121,"../../util/log":131,"../localparticipant":56,"./localtrackpublication":70}],70:[function(require,module,exports){
|
|
11441
11597
|
'use strict';
|
|
11442
11598
|
var __extends = (this && this.__extends) || (function () {
|
|
11443
11599
|
var extendStatics = function (d, b) {
|
|
@@ -11519,7 +11675,7 @@ var LocalTrackPublicationV2 = /** @class */ (function (_super) {
|
|
|
11519
11675
|
*/
|
|
11520
11676
|
module.exports = LocalTrackPublicationV2;
|
|
11521
11677
|
|
|
11522
|
-
},{"../../util/twilio-video-errors":
|
|
11678
|
+
},{"../../util/twilio-video-errors":142,"../localtrackpublication":57}],71:[function(require,module,exports){
|
|
11523
11679
|
/* eslint callback-return:0 */
|
|
11524
11680
|
'use strict';
|
|
11525
11681
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -11616,7 +11772,7 @@ var MediaSignaling = /** @class */ (function (_super) {
|
|
|
11616
11772
|
}(EventEmitter));
|
|
11617
11773
|
module.exports = MediaSignaling;
|
|
11618
11774
|
|
|
11619
|
-
},{"events":
|
|
11775
|
+
},{"events":178}],72:[function(require,module,exports){
|
|
11620
11776
|
/* eslint callback-return:0 */
|
|
11621
11777
|
'use strict';
|
|
11622
11778
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -11775,7 +11931,7 @@ function next(monitor) {
|
|
|
11775
11931
|
*/
|
|
11776
11932
|
module.exports = NetworkQualityMonitor;
|
|
11777
11933
|
|
|
11778
|
-
},{"../../stats/peerconnectionreportfactory":
|
|
11934
|
+
},{"../../stats/peerconnectionreportfactory":103,"events":178}],73:[function(require,module,exports){
|
|
11779
11935
|
'use strict';
|
|
11780
11936
|
var __extends = (this && this.__extends) || (function () {
|
|
11781
11937
|
var extendStatics = function (d, b) {
|
|
@@ -11794,6 +11950,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
11794
11950
|
})();
|
|
11795
11951
|
var MediaSignaling = require('./mediasignaling');
|
|
11796
11952
|
var AsyncVar = require('../../util/asyncvar');
|
|
11953
|
+
var Timeout = require('../../util/timeout');
|
|
11954
|
+
var NETWORK_QUALITY_RESPONSE_TIME_MS = 5000;
|
|
11797
11955
|
/**
|
|
11798
11956
|
* @interface MediaSignalingTransport
|
|
11799
11957
|
* @property {function(object): boolean} send
|
|
@@ -11878,6 +12036,13 @@ var NetworkQualitySignaling = /** @class */ (function (_super) {
|
|
|
11878
12036
|
_networkQualityInputs: {
|
|
11879
12037
|
value: new AsyncVar()
|
|
11880
12038
|
},
|
|
12039
|
+
_resendTimer: {
|
|
12040
|
+
value: new Timeout(function () {
|
|
12041
|
+
// and schedule next timer at x1.5 the delay..
|
|
12042
|
+
_this._resendTimer.setDelay(_this._resendTimer.delay * 1.5);
|
|
12043
|
+
_this._sendNetworkQualityInputs();
|
|
12044
|
+
}, NETWORK_QUALITY_RESPONSE_TIME_MS, false),
|
|
12045
|
+
},
|
|
11881
12046
|
_networkQualityReportLevels: {
|
|
11882
12047
|
get: function () {
|
|
11883
12048
|
return {
|
|
@@ -11889,6 +12054,7 @@ var NetworkQualitySignaling = /** @class */ (function (_super) {
|
|
|
11889
12054
|
});
|
|
11890
12055
|
_this.on('ready', function (transport) {
|
|
11891
12056
|
transport.on('message', function (message) {
|
|
12057
|
+
_this._log.debug('Incoming: ', message);
|
|
11892
12058
|
switch (message.type) {
|
|
11893
12059
|
case 'network_quality':
|
|
11894
12060
|
_this._handleNetworkQualityMessage(message);
|
|
@@ -11976,7 +12142,13 @@ var NetworkQualitySignaling = /** @class */ (function (_super) {
|
|
|
11976
12142
|
if (updated) {
|
|
11977
12143
|
this.emit('updated');
|
|
11978
12144
|
}
|
|
11979
|
-
|
|
12145
|
+
// score is received. so reset the timer to default timeout.
|
|
12146
|
+
this._resendTimer.setDelay(NETWORK_QUALITY_RESPONSE_TIME_MS);
|
|
12147
|
+
// timer is cleared only while we are sending inputs.
|
|
12148
|
+
// if we are already sending inputs do not send them again.
|
|
12149
|
+
if (this._resendTimer.isSet) {
|
|
12150
|
+
setTimeout(function () { return _this._sendNetworkQualityInputs(); }, 1000);
|
|
12151
|
+
}
|
|
11980
12152
|
};
|
|
11981
12153
|
/**
|
|
11982
12154
|
* Start sending {@link NetworkQualityInputs}.
|
|
@@ -11985,10 +12157,13 @@ var NetworkQualitySignaling = /** @class */ (function (_super) {
|
|
|
11985
12157
|
*/
|
|
11986
12158
|
NetworkQualitySignaling.prototype._sendNetworkQualityInputs = function () {
|
|
11987
12159
|
var _this = this;
|
|
12160
|
+
this._resendTimer.clear();
|
|
11988
12161
|
return this._networkQualityInputs.take().then(function (networkQualityInputs) {
|
|
11989
12162
|
if (_this._transport) {
|
|
11990
12163
|
_this._transport.publish(createNetworkQualityInputsMessage(networkQualityInputs, _this._networkQualityReportLevels));
|
|
11991
12164
|
}
|
|
12165
|
+
}).finally(function () {
|
|
12166
|
+
_this._resendTimer.start();
|
|
11992
12167
|
});
|
|
11993
12168
|
};
|
|
11994
12169
|
/**
|
|
@@ -12021,7 +12196,7 @@ function createNetworkQualityInputsMessage(networkQualityInputs, networkQualityR
|
|
|
12021
12196
|
}
|
|
12022
12197
|
module.exports = NetworkQualitySignaling;
|
|
12023
12198
|
|
|
12024
|
-
},{"../../util/asyncvar":
|
|
12199
|
+
},{"../../util/asyncvar":118,"../../util/timeout":141,"./mediasignaling":71}],74:[function(require,module,exports){
|
|
12025
12200
|
'use strict';
|
|
12026
12201
|
var __extends = (this && this.__extends) || (function () {
|
|
12027
12202
|
var extendStatics = function (d, b) {
|
|
@@ -12060,33 +12235,27 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
12060
12235
|
return to;
|
|
12061
12236
|
};
|
|
12062
12237
|
var DefaultBackoff = require('backoff');
|
|
12063
|
-
var _a = require('@twilio/webrtc'),
|
|
12064
|
-
var
|
|
12065
|
-
var getSdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat;
|
|
12238
|
+
var _a = require('@twilio/webrtc'), DefaultRTCIceCandidate = _a.RTCIceCandidate, DefaultRTCPeerConnection = _a.RTCPeerConnection, DefaultRTCSessionDescription = _a.RTCSessionDescription, getStatistics = _a.getStats;
|
|
12239
|
+
var util = require('@twilio/webrtc/lib/util');
|
|
12066
12240
|
var _b = require('../../util/constants'), DEFAULT_ICE_GATHERING_TIMEOUT_MS = _b.DEFAULT_ICE_GATHERING_TIMEOUT_MS, DEFAULT_LOG_LEVEL = _b.DEFAULT_LOG_LEVEL, DEFAULT_SESSION_TIMEOUT_SEC = _b.DEFAULT_SESSION_TIMEOUT_SEC, iceRestartBackoffConfig = _b.iceRestartBackoffConfig;
|
|
12067
|
-
var _c = require('../../util/sdp'),
|
|
12241
|
+
var _c = require('../../util/sdp'), addOrRewriteNewTrackIds = _c.addOrRewriteNewTrackIds, addOrRewriteTrackIds = _c.addOrRewriteTrackIds, createCodecMapForMediaSection = _c.createCodecMapForMediaSection, disableRtx = _c.disableRtx, enableDtxForOpus = _c.enableDtxForOpus, filterLocalCodecs = _c.filterLocalCodecs, getMediaSections = _c.getMediaSections, removeSSRCAttributes = _c.removeSSRCAttributes, revertSimulcast = _c.revertSimulcast, setCodecPreferences = _c.setCodecPreferences, setSimulcast = _c.setSimulcast;
|
|
12068
12242
|
var DefaultTimeout = require('../../util/timeout');
|
|
12069
12243
|
var _d = require('../../util/twilio-video-errors'), MediaClientLocalDescFailedError = _d.MediaClientLocalDescFailedError, MediaClientRemoteDescFailedError = _d.MediaClientRemoteDescFailedError;
|
|
12070
|
-
var _e = require('../../util'), buildLogLevels = _e.buildLogLevels, getPlatform = _e.getPlatform, isChromeScreenShareTrack = _e.isChromeScreenShareTrack, oncePerTick = _e.oncePerTick;
|
|
12244
|
+
var _e = require('../../util'), buildLogLevels = _e.buildLogLevels, getPlatform = _e.getPlatform, isChromeScreenShareTrack = _e.isChromeScreenShareTrack, oncePerTick = _e.oncePerTick, defer = _e.defer;
|
|
12071
12245
|
var IceBox = require('./icebox');
|
|
12072
12246
|
var DefaultIceConnectionMonitor = require('./iceconnectionmonitor.js');
|
|
12073
12247
|
var DataTrackReceiver = require('../../data/receiver');
|
|
12074
12248
|
var MediaTrackReceiver = require('../../media/track/receiver');
|
|
12075
12249
|
var StateMachine = require('../../statemachine');
|
|
12076
12250
|
var Log = require('../../util/log');
|
|
12077
|
-
var
|
|
12078
|
-
var OrderedTrackMatcher = require('../../util/sdp/trackmatcher/ordered');
|
|
12079
|
-
var MIDTrackMatcher = require('../../util/sdp/trackmatcher/mid');
|
|
12251
|
+
var TrackMatcher = require('../../util/sdp/trackmatcher');
|
|
12080
12252
|
var workaroundIssue8329 = require('../../util/sdp/issue8329');
|
|
12081
|
-
var guess = guessBrowser();
|
|
12253
|
+
var guess = util.guessBrowser();
|
|
12082
12254
|
var platform = getPlatform();
|
|
12083
12255
|
var isAndroid = /android/.test(platform);
|
|
12084
12256
|
var isChrome = guess === 'chrome';
|
|
12085
12257
|
var isFirefox = guess === 'firefox';
|
|
12086
12258
|
var isSafari = guess === 'safari';
|
|
12087
|
-
var isRTCRtpSenderParamsSupported = typeof RTCRtpSender !== 'undefined'
|
|
12088
|
-
&& typeof RTCRtpSender.prototype.getParameters === 'function'
|
|
12089
|
-
&& typeof RTCRtpSender.prototype.setParameters === 'function';
|
|
12090
12259
|
var nInstances = 0;
|
|
12091
12260
|
/*
|
|
12092
12261
|
PeerConnectionV2 States
|
|
@@ -12143,26 +12312,20 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12143
12312
|
dummyAudioMediaStreamTrack: null,
|
|
12144
12313
|
isChromeScreenShareTrack: isChromeScreenShareTrack,
|
|
12145
12314
|
iceServers: [],
|
|
12146
|
-
isRTCRtpSenderParamsSupported: isRTCRtpSenderParamsSupported,
|
|
12147
12315
|
logLevel: DEFAULT_LOG_LEVEL,
|
|
12148
12316
|
offerOptions: {},
|
|
12149
|
-
|
|
12317
|
+
revertSimulcast: revertSimulcast,
|
|
12150
12318
|
sessionTimeout: DEFAULT_SESSION_TIMEOUT_SEC * 1000,
|
|
12151
|
-
setBitrateParameters: setBitrateParameters,
|
|
12152
12319
|
setCodecPreferences: setCodecPreferences,
|
|
12153
12320
|
setSimulcast: setSimulcast,
|
|
12154
12321
|
Backoff: DefaultBackoff,
|
|
12155
12322
|
IceConnectionMonitor: DefaultIceConnectionMonitor,
|
|
12156
|
-
MediaStream: DefaultMediaStream,
|
|
12157
12323
|
RTCIceCandidate: DefaultRTCIceCandidate,
|
|
12158
12324
|
RTCPeerConnection: DefaultRTCPeerConnection,
|
|
12159
12325
|
RTCSessionDescription: DefaultRTCSessionDescription,
|
|
12160
12326
|
Timeout: DefaultTimeout
|
|
12161
12327
|
}, options);
|
|
12162
12328
|
var configuration = getConfiguration(options);
|
|
12163
|
-
var sdpFormat = getSdpFormat(configuration.sdpSemantics);
|
|
12164
|
-
var isUnifiedPlan = sdpFormat === 'unified';
|
|
12165
|
-
var localMediaStream = isUnifiedPlan ? null : new options.MediaStream();
|
|
12166
12329
|
var logLevels = buildLogLevels(options.logLevel);
|
|
12167
12330
|
var RTCPeerConnection = options.RTCPeerConnection;
|
|
12168
12331
|
if (options.enableDscp === true) {
|
|
@@ -12173,7 +12336,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12173
12336
|
var log = options.log ? options.log.createLog('webrtc', _this) : new Log('webrtc', _this, logLevels, options.loggerName);
|
|
12174
12337
|
var peerConnection = new RTCPeerConnection(configuration, options.chromeSpecificConstraints);
|
|
12175
12338
|
if (options.dummyAudioMediaStreamTrack) {
|
|
12176
|
-
peerConnection.addTrack(options.dummyAudioMediaStreamTrack
|
|
12339
|
+
peerConnection.addTrack(options.dummyAudioMediaStreamTrack);
|
|
12177
12340
|
}
|
|
12178
12341
|
Object.defineProperties(_this, {
|
|
12179
12342
|
_appliedTrackIdsToAttributes: {
|
|
@@ -12232,12 +12395,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12232
12395
|
writable: true,
|
|
12233
12396
|
value: false
|
|
12234
12397
|
},
|
|
12235
|
-
_isUnifiedPlan: {
|
|
12236
|
-
value: isUnifiedPlan
|
|
12237
|
-
},
|
|
12238
|
-
_isRTCRtpSenderParamsSupported: {
|
|
12239
|
-
value: options.isRTCRtpSenderParamsSupported
|
|
12240
|
-
},
|
|
12241
12398
|
_lastIceConnectionState: {
|
|
12242
12399
|
writable: true,
|
|
12243
12400
|
value: null
|
|
@@ -12265,9 +12422,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12265
12422
|
writable: true,
|
|
12266
12423
|
value: null
|
|
12267
12424
|
},
|
|
12268
|
-
_localMediaStream: {
|
|
12269
|
-
value: localMediaStream
|
|
12270
|
-
},
|
|
12271
12425
|
_localUfrag: {
|
|
12272
12426
|
writable: true,
|
|
12273
12427
|
value: null
|
|
@@ -12284,6 +12438,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12284
12438
|
_rtpSenders: {
|
|
12285
12439
|
value: new Map()
|
|
12286
12440
|
},
|
|
12441
|
+
_rtpNewSenders: {
|
|
12442
|
+
value: new Set()
|
|
12443
|
+
},
|
|
12287
12444
|
_iceConnectionMonitor: {
|
|
12288
12445
|
value: new options.IceConnectionMonitor(peerConnection)
|
|
12289
12446
|
},
|
|
@@ -12304,13 +12461,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12304
12461
|
},
|
|
12305
12462
|
_onEncodingParametersChanged: {
|
|
12306
12463
|
value: oncePerTick(function () {
|
|
12307
|
-
if (_this.
|
|
12308
|
-
|
|
12309
|
-
updateEncodingParameters(_this);
|
|
12310
|
-
}
|
|
12311
|
-
return;
|
|
12464
|
+
if (!_this._needsAnswer) {
|
|
12465
|
+
updateEncodingParameters(_this);
|
|
12312
12466
|
}
|
|
12313
|
-
_this.offer();
|
|
12314
12467
|
})
|
|
12315
12468
|
},
|
|
12316
12469
|
_peerConnection: {
|
|
@@ -12332,9 +12485,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12332
12485
|
return codec === 'opus' && dtx;
|
|
12333
12486
|
})
|
|
12334
12487
|
},
|
|
12335
|
-
_shouldApplySimulcast: {
|
|
12336
|
-
value: (isChrome || isSafari) && preferredCodecs.video.some(function (codecSettings) { return codecSettings.codec.toLowerCase() === 'vp8' && codecSettings.simulcast; })
|
|
12337
|
-
},
|
|
12338
12488
|
_queuedDescription: {
|
|
12339
12489
|
writable: true,
|
|
12340
12490
|
value: null
|
|
@@ -12358,12 +12508,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12358
12508
|
writable: true,
|
|
12359
12509
|
value: new IceBox()
|
|
12360
12510
|
},
|
|
12361
|
-
_sdpFormat: {
|
|
12362
|
-
value: sdpFormat
|
|
12363
|
-
},
|
|
12364
|
-
_setBitrateParameters: {
|
|
12365
|
-
value: options.setBitrateParameters
|
|
12366
|
-
},
|
|
12367
12511
|
_setCodecPreferences: {
|
|
12368
12512
|
// NOTE(mmalavalli): Re-ordering payload types in order to make sure a non-H264
|
|
12369
12513
|
// preferred codec is selected does not work on Android Firefox due to this behavior:
|
|
@@ -12376,8 +12520,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12376
12520
|
_setSimulcast: {
|
|
12377
12521
|
value: options.setSimulcast
|
|
12378
12522
|
},
|
|
12379
|
-
|
|
12380
|
-
value: options.
|
|
12523
|
+
_revertSimulcast: {
|
|
12524
|
+
value: options.revertSimulcast
|
|
12381
12525
|
},
|
|
12382
12526
|
_RTCIceCandidate: {
|
|
12383
12527
|
value: options.RTCIceCandidate
|
|
@@ -12404,6 +12548,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12404
12548
|
writable: true,
|
|
12405
12549
|
value: null
|
|
12406
12550
|
},
|
|
12551
|
+
_mediaTrackSenderToPublisherHints: {
|
|
12552
|
+
value: new Map()
|
|
12553
|
+
},
|
|
12407
12554
|
id: {
|
|
12408
12555
|
enumerable: true,
|
|
12409
12556
|
value: id
|
|
@@ -12433,6 +12580,29 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12433
12580
|
PeerConnectionV2.prototype.toString = function () {
|
|
12434
12581
|
return "[PeerConnectionV2 #" + this._instanceId + ": " + this.id + "]";
|
|
12435
12582
|
};
|
|
12583
|
+
PeerConnectionV2.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {
|
|
12584
|
+
this._log.debug('Setting setEffectiveAdaptiveSimulcast: ', effectiveAdaptiveSimulcast);
|
|
12585
|
+
// clear adaptive simulcast from codec preferences if it was set.
|
|
12586
|
+
this._preferredVideoCodecs.forEach(function (cs) {
|
|
12587
|
+
if ('adaptiveSimulcast' in cs) {
|
|
12588
|
+
cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;
|
|
12589
|
+
}
|
|
12590
|
+
});
|
|
12591
|
+
};
|
|
12592
|
+
Object.defineProperty(PeerConnectionV2.prototype, "_shouldApplySimulcast", {
|
|
12593
|
+
get: function () {
|
|
12594
|
+
if (!isChrome && !isSafari) {
|
|
12595
|
+
return false;
|
|
12596
|
+
}
|
|
12597
|
+
// adaptiveSimulcast is set to false after connected message is received if other party does not support it.
|
|
12598
|
+
var simulcast = this._preferredVideoCodecs.some(function (cs) {
|
|
12599
|
+
return cs.codec.toLowerCase() === 'vp8' && cs.simulcast && cs.adaptiveSimulcast !== false;
|
|
12600
|
+
});
|
|
12601
|
+
return simulcast;
|
|
12602
|
+
},
|
|
12603
|
+
enumerable: false,
|
|
12604
|
+
configurable: true
|
|
12605
|
+
});
|
|
12436
12606
|
Object.defineProperty(PeerConnectionV2.prototype, "connectionState", {
|
|
12437
12607
|
/**
|
|
12438
12608
|
* The {@link PeerConnectionV2}'s underlying RTCPeerConnection's RTCPeerConnectionState
|
|
@@ -12477,35 +12647,97 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12477
12647
|
enumerable: false,
|
|
12478
12648
|
configurable: true
|
|
12479
12649
|
});
|
|
12650
|
+
Object.defineProperty(PeerConnectionV2.prototype, "_isAdaptiveSimulcastEnabled", {
|
|
12651
|
+
/**
|
|
12652
|
+
* Whether adaptive simulcast is enabled.
|
|
12653
|
+
* @returns {boolean}
|
|
12654
|
+
*/
|
|
12655
|
+
get: function () {
|
|
12656
|
+
var adaptiveSimulcastEntry = this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });
|
|
12657
|
+
return adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === true;
|
|
12658
|
+
},
|
|
12659
|
+
enumerable: false,
|
|
12660
|
+
configurable: true
|
|
12661
|
+
});
|
|
12480
12662
|
/**
|
|
12481
|
-
*
|
|
12482
|
-
* @param {number} width
|
|
12483
|
-
* @param {number} height
|
|
12663
|
+
* @param {MediaStreamTrack} track
|
|
12484
12664
|
* @param {Array<RTCRtpEncodingParameters>} encodings
|
|
12665
|
+
* @param {boolean} trackReplaced
|
|
12666
|
+
* @returns {boolean} true if encodings were updated.
|
|
12485
12667
|
*/
|
|
12486
|
-
PeerConnectionV2.prototype.
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
var
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12668
|
+
PeerConnectionV2.prototype._maybeUpdateEncodings = function (track, encodings, trackReplaced) {
|
|
12669
|
+
if (trackReplaced === void 0) { trackReplaced = false; }
|
|
12670
|
+
if (track.kind !== 'video') {
|
|
12671
|
+
return false;
|
|
12672
|
+
}
|
|
12673
|
+
var browser = util.guessBrowser();
|
|
12674
|
+
// Note(mpatwardhan): always configure encodings for safari.
|
|
12675
|
+
// for chrome only when adaptive simulcast enabled.
|
|
12676
|
+
if (browser === 'safari' || (browser === 'chrome' && this._isAdaptiveSimulcastEnabled)) {
|
|
12677
|
+
this._updateEncodings(track, encodings, trackReplaced);
|
|
12678
|
+
return true;
|
|
12679
|
+
}
|
|
12680
|
+
return false;
|
|
12681
|
+
};
|
|
12682
|
+
/**
|
|
12683
|
+
* Configures with default encodings depending on track type and resolution.
|
|
12684
|
+
* Default configuration sets some encodings to disabled, and for others set scaleResolutionDownBy
|
|
12685
|
+
* values. When trackReplaced is set to true, it will clear 'active' for any encodings that
|
|
12686
|
+
* needs to be enabled.
|
|
12687
|
+
* @param {MediaStreamTrack} track
|
|
12688
|
+
* @param {Array<RTCRtpEncodingParameters>} encodings
|
|
12689
|
+
* @param {boolean} trackReplaced
|
|
12690
|
+
*/
|
|
12691
|
+
PeerConnectionV2.prototype._updateEncodings = function (track, encodings, trackReplaced) {
|
|
12692
|
+
if (this._isChromeScreenShareTrack(track)) {
|
|
12693
|
+
var screenShareActiveLayerConfig_1 = [
|
|
12694
|
+
{ scaleResolutionDownBy: 1 },
|
|
12695
|
+
{ scaleResolutionDownBy: 1 }
|
|
12696
|
+
];
|
|
12697
|
+
encodings.forEach(function (encoding, i) {
|
|
12698
|
+
var activeLayerConfig = screenShareActiveLayerConfig_1[i];
|
|
12699
|
+
if (activeLayerConfig) {
|
|
12700
|
+
encoding.scaleResolutionDownBy = activeLayerConfig.scaleResolutionDownBy;
|
|
12701
|
+
if (trackReplaced) {
|
|
12702
|
+
delete encoding.active;
|
|
12703
|
+
}
|
|
12704
|
+
}
|
|
12705
|
+
else {
|
|
12706
|
+
encoding.active = false;
|
|
12707
|
+
delete encoding.scaleResolutionDownBy;
|
|
12708
|
+
}
|
|
12709
|
+
});
|
|
12710
|
+
}
|
|
12711
|
+
else {
|
|
12712
|
+
var _a = track.getSettings(), width = _a.width, height = _a.height;
|
|
12713
|
+
// NOTE(mpatwardhan): for non-screen share tracks
|
|
12714
|
+
// enable layers depending on track resolutions
|
|
12715
|
+
var pixelsToMaxActiveLayers = [
|
|
12716
|
+
{ pixels: 960 * 540, maxActiveLayers: 3 },
|
|
12717
|
+
{ pixels: 480 * 270, maxActiveLayers: 2 },
|
|
12718
|
+
{ pixels: 0, maxActiveLayers: 1 }
|
|
12719
|
+
];
|
|
12720
|
+
var trackPixels_1 = width * height;
|
|
12721
|
+
var activeLayersInfo = pixelsToMaxActiveLayers.find(function (layer) { return trackPixels_1 >= layer.pixels; });
|
|
12722
|
+
var activeLayers_1 = Math.min(encodings.length, activeLayersInfo.maxActiveLayers);
|
|
12723
|
+
encodings.forEach(function (encoding, i) {
|
|
12724
|
+
var enabled = i < activeLayers_1;
|
|
12725
|
+
if (enabled) {
|
|
12726
|
+
encoding.scaleResolutionDownBy = 1 << (activeLayers_1 - i - 1);
|
|
12727
|
+
if (trackReplaced) {
|
|
12728
|
+
delete encoding.active;
|
|
12729
|
+
}
|
|
12730
|
+
}
|
|
12731
|
+
else {
|
|
12732
|
+
encoding.active = false;
|
|
12733
|
+
delete encoding.scaleResolutionDownBy;
|
|
12734
|
+
}
|
|
12735
|
+
});
|
|
12736
|
+
}
|
|
12737
|
+
this._log.debug('_updateEncodings:', encodings.map(function (_a, i) {
|
|
12738
|
+
var active = _a.active, scaleResolutionDownBy = _a.scaleResolutionDownBy;
|
|
12739
|
+
return "[" + i + ": " + active + ", " + (scaleResolutionDownBy || 0) + "]";
|
|
12740
|
+
}).join(', '));
|
|
12509
12741
|
};
|
|
12510
12742
|
/**
|
|
12511
12743
|
* Add an ICE candidate to the {@link PeerConnectionV2}.
|
|
@@ -12621,11 +12853,11 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12621
12853
|
var updatedSdp = removeSSRCAttributes(answer.sdp, ['mslabel', 'label']);
|
|
12622
12854
|
if (_this._shouldApplySimulcast) {
|
|
12623
12855
|
var sdpWithoutSimulcast = updatedSdp;
|
|
12624
|
-
updatedSdp = _this._setSimulcast(sdpWithoutSimulcast, _this.
|
|
12856
|
+
updatedSdp = _this._setSimulcast(sdpWithoutSimulcast, _this._trackIdsToAttributes);
|
|
12625
12857
|
// NOTE(syerrapragada): VMS does not support H264 simulcast. So,
|
|
12626
12858
|
// unset simulcast for sections in local offer where corresponding
|
|
12627
12859
|
// sections in answer doesn't have vp8 as preferred codec and reapply offer.
|
|
12628
|
-
updatedSdp = _this.
|
|
12860
|
+
updatedSdp = _this._revertSimulcast(updatedSdp, sdpWithoutSimulcast, offer.sdp);
|
|
12629
12861
|
}
|
|
12630
12862
|
// NOTE(mmalavalli): Work around Chromium bug 1074421.
|
|
12631
12863
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1074421
|
|
@@ -12843,7 +13075,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12843
13075
|
/**
|
|
12844
13076
|
* Handle a track event.
|
|
12845
13077
|
* @private
|
|
12846
|
-
* @param {
|
|
13078
|
+
* @param {RTCTrackEvent} event
|
|
12847
13079
|
* @returns {void}
|
|
12848
13080
|
*/
|
|
12849
13081
|
PeerConnectionV2.prototype._handleTrackEvent = function (event) {
|
|
@@ -12851,24 +13083,16 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12851
13083
|
var sdp = this._peerConnection.remoteDescription
|
|
12852
13084
|
? this._peerConnection.remoteDescription.sdp
|
|
12853
13085
|
: null;
|
|
12854
|
-
|
|
12855
|
-
this._trackMatcher = event.transceiver && event.transceiver.mid
|
|
12856
|
-
? new MIDTrackMatcher()
|
|
12857
|
-
// NOTE(mroberts): Until Chrome ships RTCRtpTransceivers with MID
|
|
12858
|
-
// support, we have to use the same hacky solution as Safari. Revisit
|
|
12859
|
-
// this when RTCRtpTransceivers and MIDs land. We should be able to use
|
|
12860
|
-
// the same technique as Firefox.
|
|
12861
|
-
: isSafari || this._isUnifiedPlan ? new OrderedTrackMatcher() : new IdentityTrackMatcher();
|
|
12862
|
-
}
|
|
13086
|
+
this._trackMatcher = this._trackMatcher || new TrackMatcher();
|
|
12863
13087
|
this._trackMatcher.update(sdp);
|
|
12864
13088
|
var mediaStreamTrack = event.track;
|
|
12865
13089
|
var signaledTrackId = this._trackMatcher.match(event) || mediaStreamTrack.id;
|
|
12866
13090
|
var mediaTrackReceiver = new MediaTrackReceiver(signaledTrackId, mediaStreamTrack);
|
|
12867
|
-
// NOTE(mmalavalli):
|
|
12868
|
-
//
|
|
12869
|
-
//
|
|
12870
|
-
//
|
|
12871
|
-
//
|
|
13091
|
+
// NOTE(mmalavalli): "ended" is not fired on the remote MediaStreamTrack when
|
|
13092
|
+
// the remote peer removes a track. So, when this MediaStreamTrack is re-used
|
|
13093
|
+
// for a different track due to the remote peer calling RTCRtpSender.replaceTrack(),
|
|
13094
|
+
// we delete the previous MediaTrackReceiver that owned this MediaStreamTrack
|
|
13095
|
+
// before adding the new MediaTrackReceiver.
|
|
12872
13096
|
this._mediaTrackReceivers.forEach(function (trackReceiver) {
|
|
12873
13097
|
if (trackReceiver.track.id === mediaTrackReceiver.track.id) {
|
|
12874
13098
|
_this._mediaTrackReceivers.delete(trackReceiver);
|
|
@@ -12923,18 +13147,16 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12923
13147
|
PeerConnectionV2.prototype._maybeReoffer = function (localDescription) {
|
|
12924
13148
|
var shouldReoffer = this._shouldOffer;
|
|
12925
13149
|
if (localDescription && localDescription.sdp) {
|
|
12926
|
-
// NOTE(mmalavalli):
|
|
12927
|
-
//
|
|
12928
|
-
//
|
|
12929
|
-
//
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
}, shouldReoffer);
|
|
12937
|
-
}
|
|
13150
|
+
// NOTE(mmalavalli): If the local RTCSessionDescription has fewer audio and/or
|
|
13151
|
+
// video send* m= lines than the corresponding RTCRtpSenders with non-null
|
|
13152
|
+
// MediaStreamTracks, it means that the newly added RTCRtpSenders require
|
|
13153
|
+
// renegotiation.
|
|
13154
|
+
var senders_1 = this._peerConnection.getSenders().filter(function (sender) { return sender.track; });
|
|
13155
|
+
shouldReoffer = ['audio', 'video'].reduce(function (shouldOffer, kind) {
|
|
13156
|
+
var mediaSections = getMediaSections(localDescription.sdp, kind, '(sendrecv|sendonly)');
|
|
13157
|
+
var sendersOfKind = senders_1.filter(isSenderOfKind.bind(null, kind));
|
|
13158
|
+
return shouldOffer || (mediaSections.length < sendersOfKind.length);
|
|
13159
|
+
}, shouldReoffer);
|
|
12938
13160
|
// NOTE(mroberts): We also need to re-offer if we have a DataTrack to share
|
|
12939
13161
|
// but no m= application section.
|
|
12940
13162
|
var hasDataTrack = this._dataChannels.size > 0;
|
|
@@ -12988,8 +13210,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
12988
13210
|
// Looks like we are not referencing those attributes, but this changes goes ahead and removes them to see if it works.
|
|
12989
13211
|
// this also helps reduce bytes on wires
|
|
12990
13212
|
var sdp = removeSSRCAttributes(offer.sdp, ['mslabel', 'label']);
|
|
12991
|
-
sdp = _this.
|
|
12992
|
-
?
|
|
13213
|
+
sdp = _this._peerConnection.remoteDescription
|
|
13214
|
+
? filterLocalCodecs(sdp, _this._peerConnection.remoteDescription.sdp)
|
|
12993
13215
|
: sdp;
|
|
12994
13216
|
var updatedSdp = _this._setCodecPreferences(sdp, _this._preferredAudioCodecs, _this._preferredVideoCodecs);
|
|
12995
13217
|
_this._shouldOffer = false;
|
|
@@ -13001,7 +13223,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13001
13223
|
type: 'offer',
|
|
13002
13224
|
sdp: updatedSdp
|
|
13003
13225
|
};
|
|
13004
|
-
updatedSdp = _this._setSimulcast(updatedSdp, _this.
|
|
13226
|
+
updatedSdp = _this._setSimulcast(updatedSdp, _this._trackIdsToAttributes);
|
|
13005
13227
|
}
|
|
13006
13228
|
return _this._setLocalDescription({
|
|
13007
13229
|
type: 'offer',
|
|
@@ -13025,7 +13247,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13025
13247
|
return mediaTrackSender ? mediaTrackSender.id : trackId;
|
|
13026
13248
|
};
|
|
13027
13249
|
/**
|
|
13028
|
-
* Add or rewrite local MediaStreamTrack IDs in the given
|
|
13250
|
+
* Add or rewrite local MediaStreamTrack IDs in the given RTCSessionDescription.
|
|
13029
13251
|
* @private
|
|
13030
13252
|
* @param {RTCSessionDescription} description
|
|
13031
13253
|
* @return {RTCSessionDescription}
|
|
@@ -13049,7 +13271,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13049
13271
|
var mid = _a.mid, sender = _a.sender;
|
|
13050
13272
|
return [mid, _this._getMediaTrackSenderId(sender.track.id)];
|
|
13051
13273
|
}));
|
|
13052
|
-
var sdp1 =
|
|
13274
|
+
var sdp1 = addOrRewriteTrackIds(description.sdp, midsToTrackIds);
|
|
13053
13275
|
// NOTE(mmalavalli): Chrome and Safari do not apply the offer until they get an answer.
|
|
13054
13276
|
// So, we add or re-write the actual MediaStreamTrack IDs to the unassigned m= sections here.
|
|
13055
13277
|
var unassignedTransceivers = activeTransceivers.filter(function (_a) {
|
|
@@ -13066,7 +13288,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13066
13288
|
return _this._getMediaTrackSenderId(sender.track.id);
|
|
13067
13289
|
})
|
|
13068
13290
|
]; }));
|
|
13069
|
-
var sdp2 =
|
|
13291
|
+
var sdp2 = addOrRewriteNewTrackIds(sdp1, midsToTrackIds, newTrackIdsByKind);
|
|
13070
13292
|
return new this._RTCSessionDescription({
|
|
13071
13293
|
sdp: sdp2,
|
|
13072
13294
|
type: description.type
|
|
@@ -13097,7 +13319,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13097
13319
|
});
|
|
13098
13320
|
}
|
|
13099
13321
|
return this._peerConnection.setLocalDescription(description).catch(function (error) {
|
|
13100
|
-
_this._log.warn("Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".");
|
|
13322
|
+
_this._log.warn("Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".", error);
|
|
13101
13323
|
var errorToThrow = new MediaClientLocalDescFailedError();
|
|
13102
13324
|
var publishWarning = {
|
|
13103
13325
|
message: "Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed",
|
|
@@ -13112,7 +13334,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13112
13334
|
throw errorToThrow;
|
|
13113
13335
|
}).then(function () {
|
|
13114
13336
|
if (description.type !== 'rollback') {
|
|
13115
|
-
_this._localDescription = _this.
|
|
13337
|
+
_this._localDescription = _this._addOrRewriteLocalTrackIds(description);
|
|
13116
13338
|
// NOTE(mmalavalli): In order for this feature to be backward compatible with older
|
|
13117
13339
|
// SDK versions which to not support opus DTX, we append "usedtx=1" to the local SDP
|
|
13118
13340
|
// only while applying it. We will not send it over the wire to prevent inadvertent
|
|
@@ -13146,9 +13368,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13146
13368
|
PeerConnectionV2.prototype._setRemoteDescription = function (description) {
|
|
13147
13369
|
var _this = this;
|
|
13148
13370
|
if (description.sdp) {
|
|
13149
|
-
if (!this._isRTCRtpSenderParamsSupported) {
|
|
13150
|
-
description.sdp = this._setBitrateParameters(description.sdp, isFirefox ? 'TIAS' : 'AS', this._encodingParameters.maxAudioBitrate, this._encodingParameters.maxVideoBitrate);
|
|
13151
|
-
}
|
|
13152
13371
|
description.sdp = this._setCodecPreferences(description.sdp, this._preferredAudioCodecs, this._preferredVideoCodecs);
|
|
13153
13372
|
if (this._shouldApplyDtx) {
|
|
13154
13373
|
description.sdp = enableDtxForOpus(description.sdp);
|
|
@@ -13175,8 +13394,13 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13175
13394
|
// NOTE(syerrapragada): VMS does not support H264 simulcast. So,
|
|
13176
13395
|
// unset simulcast for sections in local offer where corresponding
|
|
13177
13396
|
// sections in answer doesn't have vp8 as preferred codec and reapply offer.
|
|
13178
|
-
if (description.type === 'answer' && _this.
|
|
13179
|
-
|
|
13397
|
+
if (description.type === 'answer' && _this._localDescriptionWithoutSimulcast) {
|
|
13398
|
+
// NOTE(mpatwardhan):if we were using adaptive simulcast, and if its not supported by server
|
|
13399
|
+
// revert simulcast even for vp8.
|
|
13400
|
+
var adaptiveSimulcastEntry = _this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });
|
|
13401
|
+
var revertForAll = !!adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === false;
|
|
13402
|
+
var sdpWithoutSimulcastForNonVP8MediaSections = _this._revertSimulcast(_this._localDescription.sdp, _this._localDescriptionWithoutSimulcast.sdp, description.sdp, revertForAll);
|
|
13403
|
+
_this._localDescriptionWithoutSimulcast = null;
|
|
13180
13404
|
if (sdpWithoutSimulcastForNonVP8MediaSections !== _this._localDescription.sdp) {
|
|
13181
13405
|
return _this._rollbackAndApplyOffer({
|
|
13182
13406
|
type: _this._localDescription.type,
|
|
@@ -13193,7 +13417,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13193
13417
|
negotiationCompleted(_this);
|
|
13194
13418
|
}
|
|
13195
13419
|
}, function (error) {
|
|
13196
|
-
_this._log.warn("Calling setRemoteDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".");
|
|
13420
|
+
_this._log.warn("Calling setRemoteDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".", error);
|
|
13197
13421
|
if (description.sdp) {
|
|
13198
13422
|
_this._log.warn("The SDP was " + description.sdp);
|
|
13199
13423
|
}
|
|
@@ -13317,25 +13541,89 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13317
13541
|
this._log.warn("Error creating an RTCDataChannel for DataTrack \"" + dataTrackSender.id + "\": " + error.message);
|
|
13318
13542
|
}
|
|
13319
13543
|
};
|
|
13544
|
+
PeerConnectionV2.prototype._handleQueuedPublisherHints = function () {
|
|
13545
|
+
var _this = this;
|
|
13546
|
+
if (this._peerConnection.signalingState === 'stable') {
|
|
13547
|
+
this._mediaTrackSenderToPublisherHints.forEach(function (_a, mediaTrackSender) {
|
|
13548
|
+
var deferred = _a.deferred, encodings = _a.encodings;
|
|
13549
|
+
_this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
|
|
13550
|
+
_this._setPublisherHint(mediaTrackSender, encodings)
|
|
13551
|
+
.then(function (result) { return deferred.resolve(result); })
|
|
13552
|
+
.catch(function (error) { return deferred.reject(error); });
|
|
13553
|
+
});
|
|
13554
|
+
}
|
|
13555
|
+
};
|
|
13556
|
+
/**
|
|
13557
|
+
* updates encodings for simulcast layers of given sender.
|
|
13558
|
+
* @param {RTCRtpSender} sender
|
|
13559
|
+
* @param {Array<{enabled: boolean, layer_index: number}>|null} encodings
|
|
13560
|
+
* @returns {Promise<string>} string indicating result of the operation. can be one of
|
|
13561
|
+
* "OK", "INVALID_HINT", "COULD_NOT_APPLY_HINT", "UNKNOWN_TRACK"
|
|
13562
|
+
*/
|
|
13563
|
+
PeerConnectionV2.prototype._setPublisherHint = function (mediaTrackSender, encodings) {
|
|
13564
|
+
var _this = this;
|
|
13565
|
+
if (isFirefox) {
|
|
13566
|
+
return Promise.resolve('COULD_NOT_APPLY_HINT');
|
|
13567
|
+
}
|
|
13568
|
+
if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {
|
|
13569
|
+
// skip any stale hint associated with the mediaTrackSender.
|
|
13570
|
+
var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);
|
|
13571
|
+
queuedHint.deferred.resolve('REQUEST_SKIPPED');
|
|
13572
|
+
this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
|
|
13573
|
+
}
|
|
13574
|
+
var sender = this._rtpSenders.get(mediaTrackSender);
|
|
13575
|
+
if (!sender) {
|
|
13576
|
+
this._log.warn('Could not apply publisher hint because RTCRtpSender was not found');
|
|
13577
|
+
return Promise.resolve('UNKNOWN_TRACK');
|
|
13578
|
+
}
|
|
13579
|
+
if (this._peerConnection.signalingState === 'closed') {
|
|
13580
|
+
this._log.warn('Could not apply publisher hint because signalingState was "closed"');
|
|
13581
|
+
return Promise.resolve('COULD_NOT_APPLY_HINT');
|
|
13582
|
+
}
|
|
13583
|
+
if (this._peerConnection.signalingState !== 'stable') {
|
|
13584
|
+
// enqueue this hint to be applied when pc becomes stable.
|
|
13585
|
+
this._log.debug('Queuing up publisher hint because signalingState:', this._peerConnection.signalingState);
|
|
13586
|
+
var deferred = defer();
|
|
13587
|
+
this._mediaTrackSenderToPublisherHints.set(mediaTrackSender, { deferred: deferred, encodings: encodings });
|
|
13588
|
+
return deferred.promise;
|
|
13589
|
+
}
|
|
13590
|
+
var parameters = sender.getParameters();
|
|
13591
|
+
if (encodings !== null) {
|
|
13592
|
+
encodings.forEach(function (_a) {
|
|
13593
|
+
var enabled = _a.enabled, layerIndex = _a.layer_index;
|
|
13594
|
+
if (parameters.encodings.length > layerIndex) {
|
|
13595
|
+
_this._log.debug("layer:" + layerIndex + ", active:" + parameters.encodings[layerIndex].active + " => " + enabled);
|
|
13596
|
+
parameters.encodings[layerIndex].active = enabled;
|
|
13597
|
+
}
|
|
13598
|
+
else {
|
|
13599
|
+
_this._log.warn("invalid layer:" + layerIndex + ", active:" + enabled);
|
|
13600
|
+
}
|
|
13601
|
+
});
|
|
13602
|
+
}
|
|
13603
|
+
// Note(mpatwardhan): after publisher hints are applied, overwrite with default encodings
|
|
13604
|
+
// to disable any encoding that shouldn't have been enabled by publisher_hints.
|
|
13605
|
+
// When encodings===null (that is we are asked to reset encodings for replaceTrack)
|
|
13606
|
+
// along with disabling encodings, clear active flag for encodings that should not be disabled
|
|
13607
|
+
this._maybeUpdateEncodings(sender.track, parameters.encodings, encodings === null /* trackReplaced */);
|
|
13608
|
+
return sender.setParameters(parameters).then(function () { return 'OK'; }).catch(function (error) {
|
|
13609
|
+
_this._log.error('Failed to apply publisher hints:', error);
|
|
13610
|
+
return 'COULD_NOT_APPLY_HINT';
|
|
13611
|
+
});
|
|
13612
|
+
};
|
|
13320
13613
|
/**
|
|
13321
13614
|
* Add the {@link MediaTrackSender} to the {@link PeerConnectionV2}.
|
|
13322
13615
|
* @param {MediaTrackSender} mediaTrackSender
|
|
13323
13616
|
* @returns {void}
|
|
13324
13617
|
*/
|
|
13325
13618
|
PeerConnectionV2.prototype.addMediaTrackSender = function (mediaTrackSender) {
|
|
13619
|
+
var _this = this;
|
|
13326
13620
|
if (this._peerConnection.signalingState === 'closed' || this._rtpSenders.has(mediaTrackSender)) {
|
|
13327
13621
|
return;
|
|
13328
13622
|
}
|
|
13329
|
-
var
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
}
|
|
13334
|
-
else {
|
|
13335
|
-
var transceiver = this._addOrUpdateTransceiver(mediaTrackSender.track);
|
|
13336
|
-
sender = transceiver.sender;
|
|
13337
|
-
}
|
|
13338
|
-
mediaTrackSender.addSender(sender);
|
|
13623
|
+
var transceiver = this._addOrUpdateTransceiver(mediaTrackSender.track);
|
|
13624
|
+
var sender = transceiver.sender;
|
|
13625
|
+
mediaTrackSender.addSender(sender, function (encodings) { return _this._setPublisherHint(mediaTrackSender, encodings); });
|
|
13626
|
+
this._rtpNewSenders.add(sender);
|
|
13339
13627
|
this._rtpSenders.set(mediaTrackSender, sender);
|
|
13340
13628
|
};
|
|
13341
13629
|
/**
|
|
@@ -13350,7 +13638,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13350
13638
|
}
|
|
13351
13639
|
};
|
|
13352
13640
|
/**
|
|
13353
|
-
* Get the {@link DataTrackReceiver}s and the {@link
|
|
13641
|
+
* Get the {@link DataTrackReceiver}s and the {@link MediaTrackReceiver}s on the
|
|
13354
13642
|
* {@link PeerConnectionV2}.
|
|
13355
13643
|
* @returns {Array<DataTrackReceiver|MediaTrackReceiver>} trackReceivers
|
|
13356
13644
|
*/
|
|
@@ -13429,10 +13717,14 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
|
|
|
13429
13717
|
if (this._peerConnection.signalingState !== 'closed') {
|
|
13430
13718
|
this._peerConnection.removeTrack(sender);
|
|
13431
13719
|
}
|
|
13432
|
-
if (this._localMediaStream) {
|
|
13433
|
-
this._localMediaStream.removeTrack(mediaTrackSender.track);
|
|
13434
|
-
}
|
|
13435
13720
|
mediaTrackSender.removeSender(sender);
|
|
13721
|
+
// clean up any pending publisher hints associated with this mediaTrackSender.
|
|
13722
|
+
if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {
|
|
13723
|
+
var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);
|
|
13724
|
+
queuedHint.deferred.resolve('UNKNOWN_TRACK');
|
|
13725
|
+
this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
|
|
13726
|
+
}
|
|
13727
|
+
this._rtpNewSenders.delete(sender);
|
|
13436
13728
|
this._rtpSenders.delete(mediaTrackSender);
|
|
13437
13729
|
};
|
|
13438
13730
|
/**
|
|
@@ -13611,7 +13903,7 @@ function takeRecycledTransceiver(pcv2, kind) {
|
|
|
13611
13903
|
*/
|
|
13612
13904
|
function updateLocalCodecs(pcv2) {
|
|
13613
13905
|
var description = pcv2._peerConnection.localDescription;
|
|
13614
|
-
if (!description) {
|
|
13906
|
+
if (!description || !description.sdp) {
|
|
13615
13907
|
return;
|
|
13616
13908
|
}
|
|
13617
13909
|
getMediaSections(description.sdp).forEach(function (section) {
|
|
@@ -13626,11 +13918,15 @@ function updateLocalCodecs(pcv2) {
|
|
|
13626
13918
|
*/
|
|
13627
13919
|
function updateRemoteCodecMaps(pcv2) {
|
|
13628
13920
|
var description = pcv2._peerConnection.remoteDescription;
|
|
13629
|
-
if (!description) {
|
|
13921
|
+
if (!description || !description.sdp) {
|
|
13630
13922
|
return;
|
|
13631
13923
|
}
|
|
13632
13924
|
getMediaSections(description.sdp).forEach(function (section) {
|
|
13633
|
-
var
|
|
13925
|
+
var matched = section.match(/^a=mid:(.+)$/m);
|
|
13926
|
+
if (!matched || !matched[1]) {
|
|
13927
|
+
return;
|
|
13928
|
+
}
|
|
13929
|
+
var mid = matched[1];
|
|
13634
13930
|
var codecMap = createCodecMapForMediaSection(section);
|
|
13635
13931
|
pcv2._remoteCodecMaps.set(mid, codecMap);
|
|
13636
13932
|
});
|
|
@@ -13655,14 +13951,13 @@ function updateRecycledTransceivers(pcv2) {
|
|
|
13655
13951
|
* @returns {void}
|
|
13656
13952
|
*/
|
|
13657
13953
|
function negotiationCompleted(pcv2) {
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
}
|
|
13954
|
+
updateRecycledTransceivers(pcv2);
|
|
13955
|
+
updateLocalCodecs(pcv2);
|
|
13956
|
+
updateRemoteCodecMaps(pcv2);
|
|
13957
|
+
updateEncodingParameters(pcv2).then(function () {
|
|
13958
|
+
// if there any any publisher hints queued, apply them now.
|
|
13959
|
+
pcv2._handleQueuedPublisherHints();
|
|
13960
|
+
});
|
|
13666
13961
|
}
|
|
13667
13962
|
/**
|
|
13668
13963
|
* Update the RTCRtpEncodingParameters of all active RTCRtpSenders.
|
|
@@ -13675,6 +13970,7 @@ function updateEncodingParameters(pcv2) {
|
|
|
13675
13970
|
['audio', maxAudioBitrate],
|
|
13676
13971
|
['video', maxVideoBitrate]
|
|
13677
13972
|
]);
|
|
13973
|
+
var promises = [];
|
|
13678
13974
|
pcv2._peerConnection.getSenders().filter(function (sender) { return sender.track; }).forEach(function (sender) {
|
|
13679
13975
|
var maxBitrate = maxBitrates.get(sender.track.kind);
|
|
13680
13976
|
var params = sender.getParameters();
|
|
@@ -13697,14 +13993,16 @@ function updateEncodingParameters(pcv2) {
|
|
|
13697
13993
|
// by RTCRtpSender.setParameters() being rejected.
|
|
13698
13994
|
params.encodings[0].networkPriority = 'high';
|
|
13699
13995
|
}
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
sender.setParameters(params).catch(function (error) {
|
|
13996
|
+
// when a sender is reused, delete any active encodings set by server.
|
|
13997
|
+
var trackReplaced = pcv2._rtpNewSenders.has(sender);
|
|
13998
|
+
pcv2._maybeUpdateEncodings(sender.track, params.encodings, trackReplaced);
|
|
13999
|
+
pcv2._rtpNewSenders.delete(sender);
|
|
14000
|
+
var promise = sender.setParameters(params).catch(function (error) {
|
|
13705
14001
|
pcv2._log.warn("Error while setting encodings parameters for " + sender.track.kind + " Track " + sender.track.id + ": " + (error.message || error.name));
|
|
13706
14002
|
});
|
|
14003
|
+
promises.push(promise);
|
|
13707
14004
|
});
|
|
14005
|
+
return Promise.all(promises);
|
|
13708
14006
|
}
|
|
13709
14007
|
/**
|
|
13710
14008
|
* Remove maxBitrate from the RTCRtpSendParameters' encodings.
|
|
@@ -13734,7 +14032,7 @@ function setMaxBitrate(params, maxBitrate) {
|
|
|
13734
14032
|
}
|
|
13735
14033
|
module.exports = PeerConnectionV2;
|
|
13736
14034
|
|
|
13737
|
-
},{"../../data/receiver":5,"../../media/track/receiver":28,"../../statemachine":
|
|
14035
|
+
},{"../../data/receiver":5,"../../media/track/receiver":28,"../../statemachine":85,"../../util":127,"../../util/constants":121,"../../util/log":131,"../../util/sdp":135,"../../util/sdp/issue8329":136,"../../util/sdp/trackmatcher":138,"../../util/timeout":141,"../../util/twilio-video-errors":142,"./icebox":66,"./iceconnectionmonitor.js":67,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164,"backoff":169}],75:[function(require,module,exports){
|
|
13738
14036
|
'use strict';
|
|
13739
14037
|
var __extends = (this && this.__extends) || (function () {
|
|
13740
14038
|
var extendStatics = function (d, b) {
|
|
@@ -13878,6 +14176,14 @@ var PeerConnectionManager = /** @class */ (function (_super) {
|
|
|
13878
14176
|
});
|
|
13879
14177
|
return _this;
|
|
13880
14178
|
}
|
|
14179
|
+
PeerConnectionManager.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {
|
|
14180
|
+
this._peerConnections.forEach(function (pc) { return pc.setEffectiveAdaptiveSimulcast(effectiveAdaptiveSimulcast); });
|
|
14181
|
+
this._preferredCodecs.video.forEach(function (cs) {
|
|
14182
|
+
if ('adaptiveSimulcast' in cs) {
|
|
14183
|
+
cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;
|
|
14184
|
+
}
|
|
14185
|
+
});
|
|
14186
|
+
};
|
|
13881
14187
|
Object.defineProperty(PeerConnectionManager.prototype, "connectionState", {
|
|
13882
14188
|
/**
|
|
13883
14189
|
* A summarized RTCPeerConnectionState across all the
|
|
@@ -14294,7 +14600,93 @@ function updateConnectionState(pcm) {
|
|
|
14294
14600
|
}
|
|
14295
14601
|
module.exports = PeerConnectionManager;
|
|
14296
14602
|
|
|
14297
|
-
},{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":
|
|
14603
|
+
},{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":127,"../../util/twilio-video-errors":142,"../../webaudio/audiocontext":146,"./peerconnection":74,"@twilio/webrtc/lib/util":164}],76:[function(require,module,exports){
|
|
14604
|
+
/* eslint callback-return:0 */
|
|
14605
|
+
'use strict';
|
|
14606
|
+
var __extends = (this && this.__extends) || (function () {
|
|
14607
|
+
var extendStatics = function (d, b) {
|
|
14608
|
+
extendStatics = Object.setPrototypeOf ||
|
|
14609
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
14610
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
14611
|
+
return extendStatics(d, b);
|
|
14612
|
+
};
|
|
14613
|
+
return function (d, b) {
|
|
14614
|
+
if (typeof b !== "function" && b !== null)
|
|
14615
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14616
|
+
extendStatics(d, b);
|
|
14617
|
+
function __() { this.constructor = d; }
|
|
14618
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14619
|
+
};
|
|
14620
|
+
})();
|
|
14621
|
+
var MediaSignaling = require('./mediasignaling');
|
|
14622
|
+
var messageId = 1;
|
|
14623
|
+
var PublisherHintsSignaling = /** @class */ (function (_super) {
|
|
14624
|
+
__extends(PublisherHintsSignaling, _super);
|
|
14625
|
+
/**
|
|
14626
|
+
* Construct a {@link RenderHintsSignaling}.
|
|
14627
|
+
*/
|
|
14628
|
+
function PublisherHintsSignaling(getReceiver, options) {
|
|
14629
|
+
var _this = _super.call(this, getReceiver, 'publisher_hints', options) || this;
|
|
14630
|
+
_this.on('ready', function (transport) {
|
|
14631
|
+
_this._log.debug('publisher_hints transport ready:', transport);
|
|
14632
|
+
transport.on('message', function (message) {
|
|
14633
|
+
_this._log.debug('Incoming: ', message);
|
|
14634
|
+
switch (message.type) {
|
|
14635
|
+
case 'publisher_hints':
|
|
14636
|
+
if (message.publisher && message.publisher.hints && message.publisher.id) {
|
|
14637
|
+
_this._processPublisherHints(message.publisher.hints, message.publisher.id);
|
|
14638
|
+
}
|
|
14639
|
+
break;
|
|
14640
|
+
default:
|
|
14641
|
+
_this._log.warn('Unknown message type: ', message.type);
|
|
14642
|
+
break;
|
|
14643
|
+
}
|
|
14644
|
+
});
|
|
14645
|
+
});
|
|
14646
|
+
return _this;
|
|
14647
|
+
}
|
|
14648
|
+
PublisherHintsSignaling.prototype.sendTrackReplaced = function (_a) {
|
|
14649
|
+
var trackSid = _a.trackSid;
|
|
14650
|
+
if (!this._transport) {
|
|
14651
|
+
return;
|
|
14652
|
+
}
|
|
14653
|
+
var payLoad = {
|
|
14654
|
+
type: 'client_reset',
|
|
14655
|
+
track: trackSid,
|
|
14656
|
+
id: messageId++
|
|
14657
|
+
};
|
|
14658
|
+
this._log.debug('Outgoing: ', payLoad);
|
|
14659
|
+
this._transport.publish(payLoad);
|
|
14660
|
+
};
|
|
14661
|
+
PublisherHintsSignaling.prototype.sendHintResponse = function (_a) {
|
|
14662
|
+
var id = _a.id, hints = _a.hints;
|
|
14663
|
+
if (!this._transport) {
|
|
14664
|
+
return;
|
|
14665
|
+
}
|
|
14666
|
+
var payLoad = {
|
|
14667
|
+
type: 'publisher_hints',
|
|
14668
|
+
id: id,
|
|
14669
|
+
hints: hints
|
|
14670
|
+
};
|
|
14671
|
+
this._log.debug('Outgoing: ', payLoad);
|
|
14672
|
+
this._transport.publish(payLoad);
|
|
14673
|
+
};
|
|
14674
|
+
/**
|
|
14675
|
+
* @private
|
|
14676
|
+
*/
|
|
14677
|
+
PublisherHintsSignaling.prototype._processPublisherHints = function (hints, id) {
|
|
14678
|
+
try {
|
|
14679
|
+
this.emit('updated', hints, id);
|
|
14680
|
+
}
|
|
14681
|
+
catch (ex) {
|
|
14682
|
+
this._log.error('error processing hints:', ex);
|
|
14683
|
+
}
|
|
14684
|
+
};
|
|
14685
|
+
return PublisherHintsSignaling;
|
|
14686
|
+
}(MediaSignaling));
|
|
14687
|
+
module.exports = PublisherHintsSignaling;
|
|
14688
|
+
|
|
14689
|
+
},{"./mediasignaling":71}],77:[function(require,module,exports){
|
|
14298
14690
|
'use strict';
|
|
14299
14691
|
var __extends = (this && this.__extends) || (function () {
|
|
14300
14692
|
var extendStatics = function (d, b) {
|
|
@@ -14354,7 +14746,7 @@ var RecordingV2 = /** @class */ (function (_super) {
|
|
|
14354
14746
|
*/
|
|
14355
14747
|
module.exports = RecordingV2;
|
|
14356
14748
|
|
|
14357
|
-
},{"../recording":59}],
|
|
14749
|
+
},{"../recording":59}],78:[function(require,module,exports){
|
|
14358
14750
|
'use strict';
|
|
14359
14751
|
var __extends = (this && this.__extends) || (function () {
|
|
14360
14752
|
var extendStatics = function (d, b) {
|
|
@@ -14474,7 +14866,7 @@ var RemoteParticipantV2 = /** @class */ (function (_super) {
|
|
|
14474
14866
|
}(RemoteParticipantSignaling));
|
|
14475
14867
|
module.exports = RemoteParticipantV2;
|
|
14476
14868
|
|
|
14477
|
-
},{"../remoteparticipant":60,"./remotetrackpublication":
|
|
14869
|
+
},{"../remoteparticipant":60,"./remotetrackpublication":79}],79:[function(require,module,exports){
|
|
14478
14870
|
'use strict';
|
|
14479
14871
|
var __extends = (this && this.__extends) || (function () {
|
|
14480
14872
|
var extendStatics = function (d, b) {
|
|
@@ -14528,7 +14920,7 @@ var RemoteTrackPublicationV2 = /** @class */ (function (_super) {
|
|
|
14528
14920
|
*/
|
|
14529
14921
|
module.exports = RemoteTrackPublicationV2;
|
|
14530
14922
|
|
|
14531
|
-
},{"../remotetrackpublication":61}],
|
|
14923
|
+
},{"../remotetrackpublication":61}],80:[function(require,module,exports){
|
|
14532
14924
|
/* eslint callback-return:0 */
|
|
14533
14925
|
'use strict';
|
|
14534
14926
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -14547,7 +14939,9 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14547
14939
|
};
|
|
14548
14940
|
})();
|
|
14549
14941
|
var MediaSignaling = require('./mediasignaling');
|
|
14942
|
+
var Timeout = require('../../util/timeout');
|
|
14550
14943
|
var isDeepEqual = require('../../util').isDeepEqual;
|
|
14944
|
+
var RENDER_HINT_RESPONSE_TIME_MS = 2000; // time to wait for server response (before resending all hints.)
|
|
14551
14945
|
var messageId = 1;
|
|
14552
14946
|
var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
14553
14947
|
__extends(RenderHintsSignaling, _super);
|
|
@@ -14560,9 +14954,12 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
|
14560
14954
|
_trackSidsToRenderHints: {
|
|
14561
14955
|
value: new Map()
|
|
14562
14956
|
},
|
|
14563
|
-
|
|
14564
|
-
value:
|
|
14565
|
-
|
|
14957
|
+
_responseTimer: {
|
|
14958
|
+
value: new Timeout(function () {
|
|
14959
|
+
_this._sendAllHints();
|
|
14960
|
+
// once timer fires, for next round double the delay.
|
|
14961
|
+
_this._responseTimer.setDelay(_this._responseTimer.delay * 2);
|
|
14962
|
+
}, RENDER_HINT_RESPONSE_TIME_MS, false),
|
|
14566
14963
|
}
|
|
14567
14964
|
});
|
|
14568
14965
|
_this.on('ready', function (transport) {
|
|
@@ -14578,23 +14975,29 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
|
14578
14975
|
}
|
|
14579
14976
|
});
|
|
14580
14977
|
// NOTE(mpatwardhan): When transport is set (either 1st time of after vms failover)
|
|
14581
|
-
// resend all track states.
|
|
14582
|
-
|
|
14583
|
-
var trackState = _this._trackSidsToRenderHints.get(trackSid);
|
|
14584
|
-
if (trackState.renderDimensions) {
|
|
14585
|
-
trackState.isDimensionDirty = true;
|
|
14586
|
-
}
|
|
14587
|
-
if ('enabled' in trackState) {
|
|
14588
|
-
trackState.isEnabledDirty = true;
|
|
14589
|
-
}
|
|
14590
|
-
});
|
|
14591
|
-
_this._sendHints();
|
|
14978
|
+
// resend all track states.
|
|
14979
|
+
_this._sendAllHints();
|
|
14592
14980
|
});
|
|
14593
14981
|
return _this;
|
|
14594
14982
|
}
|
|
14983
|
+
RenderHintsSignaling.prototype._sendAllHints = function () {
|
|
14984
|
+
var _this = this;
|
|
14985
|
+
// to force sending all hints simply mark all tracks as dirty.
|
|
14986
|
+
Array.from(this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {
|
|
14987
|
+
var trackState = _this._trackSidsToRenderHints.get(trackSid);
|
|
14988
|
+
if (trackState.renderDimensions) {
|
|
14989
|
+
trackState.isDimensionDirty = true;
|
|
14990
|
+
}
|
|
14991
|
+
if ('enabled' in trackState) {
|
|
14992
|
+
trackState.isEnabledDirty = true;
|
|
14993
|
+
}
|
|
14994
|
+
});
|
|
14995
|
+
this._sendHints();
|
|
14996
|
+
};
|
|
14595
14997
|
RenderHintsSignaling.prototype._processHintResults = function (hintResults) {
|
|
14596
14998
|
var _this = this;
|
|
14597
|
-
this.
|
|
14999
|
+
this._responseTimer.clear();
|
|
15000
|
+
this._responseTimer.setDelay(RENDER_HINT_RESPONSE_TIME_MS);
|
|
14598
15001
|
hintResults.forEach(function (hintResult) {
|
|
14599
15002
|
if (hintResult.result !== 'OK') {
|
|
14600
15003
|
_this._log.debug('Server error processing hint:', hintResult);
|
|
@@ -14604,7 +15007,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
|
14604
15007
|
};
|
|
14605
15008
|
RenderHintsSignaling.prototype._sendHints = function () {
|
|
14606
15009
|
var _this = this;
|
|
14607
|
-
if (!this._transport || this.
|
|
15010
|
+
if (!this._transport || this._responseTimer.isSet) {
|
|
14608
15011
|
return;
|
|
14609
15012
|
}
|
|
14610
15013
|
var hints = [];
|
|
@@ -14636,7 +15039,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
|
14636
15039
|
};
|
|
14637
15040
|
this._log.debug('Outgoing: ', payLoad);
|
|
14638
15041
|
this._transport.publish(payLoad);
|
|
14639
|
-
this.
|
|
15042
|
+
this._responseTimer.start();
|
|
14640
15043
|
}
|
|
14641
15044
|
};
|
|
14642
15045
|
/**
|
|
@@ -14668,7 +15071,8 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
|
|
|
14668
15071
|
}(MediaSignaling));
|
|
14669
15072
|
module.exports = RenderHintsSignaling;
|
|
14670
15073
|
|
|
14671
|
-
},{"../../util":
|
|
15074
|
+
},{"../../util":127,"../../util/timeout":141,"./mediasignaling":71}],81:[function(require,module,exports){
|
|
15075
|
+
/* eslint-disable no-console */
|
|
14672
15076
|
'use strict';
|
|
14673
15077
|
var __extends = (this && this.__extends) || (function () {
|
|
14674
15078
|
var extendStatics = function (d, b) {
|
|
@@ -14711,6 +15115,7 @@ var StatsReport = require('../../stats/statsreport');
|
|
|
14711
15115
|
var TrackPrioritySignaling = require('./trackprioritysignaling');
|
|
14712
15116
|
var TrackSwitchOffSignaling = require('./trackswitchoffsignaling');
|
|
14713
15117
|
var RenderHintsSignaling = require('./renderhintssignaling');
|
|
15118
|
+
var PublisherHintsSignaling = require('./publisherhintsignaling.js');
|
|
14714
15119
|
var _a = require('../../util'), DEFAULT_SESSION_TIMEOUT_SEC = _a.constants.DEFAULT_SESSION_TIMEOUT_SEC, createBandwidthProfilePayload = _a.createBandwidthProfilePayload, defer = _a.defer, difference = _a.difference, filterObject = _a.filterObject, flatMap = _a.flatMap, oncePerTick = _a.oncePerTick;
|
|
14715
15120
|
var MovingAverageDelta = require('../../util/movingaveragedelta');
|
|
14716
15121
|
var createTwilioError = require('../../util/twilio-video-errors').createTwilioError;
|
|
@@ -14792,6 +15197,9 @@ var RoomV2 = /** @class */ (function (_super) {
|
|
|
14792
15197
|
_renderHintsSignaling: {
|
|
14793
15198
|
value: new RenderHintsSignaling(getTrackReceiver, { log: log }),
|
|
14794
15199
|
},
|
|
15200
|
+
_publisherHintsSignaling: {
|
|
15201
|
+
value: new PublisherHintsSignaling(getTrackReceiver, { log: log }),
|
|
15202
|
+
},
|
|
14795
15203
|
_trackPrioritySignaling: {
|
|
14796
15204
|
value: new options.TrackPrioritySignaling(getTrackReceiver, { log: log }),
|
|
14797
15205
|
},
|
|
@@ -14815,11 +15223,15 @@ var RoomV2 = /** @class */ (function (_super) {
|
|
|
14815
15223
|
_this._initTrackSwitchOffSignaling();
|
|
14816
15224
|
_this._initDominantSpeakerSignaling();
|
|
14817
15225
|
_this._initNetworkQualityMonitorSignaling();
|
|
15226
|
+
_this._initPublisherHintSignaling();
|
|
14818
15227
|
handleLocalParticipantEvents(_this, localParticipant);
|
|
14819
15228
|
handlePeerConnectionEvents(_this, peerConnectionManager);
|
|
14820
15229
|
handleTransportEvents(_this, transport);
|
|
14821
15230
|
periodicallyPublishStats(_this, transport, options.statsPublishIntervalMs);
|
|
14822
15231
|
_this._update(initialState);
|
|
15232
|
+
// NOTE(mpatwardhan) after initial state we know if publisher_hints are enabled or not
|
|
15233
|
+
// if they are not enabled. we need to undo simulcast that if it was enabled with initial offer.
|
|
15234
|
+
_this._peerConnectionManager.setEffectiveAdaptiveSimulcast(_this._publisherHintsSignaling.isSetup);
|
|
14823
15235
|
return _this;
|
|
14824
15236
|
}
|
|
14825
15237
|
Object.defineProperty(RoomV2.prototype, "connectionState", {
|
|
@@ -15073,7 +15485,8 @@ var RoomV2 = /** @class */ (function (_super) {
|
|
|
15073
15485
|
this._networkQualitySignaling,
|
|
15074
15486
|
this._trackPrioritySignaling,
|
|
15075
15487
|
this._trackSwitchOffSignaling,
|
|
15076
|
-
this._renderHintsSignaling
|
|
15488
|
+
this._renderHintsSignaling,
|
|
15489
|
+
this._publisherHintsSignaling
|
|
15077
15490
|
].forEach(function (mediaSignaling) {
|
|
15078
15491
|
var channel = mediaSignaling.channel;
|
|
15079
15492
|
if (!mediaSignaling.isSetup
|
|
@@ -15086,6 +15499,28 @@ var RoomV2 = /** @class */ (function (_super) {
|
|
|
15086
15499
|
});
|
|
15087
15500
|
return this;
|
|
15088
15501
|
};
|
|
15502
|
+
RoomV2.prototype._initPublisherHintSignaling = function () {
|
|
15503
|
+
var _this = this;
|
|
15504
|
+
this._publisherHintsSignaling.on('updated', function (hints, id) {
|
|
15505
|
+
Promise.all(hints.map(function (hint) {
|
|
15506
|
+
return _this.localParticipant.setPublisherHint(hint.track, hint.encodings).then(function (result) {
|
|
15507
|
+
return { track: hint.track, result: result };
|
|
15508
|
+
});
|
|
15509
|
+
})).then(function (hintResponses) {
|
|
15510
|
+
_this._publisherHintsSignaling.sendHintResponse({ id: id, hints: hintResponses });
|
|
15511
|
+
});
|
|
15512
|
+
});
|
|
15513
|
+
var handleReplaced = function (track) {
|
|
15514
|
+
if (track.kind === 'video') {
|
|
15515
|
+
track.trackTransceiver.on('replaced', function () {
|
|
15516
|
+
_this._publisherHintsSignaling.sendTrackReplaced({ trackSid: track.sid });
|
|
15517
|
+
});
|
|
15518
|
+
}
|
|
15519
|
+
};
|
|
15520
|
+
// hook up for any existing and new tracks getting replaced.
|
|
15521
|
+
Array.from(this.localParticipant.tracks.values()).forEach(function (track) { return handleReplaced(track); });
|
|
15522
|
+
this.localParticipant.on('trackAdded', function (track) { return handleReplaced(track); });
|
|
15523
|
+
};
|
|
15089
15524
|
RoomV2.prototype._initTrackSwitchOffSignaling = function () {
|
|
15090
15525
|
var _this = this;
|
|
15091
15526
|
this._trackSwitchOffSignaling.on('updated', function (tracksOff, tracksOn) {
|
|
@@ -15478,7 +15913,7 @@ function replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {
|
|
|
15478
15913
|
}
|
|
15479
15914
|
module.exports = RoomV2;
|
|
15480
15915
|
|
|
15481
|
-
},{"../../stats/statsreport":
|
|
15916
|
+
},{"../../stats/statsreport":113,"../../util":127,"../../util/movingaveragedelta":132,"../../util/twilio-video-errors":142,"../room":62,"./dominantspeakersignaling":65,"./networkqualitymonitor":72,"./networkqualitysignaling":73,"./publisherhintsignaling.js":76,"./recording":77,"./remoteparticipant":78,"./renderhintssignaling":80,"./trackprioritysignaling":82,"./trackswitchoffsignaling":83}],82:[function(require,module,exports){
|
|
15482
15917
|
'use strict';
|
|
15483
15918
|
var __extends = (this && this.__extends) || (function () {
|
|
15484
15919
|
var extendStatics = function (d, b) {
|
|
@@ -15544,7 +15979,7 @@ var TrackPrioritySignaling = /** @class */ (function (_super) {
|
|
|
15544
15979
|
}(MediaSignaling));
|
|
15545
15980
|
module.exports = TrackPrioritySignaling;
|
|
15546
15981
|
|
|
15547
|
-
},{"./mediasignaling":71}],
|
|
15982
|
+
},{"./mediasignaling":71}],83:[function(require,module,exports){
|
|
15548
15983
|
'use strict';
|
|
15549
15984
|
var __extends = (this && this.__extends) || (function () {
|
|
15550
15985
|
var extendStatics = function (d, b) {
|
|
@@ -15602,7 +16037,7 @@ var TrackSwitchOffSignaling = /** @class */ (function (_super) {
|
|
|
15602
16037
|
*/
|
|
15603
16038
|
module.exports = TrackSwitchOffSignaling;
|
|
15604
16039
|
|
|
15605
|
-
},{"./mediasignaling":71}],
|
|
16040
|
+
},{"./mediasignaling":71}],84:[function(require,module,exports){
|
|
15606
16041
|
'use strict';
|
|
15607
16042
|
var __extends = (this && this.__extends) || (function () {
|
|
15608
16043
|
var extendStatics = function (d, b) {
|
|
@@ -15619,13 +16054,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15619
16054
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15620
16055
|
};
|
|
15621
16056
|
})();
|
|
15622
|
-
var getSdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat;
|
|
15623
16057
|
var StateMachine = require('../../statemachine');
|
|
15624
16058
|
var TwilioConnection = require('../../twilioconnection');
|
|
15625
16059
|
var DefaultBackoff = require('backoff');
|
|
15626
16060
|
var reconnectBackoffConfig = require('../../util/constants').reconnectBackoffConfig;
|
|
15627
16061
|
var Timeout = require('../../util/timeout');
|
|
15628
|
-
var _a = require('../../util/constants'), SDK_NAME = _a.SDK_NAME, SDK_VERSION = _a.SDK_VERSION;
|
|
16062
|
+
var _a = require('../../util/constants'), SDK_NAME = _a.SDK_NAME, SDK_VERSION = _a.SDK_VERSION, SDP_FORMAT = _a.SDP_FORMAT;
|
|
15629
16063
|
var _b = require('../../util'), createBandwidthProfilePayload = _b.createBandwidthProfilePayload, createMediaSignalingPayload = _b.createMediaSignalingPayload, createSubscribePayload = _b.createSubscribePayload, getUserAgent = _b.getUserAgent, isNonArrayObject = _b.isNonArrayObject;
|
|
15630
16064
|
var _c = require('../../util/twilio-video-errors'), createTwilioError = _c.createTwilioError, RoomCompletedError = _c.RoomCompletedError, SignalingConnectionError = _c.SignalingConnectionError, SignalingServerBusyError = _c.SignalingServerBusyError;
|
|
15631
16065
|
var ICE_VERSION = 1;
|
|
@@ -15692,7 +16126,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
|
|
|
15692
16126
|
Backoff: DefaultBackoff,
|
|
15693
16127
|
TwilioConnection: TwilioConnection,
|
|
15694
16128
|
iceServers: null,
|
|
15695
|
-
sdpFormat: getSdpFormat(options.sdpSemantics),
|
|
15696
16129
|
trackPriority: true,
|
|
15697
16130
|
trackSwitchOff: true,
|
|
15698
16131
|
renderHints: true,
|
|
@@ -15712,6 +16145,9 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
|
|
|
15712
16145
|
_dominantSpeaker: {
|
|
15713
16146
|
value: options.dominantSpeaker
|
|
15714
16147
|
},
|
|
16148
|
+
_adaptiveSimulcast: {
|
|
16149
|
+
value: options.adaptiveSimulcast
|
|
16150
|
+
},
|
|
15715
16151
|
_eventObserver: {
|
|
15716
16152
|
value: options.eventObserver,
|
|
15717
16153
|
writable: false
|
|
@@ -15817,12 +16253,9 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
|
|
|
15817
16253
|
if (this._bandwidthProfile) {
|
|
15818
16254
|
message.bandwidth_profile = createBandwidthProfilePayload(this._bandwidthProfile);
|
|
15819
16255
|
}
|
|
15820
|
-
message.media_signaling = createMediaSignalingPayload(this._dominantSpeaker, this._networkQuality, this._trackPriority, this._trackSwitchOff, this._renderHints);
|
|
16256
|
+
message.media_signaling = createMediaSignalingPayload(this._dominantSpeaker, this._networkQuality, this._trackPriority, this._trackSwitchOff, this._adaptiveSimulcast, this._renderHints);
|
|
15821
16257
|
message.subscribe = createSubscribePayload(this._automaticSubscription);
|
|
15822
|
-
|
|
15823
|
-
if (sdpFormat) {
|
|
15824
|
-
message.format = sdpFormat;
|
|
15825
|
-
}
|
|
16258
|
+
message.format = SDP_FORMAT;
|
|
15826
16259
|
message.token = this._accessToken;
|
|
15827
16260
|
}
|
|
15828
16261
|
else if (message.type === 'sync') {
|
|
@@ -16185,7 +16618,7 @@ function setupTransport(transport) {
|
|
|
16185
16618
|
}
|
|
16186
16619
|
module.exports = TwilioConnectionTransport;
|
|
16187
16620
|
|
|
16188
|
-
},{"../../statemachine":
|
|
16621
|
+
},{"../../statemachine":85,"../../twilioconnection":117,"../../util":127,"../../util/constants":121,"../../util/timeout":141,"../../util/twilio-video-errors":142,"backoff":169}],85:[function(require,module,exports){
|
|
16189
16622
|
'use strict';
|
|
16190
16623
|
var __extends = (this && this.__extends) || (function () {
|
|
16191
16624
|
var extendStatics = function (d, b) {
|
|
@@ -16631,7 +17064,7 @@ function createUnreachableError(here, there) {
|
|
|
16631
17064
|
}
|
|
16632
17065
|
module.exports = StateMachine;
|
|
16633
17066
|
|
|
16634
|
-
},{"./util":
|
|
17067
|
+
},{"./util":127,"events":178}],86:[function(require,module,exports){
|
|
16635
17068
|
/* eslint no-undefined:0 */
|
|
16636
17069
|
'use strict';
|
|
16637
17070
|
/**
|
|
@@ -16644,7 +17077,7 @@ function average(xs) {
|
|
|
16644
17077
|
}
|
|
16645
17078
|
module.exports = average;
|
|
16646
17079
|
|
|
16647
|
-
},{}],
|
|
17080
|
+
},{}],87:[function(require,module,exports){
|
|
16648
17081
|
'use strict';
|
|
16649
17082
|
/**
|
|
16650
17083
|
* @property {number} [availableSend] - bps (undefined in Firefox)
|
|
@@ -16702,7 +17135,7 @@ var IceReport = /** @class */ (function () {
|
|
|
16702
17135
|
}());
|
|
16703
17136
|
module.exports = IceReport;
|
|
16704
17137
|
|
|
16705
|
-
},{}],
|
|
17138
|
+
},{}],88:[function(require,module,exports){
|
|
16706
17139
|
'use strict';
|
|
16707
17140
|
var IceReport = require('./icereport');
|
|
16708
17141
|
/**
|
|
@@ -16747,7 +17180,7 @@ var IceReportFactory = /** @class */ (function () {
|
|
|
16747
17180
|
}());
|
|
16748
17181
|
module.exports = IceReportFactory;
|
|
16749
17182
|
|
|
16750
|
-
},{"./icereport":
|
|
17183
|
+
},{"./icereport":87}],89:[function(require,module,exports){
|
|
16751
17184
|
'use strict';
|
|
16752
17185
|
var __extends = (this && this.__extends) || (function () {
|
|
16753
17186
|
var extendStatics = function (d, b) {
|
|
@@ -16805,7 +17238,7 @@ var LocalAudioTrackStats = /** @class */ (function (_super) {
|
|
|
16805
17238
|
*/
|
|
16806
17239
|
module.exports = LocalAudioTrackStats;
|
|
16807
17240
|
|
|
16808
|
-
},{"./localtrackstats":
|
|
17241
|
+
},{"./localtrackstats":90}],90:[function(require,module,exports){
|
|
16809
17242
|
'use strict';
|
|
16810
17243
|
var __extends = (this && this.__extends) || (function () {
|
|
16811
17244
|
var extendStatics = function (d, b) {
|
|
@@ -16865,7 +17298,7 @@ var LocalTrackStats = /** @class */ (function (_super) {
|
|
|
16865
17298
|
}(TrackStats));
|
|
16866
17299
|
module.exports = LocalTrackStats;
|
|
16867
17300
|
|
|
16868
|
-
},{"./trackstats":
|
|
17301
|
+
},{"./trackstats":115}],91:[function(require,module,exports){
|
|
16869
17302
|
'use strict';
|
|
16870
17303
|
var __extends = (this && this.__extends) || (function () {
|
|
16871
17304
|
var extendStatics = function (d, b) {
|
|
@@ -16958,7 +17391,7 @@ var LocalVideoTrackStats = /** @class */ (function (_super) {
|
|
|
16958
17391
|
}(LocalTrackStats));
|
|
16959
17392
|
module.exports = LocalVideoTrackStats;
|
|
16960
17393
|
|
|
16961
|
-
},{"./localtrackstats":
|
|
17394
|
+
},{"./localtrackstats":90}],92:[function(require,module,exports){
|
|
16962
17395
|
'use strict';
|
|
16963
17396
|
var __extends = (this && this.__extends) || (function () {
|
|
16964
17397
|
var extendStatics = function (d, b) {
|
|
@@ -16992,7 +17425,7 @@ var NetworkQualityAudioStats = /** @class */ (function (_super) {
|
|
|
16992
17425
|
}(NetworkQualityMediaStats));
|
|
16993
17426
|
module.exports = NetworkQualityAudioStats;
|
|
16994
17427
|
|
|
16995
|
-
},{"./networkqualitymediastats":
|
|
17428
|
+
},{"./networkqualitymediastats":96}],93:[function(require,module,exports){
|
|
16996
17429
|
'use strict';
|
|
16997
17430
|
/**
|
|
16998
17431
|
* Bandwidth network quality statistics.
|
|
@@ -17026,7 +17459,7 @@ var NetworkQualityBandwidthStats = /** @class */ (function () {
|
|
|
17026
17459
|
}());
|
|
17027
17460
|
module.exports = NetworkQualityBandwidthStats;
|
|
17028
17461
|
|
|
17029
|
-
},{}],
|
|
17462
|
+
},{}],94:[function(require,module,exports){
|
|
17030
17463
|
'use strict';
|
|
17031
17464
|
/**
|
|
17032
17465
|
* Fraction lost network quality statistics.
|
|
@@ -17055,7 +17488,7 @@ var NetworkQualityFractionLostStats = /** @class */ (function () {
|
|
|
17055
17488
|
}());
|
|
17056
17489
|
module.exports = NetworkQualityFractionLostStats;
|
|
17057
17490
|
|
|
17058
|
-
},{}],
|
|
17491
|
+
},{}],95:[function(require,module,exports){
|
|
17059
17492
|
'use strict';
|
|
17060
17493
|
/**
|
|
17061
17494
|
* Latency network quality statistics.
|
|
@@ -17089,7 +17522,7 @@ var NetworkQualityLatencyStats = /** @class */ (function () {
|
|
|
17089
17522
|
}());
|
|
17090
17523
|
module.exports = NetworkQualityLatencyStats;
|
|
17091
17524
|
|
|
17092
|
-
},{}],
|
|
17525
|
+
},{}],96:[function(require,module,exports){
|
|
17093
17526
|
'use strict';
|
|
17094
17527
|
var NetworkQualitySendStats = require('./networkqualitysendstats');
|
|
17095
17528
|
var NetworkQualityRecvStats = require('./networkqualityrecvstats');
|
|
@@ -17136,7 +17569,7 @@ var NetworkQualityMediaStats = /** @class */ (function () {
|
|
|
17136
17569
|
}());
|
|
17137
17570
|
module.exports = NetworkQualityMediaStats;
|
|
17138
17571
|
|
|
17139
|
-
},{"./networkqualityrecvstats":
|
|
17572
|
+
},{"./networkqualityrecvstats":97,"./networkqualitysendstats":99}],97:[function(require,module,exports){
|
|
17140
17573
|
'use strict';
|
|
17141
17574
|
var __extends = (this && this.__extends) || (function () {
|
|
17142
17575
|
var extendStatics = function (d, b) {
|
|
@@ -17171,7 +17604,7 @@ var NetworkQualityRecvStats = /** @class */ (function (_super) {
|
|
|
17171
17604
|
}(NetworkQualitySendOrRecvStats));
|
|
17172
17605
|
module.exports = NetworkQualityRecvStats;
|
|
17173
17606
|
|
|
17174
|
-
},{"./networkqualitysendorrecvstats":
|
|
17607
|
+
},{"./networkqualitysendorrecvstats":98}],98:[function(require,module,exports){
|
|
17175
17608
|
'use strict';
|
|
17176
17609
|
var NetworkQualityBandwidthStats = require('./networkqualitybandwidthstats');
|
|
17177
17610
|
var NetworkQualityFractionLostStats = require('./networkqualityfractionloststats');
|
|
@@ -17211,7 +17644,7 @@ var NetworkQualitySendOrRecvStats = /** @class */ (function () {
|
|
|
17211
17644
|
}());
|
|
17212
17645
|
module.exports = NetworkQualitySendOrRecvStats;
|
|
17213
17646
|
|
|
17214
|
-
},{"./networkqualitybandwidthstats":
|
|
17647
|
+
},{"./networkqualitybandwidthstats":93,"./networkqualityfractionloststats":94,"./networkqualitylatencystats":95}],99:[function(require,module,exports){
|
|
17215
17648
|
'use strict';
|
|
17216
17649
|
var __extends = (this && this.__extends) || (function () {
|
|
17217
17650
|
var extendStatics = function (d, b) {
|
|
@@ -17246,7 +17679,7 @@ var NetworkQualitySendStats = /** @class */ (function (_super) {
|
|
|
17246
17679
|
}(NetworkQualitySendOrRecvStats));
|
|
17247
17680
|
module.exports = NetworkQualitySendStats;
|
|
17248
17681
|
|
|
17249
|
-
},{"./networkqualitysendorrecvstats":
|
|
17682
|
+
},{"./networkqualitysendorrecvstats":98}],100:[function(require,module,exports){
|
|
17250
17683
|
'use strict';
|
|
17251
17684
|
var NetworkQualityAudioStats = require('./networkqualityaudiostats');
|
|
17252
17685
|
var NetworkQualityVideoStats = require('./networkqualityvideostats');
|
|
@@ -17286,7 +17719,7 @@ var NetworkQualityStats = /** @class */ (function () {
|
|
|
17286
17719
|
}());
|
|
17287
17720
|
module.exports = NetworkQualityStats;
|
|
17288
17721
|
|
|
17289
|
-
},{"./networkqualityaudiostats":
|
|
17722
|
+
},{"./networkqualityaudiostats":92,"./networkqualityvideostats":101}],101:[function(require,module,exports){
|
|
17290
17723
|
'use strict';
|
|
17291
17724
|
var __extends = (this && this.__extends) || (function () {
|
|
17292
17725
|
var extendStatics = function (d, b) {
|
|
@@ -17320,7 +17753,7 @@ var NetworkQualityVideoStats = /** @class */ (function (_super) {
|
|
|
17320
17753
|
}(NetworkQualityMediaStats));
|
|
17321
17754
|
module.exports = NetworkQualityVideoStats;
|
|
17322
17755
|
|
|
17323
|
-
},{"./networkqualitymediastats":
|
|
17756
|
+
},{"./networkqualitymediastats":96}],102:[function(require,module,exports){
|
|
17324
17757
|
'use strict';
|
|
17325
17758
|
var ReceiverReport = require('./receiverreport');
|
|
17326
17759
|
var SenderReport = require('./senderreport');
|
|
@@ -17398,7 +17831,7 @@ var PeerConnectionReport = /** @class */ (function () {
|
|
|
17398
17831
|
}());
|
|
17399
17832
|
module.exports = PeerConnectionReport;
|
|
17400
17833
|
|
|
17401
|
-
},{"./receiverreport":
|
|
17834
|
+
},{"./receiverreport":104,"./senderreport":111}],103:[function(require,module,exports){
|
|
17402
17835
|
'use strict';
|
|
17403
17836
|
var __read = (this && this.__read) || function (o, n) {
|
|
17404
17837
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -17828,7 +18261,7 @@ function updateChrome(factory) {
|
|
|
17828
18261
|
}
|
|
17829
18262
|
module.exports = PeerConnectionReportFactory;
|
|
17830
18263
|
|
|
17831
|
-
},{"./icereportfactory":
|
|
18264
|
+
},{"./icereportfactory":88,"./peerconnectionreport":102,"./receiverreportfactory":105,"./senderreportfactory":112,"@twilio/webrtc/lib/util":164}],104:[function(require,module,exports){
|
|
17832
18265
|
'use strict';
|
|
17833
18266
|
var __extends = (this && this.__extends) || (function () {
|
|
17834
18267
|
var extendStatics = function (d, b) {
|
|
@@ -17954,7 +18387,7 @@ var ReceiverReport = /** @class */ (function (_super) {
|
|
|
17954
18387
|
}(SenderOrReceiverReport));
|
|
17955
18388
|
module.exports = ReceiverReport;
|
|
17956
18389
|
|
|
17957
|
-
},{"./average":
|
|
18390
|
+
},{"./average":86,"./senderorreceiverreport":109,"./sum":114}],105:[function(require,module,exports){
|
|
17958
18391
|
'use strict';
|
|
17959
18392
|
var __extends = (this && this.__extends) || (function () {
|
|
17960
18393
|
var extendStatics = function (d, b) {
|
|
@@ -18013,7 +18446,7 @@ var ReceiverReportFactory = /** @class */ (function (_super) {
|
|
|
18013
18446
|
}(SenderOrReceiverReportFactory));
|
|
18014
18447
|
module.exports = ReceiverReportFactory;
|
|
18015
18448
|
|
|
18016
|
-
},{"./receiverreport":
|
|
18449
|
+
},{"./receiverreport":104,"./senderorreceiverreportfactory":110}],106:[function(require,module,exports){
|
|
18017
18450
|
'use strict';
|
|
18018
18451
|
var __extends = (this && this.__extends) || (function () {
|
|
18019
18452
|
var extendStatics = function (d, b) {
|
|
@@ -18065,7 +18498,7 @@ var RemoteAudioTrackStats = /** @class */ (function (_super) {
|
|
|
18065
18498
|
}(RemoteTrackStats));
|
|
18066
18499
|
module.exports = RemoteAudioTrackStats;
|
|
18067
18500
|
|
|
18068
|
-
},{"./remotetrackstats":
|
|
18501
|
+
},{"./remotetrackstats":107}],107:[function(require,module,exports){
|
|
18069
18502
|
'use strict';
|
|
18070
18503
|
var __extends = (this && this.__extends) || (function () {
|
|
18071
18504
|
var extendStatics = function (d, b) {
|
|
@@ -18117,7 +18550,7 @@ var RemoteTrackStats = /** @class */ (function (_super) {
|
|
|
18117
18550
|
}(TrackStats));
|
|
18118
18551
|
module.exports = RemoteTrackStats;
|
|
18119
18552
|
|
|
18120
|
-
},{"./trackstats":
|
|
18553
|
+
},{"./trackstats":115}],108:[function(require,module,exports){
|
|
18121
18554
|
'use strict';
|
|
18122
18555
|
var __extends = (this && this.__extends) || (function () {
|
|
18123
18556
|
var extendStatics = function (d, b) {
|
|
@@ -18182,7 +18615,7 @@ var RemoteVideoTrackStats = /** @class */ (function (_super) {
|
|
|
18182
18615
|
}(RemoteTrackStats));
|
|
18183
18616
|
module.exports = RemoteVideoTrackStats;
|
|
18184
18617
|
|
|
18185
|
-
},{"./remotetrackstats":
|
|
18618
|
+
},{"./remotetrackstats":107}],109:[function(require,module,exports){
|
|
18186
18619
|
'use strict';
|
|
18187
18620
|
/**
|
|
18188
18621
|
* @property {StatsId} id
|
|
@@ -18216,7 +18649,7 @@ var SenderOrReceiverReport = /** @class */ (function () {
|
|
|
18216
18649
|
}());
|
|
18217
18650
|
module.exports = SenderOrReceiverReport;
|
|
18218
18651
|
|
|
18219
|
-
},{}],
|
|
18652
|
+
},{}],110:[function(require,module,exports){
|
|
18220
18653
|
'use strict';
|
|
18221
18654
|
/**
|
|
18222
18655
|
* @property {StatsId} id
|
|
@@ -18252,7 +18685,7 @@ var SenderOrReceiverReportFactory = /** @class */ (function () {
|
|
|
18252
18685
|
}());
|
|
18253
18686
|
module.exports = SenderOrReceiverReportFactory;
|
|
18254
18687
|
|
|
18255
|
-
},{}],
|
|
18688
|
+
},{}],111:[function(require,module,exports){
|
|
18256
18689
|
/* eslint no-undefined:0 */
|
|
18257
18690
|
'use strict';
|
|
18258
18691
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -18340,7 +18773,7 @@ var SenderReport = /** @class */ (function (_super) {
|
|
|
18340
18773
|
}(SenderOrReceiverReport));
|
|
18341
18774
|
module.exports = SenderReport;
|
|
18342
18775
|
|
|
18343
|
-
},{"./average":
|
|
18776
|
+
},{"./average":86,"./senderorreceiverreport":109,"./sum":114}],112:[function(require,module,exports){
|
|
18344
18777
|
'use strict';
|
|
18345
18778
|
var __extends = (this && this.__extends) || (function () {
|
|
18346
18779
|
var extendStatics = function (d, b) {
|
|
@@ -18399,7 +18832,7 @@ var SenderReportFactory = /** @class */ (function (_super) {
|
|
|
18399
18832
|
}(SenderOrReceiverReportFactory));
|
|
18400
18833
|
module.exports = SenderReportFactory;
|
|
18401
18834
|
|
|
18402
|
-
},{"./senderorreceiverreportfactory":
|
|
18835
|
+
},{"./senderorreceiverreportfactory":110,"./senderreport":111}],113:[function(require,module,exports){
|
|
18403
18836
|
'use strict';
|
|
18404
18837
|
var LocalAudioTrackStats = require('./localaudiotrackstats');
|
|
18405
18838
|
var LocalVideoTrackStats = require('./localvideotrackstats');
|
|
@@ -18450,7 +18883,7 @@ var StatsReport = /** @class */ (function () {
|
|
|
18450
18883
|
}());
|
|
18451
18884
|
module.exports = StatsReport;
|
|
18452
18885
|
|
|
18453
|
-
},{"./localaudiotrackstats":
|
|
18886
|
+
},{"./localaudiotrackstats":89,"./localvideotrackstats":91,"./remoteaudiotrackstats":106,"./remotevideotrackstats":108}],114:[function(require,module,exports){
|
|
18454
18887
|
'use strict';
|
|
18455
18888
|
/**
|
|
18456
18889
|
* @param {Array<number|undefined>} xs
|
|
@@ -18461,7 +18894,7 @@ function sum(xs) {
|
|
|
18461
18894
|
}
|
|
18462
18895
|
module.exports = sum;
|
|
18463
18896
|
|
|
18464
|
-
},{}],
|
|
18897
|
+
},{}],115:[function(require,module,exports){
|
|
18465
18898
|
'use strict';
|
|
18466
18899
|
/**
|
|
18467
18900
|
* Statistics for a {@link Track}.
|
|
@@ -18520,7 +18953,7 @@ var TrackStats = /** @class */ (function () {
|
|
|
18520
18953
|
}());
|
|
18521
18954
|
module.exports = TrackStats;
|
|
18522
18955
|
|
|
18523
|
-
},{}],
|
|
18956
|
+
},{}],116:[function(require,module,exports){
|
|
18524
18957
|
'use strict';
|
|
18525
18958
|
var __extends = (this && this.__extends) || (function () {
|
|
18526
18959
|
var extendStatics = function (d, b) {
|
|
@@ -18582,7 +19015,7 @@ var TrackTransceiver = /** @class */ (function (_super) {
|
|
|
18582
19015
|
*/
|
|
18583
19016
|
module.exports = TrackTransceiver;
|
|
18584
19017
|
|
|
18585
|
-
},{"events":
|
|
19018
|
+
},{"events":178}],117:[function(require,module,exports){
|
|
18586
19019
|
(function (global){(function (){
|
|
18587
19020
|
'use strict';
|
|
18588
19021
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -19237,7 +19670,7 @@ TwilioConnection.CloseReason = CloseReason;
|
|
|
19237
19670
|
module.exports = TwilioConnection;
|
|
19238
19671
|
|
|
19239
19672
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
19240
|
-
},{"./statemachine":
|
|
19673
|
+
},{"./statemachine":85,"./util":127,"./util/log":131,"./util/networkmonitor":133,"./util/timeout":141,"ws":200}],118:[function(require,module,exports){
|
|
19241
19674
|
'use strict';
|
|
19242
19675
|
var defer = require('./').defer;
|
|
19243
19676
|
/**
|
|
@@ -19302,7 +19735,7 @@ var AsyncVar = /** @class */ (function () {
|
|
|
19302
19735
|
}());
|
|
19303
19736
|
module.exports = AsyncVar;
|
|
19304
19737
|
|
|
19305
|
-
},{"./":
|
|
19738
|
+
},{"./":127}],119:[function(require,module,exports){
|
|
19306
19739
|
/* globals chrome, navigator */
|
|
19307
19740
|
'use strict';
|
|
19308
19741
|
var __read = (this && this.__read) || function (o, n) {
|
|
@@ -19433,7 +19866,7 @@ module.exports = {
|
|
|
19433
19866
|
rebrandedChromeBrowser: rebrandedChromeBrowser
|
|
19434
19867
|
};
|
|
19435
19868
|
|
|
19436
|
-
},{}],
|
|
19869
|
+
},{}],120:[function(require,module,exports){
|
|
19437
19870
|
'use strict';
|
|
19438
19871
|
var __read = (this && this.__read) || function (o, n) {
|
|
19439
19872
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -19561,15 +19994,27 @@ var CancelablePromise = /** @class */ (function () {
|
|
|
19561
19994
|
promise.then.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);
|
|
19562
19995
|
}, this._onCancel);
|
|
19563
19996
|
};
|
|
19997
|
+
/**
|
|
19998
|
+
* @param {?function} onFinally
|
|
19999
|
+
* @returns {CancelablePromise}
|
|
20000
|
+
*/
|
|
20001
|
+
CancelablePromise.prototype.finally = function () {
|
|
20002
|
+
var args = [].slice.call(arguments);
|
|
20003
|
+
var promise = this._promise;
|
|
20004
|
+
return new CancelablePromise(function onCreate(resolve, reject) {
|
|
20005
|
+
promise.finally.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);
|
|
20006
|
+
}, this._onCancel);
|
|
20007
|
+
};
|
|
19564
20008
|
return CancelablePromise;
|
|
19565
20009
|
}());
|
|
19566
20010
|
module.exports = CancelablePromise;
|
|
19567
20011
|
|
|
19568
|
-
},{}],
|
|
20012
|
+
},{}],121:[function(require,module,exports){
|
|
19569
20013
|
'use strict';
|
|
19570
20014
|
var packageInfo = require('../../package.json');
|
|
19571
20015
|
module.exports.SDK_NAME = packageInfo.name + ".js";
|
|
19572
20016
|
module.exports.SDK_VERSION = packageInfo.version;
|
|
20017
|
+
module.exports.SDP_FORMAT = 'unified';
|
|
19573
20018
|
module.exports.DEFAULT_ENVIRONMENT = 'prod';
|
|
19574
20019
|
module.exports.DEFAULT_REALM = 'us1';
|
|
19575
20020
|
module.exports.DEFAULT_REGION = 'gll';
|
|
@@ -19653,7 +20098,7 @@ module.exports.videoContentPreferencesMode = {
|
|
|
19653
20098
|
MODE_MANUAL: 'manual'
|
|
19654
20099
|
};
|
|
19655
20100
|
|
|
19656
|
-
},{"../../package.json":
|
|
20101
|
+
},{"../../package.json":199}],122:[function(require,module,exports){
|
|
19657
20102
|
'use strict';
|
|
19658
20103
|
var detectSilence = require('../webaudio/detectsilence');
|
|
19659
20104
|
var N_ATTEMPTS = 3;
|
|
@@ -19694,7 +20139,7 @@ function detectSilentAudio(el) {
|
|
|
19694
20139
|
}
|
|
19695
20140
|
module.exports = detectSilentAudio;
|
|
19696
20141
|
|
|
19697
|
-
},{"../webaudio/audiocontext":
|
|
20142
|
+
},{"../webaudio/audiocontext":146,"../webaudio/detectsilence":147}],123:[function(require,module,exports){
|
|
19698
20143
|
'use strict';
|
|
19699
20144
|
// Cached copy of the <canvas> used to check silent video frames.
|
|
19700
20145
|
var canvas = null;
|
|
@@ -19753,7 +20198,7 @@ function detectSilentVideo(el) {
|
|
|
19753
20198
|
}
|
|
19754
20199
|
module.exports = detectSilentVideo;
|
|
19755
20200
|
|
|
19756
|
-
},{}],
|
|
20201
|
+
},{}],124:[function(require,module,exports){
|
|
19757
20202
|
'use strict';
|
|
19758
20203
|
/**
|
|
19759
20204
|
* The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM
|
|
@@ -19875,7 +20320,7 @@ var DocumentVisibilityMonitor = /** @class */ (function () {
|
|
|
19875
20320
|
}());
|
|
19876
20321
|
module.exports = new DocumentVisibilityMonitor(2);
|
|
19877
20322
|
|
|
19878
|
-
},{}],
|
|
20323
|
+
},{}],125:[function(require,module,exports){
|
|
19879
20324
|
/* eslint-disable no-console */
|
|
19880
20325
|
'use strict';
|
|
19881
20326
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -19973,7 +20418,7 @@ var EventObserver = /** @class */ (function (_super) {
|
|
|
19973
20418
|
*/
|
|
19974
20419
|
module.exports = EventObserver;
|
|
19975
20420
|
|
|
19976
|
-
},{"events":
|
|
20421
|
+
},{"events":178}],126:[function(require,module,exports){
|
|
19977
20422
|
'use strict';
|
|
19978
20423
|
var Filter = /** @class */ (function () {
|
|
19979
20424
|
function Filter(options) {
|
|
@@ -20017,7 +20462,7 @@ var Filter = /** @class */ (function () {
|
|
|
20017
20462
|
}());
|
|
20018
20463
|
module.exports = Filter;
|
|
20019
20464
|
|
|
20020
|
-
},{}],
|
|
20465
|
+
},{}],127:[function(require,module,exports){
|
|
20021
20466
|
'use strict';
|
|
20022
20467
|
var __extends = (this && this.__extends) || (function () {
|
|
20023
20468
|
var extendStatics = function (d, b) {
|
|
@@ -20622,13 +21067,27 @@ function createRoomConnectEventPayload(connectOptions) {
|
|
|
20622
21067
|
eventProp = eventProp || prop;
|
|
20623
21068
|
payload[eventProp] = boolToString(!!connectOptions[prop]);
|
|
20624
21069
|
});
|
|
20625
|
-
// numbers
|
|
20626
|
-
[['maxVideoBitrate'], ['maxAudioBitrate']
|
|
21070
|
+
// numbers properties.
|
|
21071
|
+
[['maxVideoBitrate'], ['maxAudioBitrate']].forEach(function (_a) {
|
|
20627
21072
|
var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
|
|
20628
21073
|
eventProp = eventProp || prop;
|
|
20629
|
-
if (typeof connectOptions[prop] === 'number'
|
|
21074
|
+
if (typeof connectOptions[prop] === 'number') {
|
|
20630
21075
|
payload[eventProp] = connectOptions[prop];
|
|
20631
21076
|
}
|
|
21077
|
+
else if (!isNaN(Number(connectOptions[prop]))) {
|
|
21078
|
+
payload[eventProp] = Number(connectOptions[prop]);
|
|
21079
|
+
}
|
|
21080
|
+
});
|
|
21081
|
+
// string properties.
|
|
21082
|
+
[['iceTransportPolicy'], ['region'], ['name', 'roomName']].forEach(function (_a) {
|
|
21083
|
+
var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
|
|
21084
|
+
eventProp = eventProp || prop;
|
|
21085
|
+
if (typeof connectOptions[prop] === 'string') {
|
|
21086
|
+
payload[eventProp] = connectOptions[prop];
|
|
21087
|
+
}
|
|
21088
|
+
else if (typeof connectOptions[prop] === 'number' && prop === 'name') {
|
|
21089
|
+
payload[eventProp] = connectOptions[prop].toString();
|
|
21090
|
+
}
|
|
20632
21091
|
});
|
|
20633
21092
|
// array props stringified.
|
|
20634
21093
|
['preferredAudioCodecs', 'preferredVideoCodecs'].forEach(function (prop) {
|
|
@@ -20711,7 +21170,7 @@ function createBandwidthProfileVideoPayload(bandwidthProfileVideo) {
|
|
|
20711
21170
|
* protocol or not.
|
|
20712
21171
|
* @returns {object}
|
|
20713
21172
|
*/
|
|
20714
|
-
function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, renderHints) {
|
|
21173
|
+
function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, adaptiveSimulcast, renderHints) {
|
|
20715
21174
|
var transports = { transports: [{ type: 'data-channel' }] };
|
|
20716
21175
|
return Object.assign(dominantSpeaker
|
|
20717
21176
|
// eslint-disable-next-line
|
|
@@ -20722,6 +21181,9 @@ function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPrior
|
|
|
20722
21181
|
: {}, renderHints
|
|
20723
21182
|
// eslint-disable-next-line
|
|
20724
21183
|
? { render_hints: transports }
|
|
21184
|
+
: {}, adaptiveSimulcast
|
|
21185
|
+
// eslint-disable-next-line
|
|
21186
|
+
? { publisher_hints: transports }
|
|
20725
21187
|
: {}, trackPriority
|
|
20726
21188
|
// eslint-disable-next-line
|
|
20727
21189
|
? { track_priority: transports }
|
|
@@ -20816,8 +21278,7 @@ function inRange(num, min, max) {
|
|
|
20816
21278
|
function isChromeScreenShareTrack(track) {
|
|
20817
21279
|
// NOTE(mpatwardhan): Chrome creates screen share tracks with label like: "screen:69734272*"
|
|
20818
21280
|
// we will check for label that starts with "screen:D" where D being a digit.
|
|
20819
|
-
|
|
20820
|
-
return isChrome && track.kind === 'video' && track.label && (/^screen:[0-9]+/.test(track.label) || /^web-contents-media-stream:[0-9/]+/.test(track.label) || /^window:[0-9]+/.test(track.label));
|
|
21281
|
+
return util.guessBrowser() === 'chrome' && track.kind === 'video' && 'displaySurface' in track.getSettings();
|
|
20821
21282
|
}
|
|
20822
21283
|
/**
|
|
20823
21284
|
* returns true if given MediaStreamTrack is a user media track
|
|
@@ -20887,7 +21348,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
|
|
|
20887
21348
|
exports.waitForSometime = waitForSometime;
|
|
20888
21349
|
exports.waitForEvent = waitForEvent;
|
|
20889
21350
|
|
|
20890
|
-
},{"./constants":
|
|
21351
|
+
},{"./constants":121,"./sid":139,"@twilio/webrtc/lib/util":164}],128:[function(require,module,exports){
|
|
20891
21352
|
(function (global){(function (){
|
|
20892
21353
|
'use strict';
|
|
20893
21354
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -21164,7 +21625,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
|
|
|
21164
21625
|
module.exports = InsightsPublisher;
|
|
21165
21626
|
|
|
21166
21627
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
21167
|
-
},{"..":
|
|
21628
|
+
},{"..":127,"../../util":127,"events":178,"ws":200}],129:[function(require,module,exports){
|
|
21168
21629
|
// eslint-disable-next-line no-warning-comments
|
|
21169
21630
|
// TODO(mroberts): This should be described as implementing some
|
|
21170
21631
|
// InsightsPublisher interface.
|
|
@@ -21209,7 +21670,7 @@ var InsightsPublisher = /** @class */ (function () {
|
|
|
21209
21670
|
}());
|
|
21210
21671
|
module.exports = InsightsPublisher;
|
|
21211
21672
|
|
|
21212
|
-
},{}],
|
|
21673
|
+
},{}],130:[function(require,module,exports){
|
|
21213
21674
|
'use strict';
|
|
21214
21675
|
var defer = require('./').defer;
|
|
21215
21676
|
/**
|
|
@@ -21271,7 +21732,7 @@ var LocalMediaRestartDeferreds = /** @class */ (function () {
|
|
|
21271
21732
|
}());
|
|
21272
21733
|
module.exports = new LocalMediaRestartDeferreds();
|
|
21273
21734
|
|
|
21274
|
-
},{"./":
|
|
21735
|
+
},{"./":127}],131:[function(require,module,exports){
|
|
21275
21736
|
/* eslint new-cap:0 */
|
|
21276
21737
|
'use strict';
|
|
21277
21738
|
var __read = (this && this.__read) || function (o, n) {
|
|
@@ -21558,7 +22019,7 @@ function validateLogLevels(levels) {
|
|
|
21558
22019
|
}
|
|
21559
22020
|
module.exports = Log;
|
|
21560
22021
|
|
|
21561
|
-
},{"../vendor/loglevel":
|
|
22022
|
+
},{"../vendor/loglevel":145,"./constants":121}],132:[function(require,module,exports){
|
|
21562
22023
|
'use strict';
|
|
21563
22024
|
/**
|
|
21564
22025
|
* Calculates the moving average delta for the given pair ofsamples. A sample (S)
|
|
@@ -21605,7 +22066,7 @@ var MovingAverageDelta = /** @class */ (function () {
|
|
|
21605
22066
|
}());
|
|
21606
22067
|
module.exports = MovingAverageDelta;
|
|
21607
22068
|
|
|
21608
|
-
},{}],
|
|
22069
|
+
},{}],133:[function(require,module,exports){
|
|
21609
22070
|
'use strict';
|
|
21610
22071
|
/**
|
|
21611
22072
|
* Monitor the network connection status to detect interruptions and handoffs.
|
|
@@ -21694,7 +22155,7 @@ var NetworkMonitor = /** @class */ (function () {
|
|
|
21694
22155
|
}());
|
|
21695
22156
|
module.exports = NetworkMonitor;
|
|
21696
22157
|
|
|
21697
|
-
},{}],
|
|
22158
|
+
},{}],134:[function(require,module,exports){
|
|
21698
22159
|
/* eslint-disable no-console */
|
|
21699
22160
|
'use strict';
|
|
21700
22161
|
var __extends = (this && this.__extends) || (function () {
|
|
@@ -21757,7 +22218,7 @@ var NullResizeObserver = /** @class */ (function (_super) {
|
|
|
21757
22218
|
}(NullObserver));
|
|
21758
22219
|
module.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };
|
|
21759
22220
|
|
|
21760
|
-
},{}],
|
|
22221
|
+
},{}],135:[function(require,module,exports){
|
|
21761
22222
|
'use strict';
|
|
21762
22223
|
var __read = (this && this.__read) || function (o, n) {
|
|
21763
22224
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -21789,28 +22250,6 @@ var ptToFixedBitrateAudioCodecName = {
|
|
|
21789
22250
|
* An {@link AudioCodec} or {@link VideoCodec}
|
|
21790
22251
|
* @typedef {AudioCodec|VideoCodec} Codec
|
|
21791
22252
|
*/
|
|
21792
|
-
// NOTE(mmalavalli): This value is derived from the IETF spec
|
|
21793
|
-
// for JSEP, and it is used to convert a 'b=TIAS' value in bps
|
|
21794
|
-
// to a 'b=AS' value in kbps.
|
|
21795
|
-
// Spec: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-21#section-5.9
|
|
21796
|
-
var RTCP_BITRATE = 16000;
|
|
21797
|
-
/**
|
|
21798
|
-
* Construct a b= line string for the given max bitrate in bps. If the modifier
|
|
21799
|
-
* is 'AS', then the max bitrate will be converted to kbps using the formula
|
|
21800
|
-
* specified in the IETF spec for JSEP mentioned above.
|
|
21801
|
-
* @param {string} modifier - 'AS' | 'TIAS'
|
|
21802
|
-
* @param {?number} maxBitrate - Max outgoing bitrate (bps)
|
|
21803
|
-
* @returns {?string} - If "maxBitrate" is null, then returns null;
|
|
21804
|
-
* otherwise return the constructed b= line string
|
|
21805
|
-
*/
|
|
21806
|
-
function createBLine(modifier, maxBitrate) {
|
|
21807
|
-
if (!maxBitrate) {
|
|
21808
|
-
return null;
|
|
21809
|
-
}
|
|
21810
|
-
return "\r\nb=" + modifier + ":" + (modifier === 'AS'
|
|
21811
|
-
? Math.round((maxBitrate + RTCP_BITRATE) / 950)
|
|
21812
|
-
: maxBitrate);
|
|
21813
|
-
}
|
|
21814
22253
|
/**
|
|
21815
22254
|
* Create a Codec Map for the given m= section.
|
|
21816
22255
|
* @param {string} section - The given m= section
|
|
@@ -21927,49 +22366,6 @@ function getReorderedPayloadTypes(codecMap, preferredCodecs) {
|
|
|
21927
22366
|
var remainingPayloadTypes = flatMap(remainingCodecs, function (codecName) { return codecMap.get(codecName); });
|
|
21928
22367
|
return preferredPayloadTypes.concat(remainingPayloadTypes);
|
|
21929
22368
|
}
|
|
21930
|
-
/**
|
|
21931
|
-
* Set the specified max bitrate in the given m= section.
|
|
21932
|
-
* @param {string} modifier - 'AS' | 'TIAS'
|
|
21933
|
-
* @param {?number} maxBitrate - Max outgoing bitrate (bps)
|
|
21934
|
-
* @param {string} section - m= section string
|
|
21935
|
-
* @returns {string} The updated m= section
|
|
21936
|
-
*/
|
|
21937
|
-
function setBitrateInMediaSection(modifier, maxBitrate, section) {
|
|
21938
|
-
var bLine = createBLine(modifier, maxBitrate) || '';
|
|
21939
|
-
var bLinePattern = /\r\nb=(AS|TIAS):([0-9]+)/;
|
|
21940
|
-
var bLineMatched = section.match(bLinePattern);
|
|
21941
|
-
if (!bLineMatched) {
|
|
21942
|
-
return section.replace(/(\r\n)?$/, bLine + "$1");
|
|
21943
|
-
}
|
|
21944
|
-
var maxBitrateMatched = parseInt(bLineMatched[2], 10);
|
|
21945
|
-
maxBitrate = maxBitrate || Infinity;
|
|
21946
|
-
bLine = createBLine(modifier, Math.min(maxBitrateMatched, maxBitrate));
|
|
21947
|
-
return section.replace(bLinePattern, bLine);
|
|
21948
|
-
}
|
|
21949
|
-
/**
|
|
21950
|
-
* Set maximum bitrates to the media sections in a given sdp.
|
|
21951
|
-
* @param {string} sdp - sdp string
|
|
21952
|
-
* @param {string} modifier - 'AS' | 'TIAS"
|
|
21953
|
-
* @param {?number} maxAudioBitrate - Max outgoing audio bitrate (bps), null
|
|
21954
|
-
* if no limit is to be applied
|
|
21955
|
-
* @param {?number} maxVideoBitrate - Max outgoing video bitrate (bps), null
|
|
21956
|
-
* if no limit is to be applied
|
|
21957
|
-
* @returns {string} - The updated sdp string
|
|
21958
|
-
*/
|
|
21959
|
-
function setBitrateParameters(sdp, modifier, maxAudioBitrate, maxVideoBitrate) {
|
|
21960
|
-
var mediaSections = getMediaSections(sdp);
|
|
21961
|
-
var session = sdp.split('\r\nm=')[0];
|
|
21962
|
-
return [session].concat(mediaSections.map(function (section) {
|
|
21963
|
-
// Bitrate parameters should not be applied to m=application sections
|
|
21964
|
-
// or to m=(audio|video) sections that do not receive media.
|
|
21965
|
-
if (!/^m=(audio|video)/.test(section) || !/a=(recvonly|sendrecv)/.test(section)) {
|
|
21966
|
-
return section;
|
|
21967
|
-
}
|
|
21968
|
-
var kind = section.match(/^m=(audio|video)/)[1];
|
|
21969
|
-
var maxBitrate = kind === 'audio' ? maxAudioBitrate : maxVideoBitrate;
|
|
21970
|
-
return setBitrateInMediaSection(modifier, maxBitrate, section);
|
|
21971
|
-
})).join('\r\n');
|
|
21972
|
-
}
|
|
21973
22369
|
/**
|
|
21974
22370
|
* Set the given Codec Payload Types in the first line of the given m= section.
|
|
21975
22371
|
* @param {Array<PT>} payloadTypes - Payload Types
|
|
@@ -22018,11 +22414,10 @@ function setCodecPreferences(sdp, preferredAudioCodecs, preferredVideoCodecs) {
|
|
|
22018
22414
|
/**
|
|
22019
22415
|
* Return a new SDP string with simulcast settings.
|
|
22020
22416
|
* @param {string} sdp
|
|
22021
|
-
* @param {'planb' | 'unified'} sdpFormat
|
|
22022
22417
|
* @param {Map<Track.ID, TrackAttributes>} trackIdsToAttributes
|
|
22023
22418
|
* @returns {string} Updated SDP string
|
|
22024
22419
|
*/
|
|
22025
|
-
function setSimulcast(sdp,
|
|
22420
|
+
function setSimulcast(sdp, trackIdsToAttributes) {
|
|
22026
22421
|
var mediaSections = getMediaSections(sdp);
|
|
22027
22422
|
var session = sdp.split('\r\nm=')[0];
|
|
22028
22423
|
return [session].concat(mediaSections.map(function (section) {
|
|
@@ -22035,12 +22430,12 @@ function setSimulcast(sdp, sdpFormat, trackIdsToAttributes) {
|
|
|
22035
22430
|
var vp8PayloadTypes = new Set(codecMap.get('vp8') || []);
|
|
22036
22431
|
var hasVP8PayloadType = payloadTypes.some(function (payloadType) { return vp8PayloadTypes.has(payloadType); });
|
|
22037
22432
|
return hasVP8PayloadType
|
|
22038
|
-
? setSimulcastInMediaSection(section,
|
|
22433
|
+
? setSimulcastInMediaSection(section, trackIdsToAttributes)
|
|
22039
22434
|
: section;
|
|
22040
22435
|
})).concat('').join('\r\n');
|
|
22041
22436
|
}
|
|
22042
22437
|
/**
|
|
22043
|
-
* Get the matching Payload Types in
|
|
22438
|
+
* Get the matching Payload Types in an m= section for a particular peer codec.
|
|
22044
22439
|
* @param {Codec} peerCodec
|
|
22045
22440
|
* @param {PT} peerPt
|
|
22046
22441
|
* @param {Map<Codec, PT>} codecsToPts
|
|
@@ -22048,7 +22443,7 @@ function setSimulcast(sdp, sdpFormat, trackIdsToAttributes) {
|
|
|
22048
22443
|
* @param {string} peerSection
|
|
22049
22444
|
* @returns {Array<PT>}
|
|
22050
22445
|
*/
|
|
22051
|
-
function
|
|
22446
|
+
function getMatchingPayloadTypes(peerCodec, peerPt, codecsToPts, section, peerSection) {
|
|
22052
22447
|
// If there is at most one local Payload Type that matches the remote codec, retain it.
|
|
22053
22448
|
var matchingPts = codecsToPts.get(peerCodec) || [];
|
|
22054
22449
|
if (matchingPts.length <= 1) {
|
|
@@ -22075,14 +22470,13 @@ function unifiedPlanGetMatchingPayloadTypes(peerCodec, peerPt, codecsToPts, sect
|
|
|
22075
22470
|
return typeof matchingPt === 'number' ? [matchingPt] : matchingPts;
|
|
22076
22471
|
}
|
|
22077
22472
|
/**
|
|
22078
|
-
* Filter codecs in
|
|
22079
|
-
* from the other peer.
|
|
22473
|
+
* Filter codecs in an m= section based on its peer m= section from the other peer.
|
|
22080
22474
|
* @param {string} section
|
|
22081
22475
|
* @param {Map<string, string>} peerMidsToMediaSections
|
|
22082
22476
|
* @param {Array<string>} codecsToRemove
|
|
22083
22477
|
* @returns {string}
|
|
22084
22478
|
*/
|
|
22085
|
-
function
|
|
22479
|
+
function filterCodecsInMediaSection(section, peerMidsToMediaSections, codecsToRemove) {
|
|
22086
22480
|
// Do nothing if the m= section represents neither audio nor video.
|
|
22087
22481
|
if (!/^m=(audio|video)/.test(section)) {
|
|
22088
22482
|
return section;
|
|
@@ -22101,7 +22495,7 @@ function unifiedPlanFilterCodecsInMediaSection(section, peerMidsToMediaSections,
|
|
|
22101
22495
|
var pts = flatMap(Array.from(peerPtToCodecs), function (_a) {
|
|
22102
22496
|
var _b = __read(_a, 2), peerPt = _b[0], peerCodec = _b[1];
|
|
22103
22497
|
return peerCodec !== 'rtx' && !codecsToRemove.includes(peerCodec)
|
|
22104
|
-
?
|
|
22498
|
+
? getMatchingPayloadTypes(peerCodec, peerPt, codecsToPts, section, peerSection)
|
|
22105
22499
|
: [];
|
|
22106
22500
|
});
|
|
22107
22501
|
// For each Payload Type that will be retained, retain their corresponding rtx
|
|
@@ -22127,17 +22521,17 @@ function unifiedPlanFilterCodecsInMediaSection(section, peerMidsToMediaSections,
|
|
|
22127
22521
|
return setPayloadTypesInMediaSection(orderedPts, lines.join('\r\n'));
|
|
22128
22522
|
}
|
|
22129
22523
|
/**
|
|
22130
|
-
* Filter local codecs based on the remote
|
|
22524
|
+
* Filter local codecs based on the remote SDP.
|
|
22131
22525
|
* @param {string} localSdp
|
|
22132
22526
|
* @param {string} remoteSdp
|
|
22133
22527
|
* @returns {string} - Updated local SDP
|
|
22134
22528
|
*/
|
|
22135
|
-
function
|
|
22529
|
+
function filterLocalCodecs(localSdp, remoteSdp) {
|
|
22136
22530
|
var localMediaSections = getMediaSections(localSdp);
|
|
22137
22531
|
var localSession = localSdp.split('\r\nm=')[0];
|
|
22138
22532
|
var remoteMidsToMediaSections = createMidToMediaSectionMap(remoteSdp);
|
|
22139
22533
|
return [localSession].concat(localMediaSections.map(function (localSection) {
|
|
22140
|
-
return
|
|
22534
|
+
return filterCodecsInMediaSection(localSection, remoteMidsToMediaSections, []);
|
|
22141
22535
|
})).join('\r\n');
|
|
22142
22536
|
}
|
|
22143
22537
|
/**
|
|
@@ -22145,9 +22539,12 @@ function unifiedPlanFilterLocalCodecs(localSdp, remoteSdp) {
|
|
|
22145
22539
|
* @param localSdp - simulcast enabled local sdp
|
|
22146
22540
|
* @param localSdpWithoutSimulcast - local sdp before simulcast was set
|
|
22147
22541
|
* @param remoteSdp - remote sdp
|
|
22542
|
+
* @param revertForAll - when true simulcast will be reverted for all codecs. when false it will be reverted
|
|
22543
|
+
* only for non-vp8 codecs.
|
|
22148
22544
|
* @return {string} Updated SDP string
|
|
22149
22545
|
*/
|
|
22150
|
-
function
|
|
22546
|
+
function revertSimulcast(localSdp, localSdpWithoutSimulcast, remoteSdp, revertForAll) {
|
|
22547
|
+
if (revertForAll === void 0) { revertForAll = false; }
|
|
22151
22548
|
var remoteMidToMediaSections = createMidToMediaSectionMap(remoteSdp);
|
|
22152
22549
|
var localMidToMediaSectionsWithoutSimulcast = createMidToMediaSectionMap(localSdpWithoutSimulcast);
|
|
22153
22550
|
var mediaSections = getMediaSections(localSdp);
|
|
@@ -22166,20 +22563,21 @@ function revertSimulcastForNonVP8MediaSections(localSdp, localSdpWithoutSimulcas
|
|
|
22166
22563
|
var remotePtToCodecs = createPtToCodecName(remoteSection);
|
|
22167
22564
|
var remotePayloadTypes = getPayloadTypesInMediaSection(remoteSection);
|
|
22168
22565
|
var isVP8ThePreferredCodec = remotePayloadTypes.length && remotePtToCodecs.get(remotePayloadTypes[0]) === 'vp8';
|
|
22169
|
-
|
|
22566
|
+
var shouldRevertSimulcast = revertForAll || !isVP8ThePreferredCodec;
|
|
22567
|
+
return shouldRevertSimulcast ? localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\r\n$/, '') : section;
|
|
22170
22568
|
})).concat('').join('\r\n');
|
|
22171
22569
|
}
|
|
22172
22570
|
/**
|
|
22173
|
-
* Add or rewrite MSIDs for new m= sections in the given
|
|
22174
|
-
*
|
|
22175
|
-
*
|
|
22176
|
-
*
|
|
22571
|
+
* Add or rewrite MSIDs for new m= sections in the given SDP with their corresponding
|
|
22572
|
+
* local MediaStreamTrack IDs. These can be different when previously removed MediaStreamTracks
|
|
22573
|
+
* are added back (or Track IDs may not be present in the SDPs at all once browsers implement
|
|
22574
|
+
* the latest WebRTC spec).
|
|
22177
22575
|
* @param {string} sdp
|
|
22178
22576
|
* @param {Map<string, Track.ID>} activeMidsToTrackIds
|
|
22179
22577
|
* @param {Map<Track.Kind, Array<Track.ID>>} trackIdsByKind
|
|
22180
22578
|
* @returns {string}
|
|
22181
22579
|
*/
|
|
22182
|
-
function
|
|
22580
|
+
function addOrRewriteNewTrackIds(sdp, activeMidsToTrackIds, trackIdsByKind) {
|
|
22183
22581
|
// NOTE(mmalavalli): The m= sections for the new MediaStreamTracks are usually
|
|
22184
22582
|
// present after the m= sections for the existing MediaStreamTracks, in order
|
|
22185
22583
|
// of addition.
|
|
@@ -22190,17 +22588,17 @@ function unifiedPlanAddOrRewriteNewTrackIds(sdp, activeMidsToTrackIds, trackIdsB
|
|
|
22190
22588
|
newMids.forEach(function (mid, i) { return midsToTrackIds.set(mid, trackIds[i]); });
|
|
22191
22589
|
return midsToTrackIds;
|
|
22192
22590
|
}, new Map());
|
|
22193
|
-
return
|
|
22591
|
+
return addOrRewriteTrackIds(sdp, newMidsToTrackIds);
|
|
22194
22592
|
}
|
|
22195
22593
|
/**
|
|
22196
|
-
* Add or rewrite MSIDs in the given
|
|
22197
|
-
*
|
|
22198
|
-
*
|
|
22594
|
+
* Add or rewrite MSIDs in the given SDP with their corresponding local MediaStreamTrack IDs.
|
|
22595
|
+
* These IDs need not be the same (or Track IDs may not be present in the SDPs at all once
|
|
22596
|
+
* browsers implement the latest WebRTC spec).
|
|
22199
22597
|
* @param {string} sdp
|
|
22200
22598
|
* @param {Map<string, Track.ID>} midsToTrackIds
|
|
22201
22599
|
* @returns {string}
|
|
22202
22600
|
*/
|
|
22203
|
-
function
|
|
22601
|
+
function addOrRewriteTrackIds(sdp, midsToTrackIds) {
|
|
22204
22602
|
var mediaSections = getMediaSections(sdp);
|
|
22205
22603
|
var session = sdp.split('\r\nm=')[0];
|
|
22206
22604
|
return [session].concat(mediaSections.map(function (mediaSection) {
|
|
@@ -22231,7 +22629,7 @@ function unifiedPlanAddOrRewriteTrackIds(sdp, midsToTrackIds) {
|
|
|
22231
22629
|
})).join('\r\n');
|
|
22232
22630
|
}
|
|
22233
22631
|
/**
|
|
22234
|
-
*
|
|
22632
|
+
* Removes specified ssrc attributes from given sdp.
|
|
22235
22633
|
* @param {string} sdp
|
|
22236
22634
|
* @param {Array<string>} ssrcAttributesToRemove
|
|
22237
22635
|
* @returns {string}
|
|
@@ -22345,25 +22743,23 @@ function enableDtxForOpus(sdp, mids) {
|
|
|
22345
22743
|
return section.replace(origOpusFmtpRegex, opusFmtpLineWithDtx);
|
|
22346
22744
|
})).join('\r\n');
|
|
22347
22745
|
}
|
|
22746
|
+
exports.addOrRewriteNewTrackIds = addOrRewriteNewTrackIds;
|
|
22747
|
+
exports.addOrRewriteTrackIds = addOrRewriteTrackIds;
|
|
22348
22748
|
exports.createCodecMapForMediaSection = createCodecMapForMediaSection;
|
|
22349
22749
|
exports.createPtToCodecName = createPtToCodecName;
|
|
22350
22750
|
exports.disableRtx = disableRtx;
|
|
22351
22751
|
exports.enableDtxForOpus = enableDtxForOpus;
|
|
22752
|
+
exports.filterLocalCodecs = filterLocalCodecs;
|
|
22352
22753
|
exports.getMediaSections = getMediaSections;
|
|
22353
22754
|
exports.removeSSRCAttributes = removeSSRCAttributes;
|
|
22354
|
-
exports.
|
|
22355
|
-
exports.setBitrateParameters = setBitrateParameters;
|
|
22755
|
+
exports.revertSimulcast = revertSimulcast;
|
|
22356
22756
|
exports.setCodecPreferences = setCodecPreferences;
|
|
22357
22757
|
exports.setSimulcast = setSimulcast;
|
|
22358
|
-
exports.unifiedPlanFilterLocalCodecs = unifiedPlanFilterLocalCodecs;
|
|
22359
|
-
exports.unifiedPlanAddOrRewriteNewTrackIds = unifiedPlanAddOrRewriteNewTrackIds;
|
|
22360
|
-
exports.unifiedPlanAddOrRewriteTrackIds = unifiedPlanAddOrRewriteTrackIds;
|
|
22361
22758
|
|
|
22362
|
-
},{"../":
|
|
22759
|
+
},{"../":127,"./simulcast":137}],136:[function(require,module,exports){
|
|
22363
22760
|
'use strict';
|
|
22364
22761
|
var RTCSessionDescription = require('@twilio/webrtc').RTCSessionDescription;
|
|
22365
|
-
var
|
|
22366
|
-
var getMediaSections = require('./').getMediaSections;
|
|
22762
|
+
var _a = require('./'), createPtToCodecName = _a.createPtToCodecName, getMediaSections = _a.getMediaSections;
|
|
22367
22763
|
/**
|
|
22368
22764
|
* An RTX payload type
|
|
22369
22765
|
* @typedef {PT} RtxPT
|
|
@@ -22553,7 +22949,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
|
|
|
22553
22949
|
}
|
|
22554
22950
|
module.exports = workaround;
|
|
22555
22951
|
|
|
22556
|
-
},{"./":
|
|
22952
|
+
},{"./":135,"@twilio/webrtc":151}],137:[function(require,module,exports){
|
|
22557
22953
|
'use strict';
|
|
22558
22954
|
var __read = (this && this.__read) || function (o, n) {
|
|
22559
22955
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
@@ -22571,8 +22967,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
22571
22967
|
}
|
|
22572
22968
|
return ar;
|
|
22573
22969
|
};
|
|
22574
|
-
var
|
|
22575
|
-
var flatMap = require('../').flatMap;
|
|
22970
|
+
var _a = require('../'), difference = _a.difference, flatMap = _a.flatMap;
|
|
22576
22971
|
/**
|
|
22577
22972
|
* Create a random {@link SSRC}.
|
|
22578
22973
|
* @returns {SSRC}
|
|
@@ -22732,29 +23127,9 @@ function getSSRCRtxPairs(section) {
|
|
|
22732
23127
|
/**
|
|
22733
23128
|
* Create SSRC attribute tuples.
|
|
22734
23129
|
* @param {string} section
|
|
22735
|
-
* @param {'planb' | 'unified'} sdpFormat
|
|
22736
23130
|
* @returns {Array<[SSRC, MediaStreamID, Track.ID]>}
|
|
22737
23131
|
*/
|
|
22738
|
-
function createSSRCAttributeTuples(section
|
|
22739
|
-
return {
|
|
22740
|
-
planb: createPlanBSSRCAttributeTuples,
|
|
22741
|
-
unified: createUnifiedPlanSSRCAttributeTuples
|
|
22742
|
-
}[sdpFormat](section);
|
|
22743
|
-
}
|
|
22744
|
-
/**
|
|
22745
|
-
* Create "plan-b" SSRC attribute tuples.
|
|
22746
|
-
* @param {string} section
|
|
22747
|
-
* @returns {Array<[SSRC, MediaStreamID, Track.ID]>}
|
|
22748
|
-
*/
|
|
22749
|
-
function createPlanBSSRCAttributeTuples(section) {
|
|
22750
|
-
return getMatches(section, '^a=ssrc:([0-9]+) msid:([^\\s]+) ([^\\s]+)$');
|
|
22751
|
-
}
|
|
22752
|
-
/**
|
|
22753
|
-
* Create "unified-plan" SSRC attribute tuples.
|
|
22754
|
-
* @param {string} section
|
|
22755
|
-
* @returns {Array<[SSRC, MediaStreamID, Track.ID]>}
|
|
22756
|
-
*/
|
|
22757
|
-
function createUnifiedPlanSSRCAttributeTuples(section) {
|
|
23132
|
+
function createSSRCAttributeTuples(section) {
|
|
22758
23133
|
var _a = __read(flatMap(getMatches(section, '^a=msid:(.+) (.+)$')), 2), streamId = _a[0], trackId = _a[1];
|
|
22759
23134
|
var ssrcs = flatMap(getMatches(section, '^a=ssrc:(.+) cname:.+$'));
|
|
22760
23135
|
return ssrcs.map(function (ssrc) { return [ssrc, streamId, trackId]; });
|
|
@@ -22762,13 +23137,12 @@ function createUnifiedPlanSSRCAttributeTuples(section) {
|
|
|
22762
23137
|
/**
|
|
22763
23138
|
* Create a Map of MediaStreamTrack IDs and their {@link TrackAttributes}.
|
|
22764
23139
|
* @param {string} section - SDP media section
|
|
22765
|
-
* @param {'planb' | 'unified'} sdpFormat
|
|
22766
23140
|
* @returns {Map<Track.ID, TrackAttributes>}
|
|
22767
23141
|
*/
|
|
22768
|
-
function createTrackIdsToAttributes(section
|
|
23142
|
+
function createTrackIdsToAttributes(section) {
|
|
22769
23143
|
var simSSRCs = getSimulcastSSRCs(section);
|
|
22770
23144
|
var rtxPairs = getSSRCRtxPairs(section);
|
|
22771
|
-
var ssrcAttrTuples = createSSRCAttributeTuples(section
|
|
23145
|
+
var ssrcAttrTuples = createSSRCAttributeTuples(section);
|
|
22772
23146
|
return ssrcAttrTuples.reduce(function (trackIdsToSSRCs, tuple) {
|
|
22773
23147
|
var ssrc = tuple[0];
|
|
22774
23148
|
var streamId = tuple[1];
|
|
@@ -22782,13 +23156,12 @@ function createTrackIdsToAttributes(section, sdpFormat) {
|
|
|
22782
23156
|
/**
|
|
22783
23157
|
* Apply simulcast settings to the given SDP media section.
|
|
22784
23158
|
* @param {string} section - SDP media section
|
|
22785
|
-
* @param {'planb' | 'unified'} sdpFormat
|
|
22786
23159
|
* @param {Map<Track.ID, TrackAttributes>} trackIdsToAttributes - Existing
|
|
22787
23160
|
* map which will be updated for new MediaStreamTrack IDs
|
|
22788
23161
|
* @returns {string} - The transformed SDP media section
|
|
22789
23162
|
*/
|
|
22790
|
-
function setSimulcastInMediaSection(section,
|
|
22791
|
-
var newTrackIdsToAttributes = createTrackIdsToAttributes(section
|
|
23163
|
+
function setSimulcastInMediaSection(section, trackIdsToAttributes) {
|
|
23164
|
+
var newTrackIdsToAttributes = createTrackIdsToAttributes(section);
|
|
22792
23165
|
var newTrackIds = Array.from(newTrackIdsToAttributes.keys());
|
|
22793
23166
|
var trackIds = Array.from(trackIdsToAttributes.keys());
|
|
22794
23167
|
var trackIdsToAdd = difference(newTrackIds, trackIds);
|
|
@@ -22839,44 +23212,18 @@ function setSimulcastInMediaSection(section, sdpFormat, trackIdsToAttributes) {
|
|
|
22839
23212
|
*/
|
|
22840
23213
|
module.exports = setSimulcastInMediaSection;
|
|
22841
23214
|
|
|
22842
|
-
},{"../":
|
|
23215
|
+
},{"../":127}],138:[function(require,module,exports){
|
|
22843
23216
|
'use strict';
|
|
23217
|
+
var getMediaSections = require('./').getMediaSections;
|
|
22844
23218
|
/**
|
|
22845
|
-
* An {@link
|
|
22846
|
-
* MediaStreamTrack IDs.
|
|
22847
|
-
*/
|
|
22848
|
-
var IdentityTrackMatcher = /** @class */ (function () {
|
|
22849
|
-
function IdentityTrackMatcher() {
|
|
22850
|
-
}
|
|
22851
|
-
/**
|
|
22852
|
-
* Match a given MediaStreamTrack with its ID.
|
|
22853
|
-
* @param {RTCTrackEvent} event
|
|
22854
|
-
* @returns {Track.ID}
|
|
22855
|
-
*/
|
|
22856
|
-
IdentityTrackMatcher.prototype.match = function (event) {
|
|
22857
|
-
return event.track.id;
|
|
22858
|
-
};
|
|
22859
|
-
/**
|
|
22860
|
-
* Update the {@link IdentityTrackMatcher} with a new SDP.
|
|
22861
|
-
* @param {string} sdp
|
|
22862
|
-
*/
|
|
22863
|
-
IdentityTrackMatcher.prototype.update = function () { };
|
|
22864
|
-
return IdentityTrackMatcher;
|
|
22865
|
-
}());
|
|
22866
|
-
module.exports = IdentityTrackMatcher;
|
|
22867
|
-
|
|
22868
|
-
},{}],138:[function(require,module,exports){
|
|
22869
|
-
'use strict';
|
|
22870
|
-
var getMediaSections = require('../').getMediaSections;
|
|
22871
|
-
/**
|
|
22872
|
-
* An {@link MIDTrackMatcher} matches an RTCTrackEvent with a MediaStreamTrack
|
|
23219
|
+
* An {@link TrackMatcher} matches an RTCTrackEvent with a MediaStreamTrack
|
|
22873
23220
|
* ID based on the MID of the underlying RTCRtpTransceiver.
|
|
22874
23221
|
*/
|
|
22875
|
-
var
|
|
23222
|
+
var TrackMatcher = /** @class */ (function () {
|
|
22876
23223
|
/**
|
|
22877
|
-
* Construct an {@link
|
|
23224
|
+
* Construct an {@link TrackMatcher}.
|
|
22878
23225
|
*/
|
|
22879
|
-
function
|
|
23226
|
+
function TrackMatcher() {
|
|
22880
23227
|
Object.defineProperties(this, {
|
|
22881
23228
|
_midsToTrackIds: {
|
|
22882
23229
|
value: new Map(),
|
|
@@ -22889,14 +23236,14 @@ var MIDTrackMatcher = /** @class */ (function () {
|
|
|
22889
23236
|
* @param {RTCTrackEvent} event
|
|
22890
23237
|
* @returns {?Track.ID}
|
|
22891
23238
|
*/
|
|
22892
|
-
|
|
23239
|
+
TrackMatcher.prototype.match = function (event) {
|
|
22893
23240
|
return this._midsToTrackIds.get(event.transceiver.mid) || null;
|
|
22894
23241
|
};
|
|
22895
23242
|
/**
|
|
22896
|
-
* Update the {@link
|
|
23243
|
+
* Update the {@link TrackMatcher} with a new SDP.
|
|
22897
23244
|
* @param {string} sdp
|
|
22898
23245
|
*/
|
|
22899
|
-
|
|
23246
|
+
TrackMatcher.prototype.update = function (sdp) {
|
|
22900
23247
|
var sections = getMediaSections(sdp, '(audio|video)');
|
|
22901
23248
|
this._midsToTrackIds = sections.reduce(function (midsToTrackIds, section) {
|
|
22902
23249
|
var midMatches = section.match(/^a=mid:(.+)$/m) || [];
|
|
@@ -22906,123 +23253,11 @@ var MIDTrackMatcher = /** @class */ (function () {
|
|
|
22906
23253
|
return mid && trackId ? midsToTrackIds.set(mid, trackId) : midsToTrackIds;
|
|
22907
23254
|
}, this._midsToTrackIds);
|
|
22908
23255
|
};
|
|
22909
|
-
return
|
|
22910
|
-
}());
|
|
22911
|
-
module.exports = MIDTrackMatcher;
|
|
22912
|
-
|
|
22913
|
-
},{"../":134}],139:[function(require,module,exports){
|
|
22914
|
-
'use strict';
|
|
22915
|
-
var util = require('../../');
|
|
22916
|
-
var getMediaSections = require('../').getMediaSections;
|
|
22917
|
-
// NOTE(mroberts): OrderedTrackMatcher is meant to solve the problem identified in
|
|
22918
|
-
//
|
|
22919
|
-
// https://bugs.webkit.org/show_bug.cgi?id=174519
|
|
22920
|
-
//
|
|
22921
|
-
// Namely that, without MIDs, we cannot "correctly" identify MediaStreamTracks
|
|
22922
|
-
// in Safari's current WebRTC implementation. So, this module tries to hack
|
|
22923
|
-
// around this by making a possibly dangerous assumption: "track" events will
|
|
22924
|
-
// be raised for MediaStreamTracks of a particular kind in the same order that
|
|
22925
|
-
// those kinds' MSIDs appear in the SDP. By calling `update` with an
|
|
22926
|
-
// RTCPeerConnection's `remoteDescription` and then invoking `match`, we ought
|
|
22927
|
-
// to be able to dequeue MediaStreamTrack IDs in the correct order to be
|
|
22928
|
-
// assigned to "track" events.
|
|
22929
|
-
/**
|
|
22930
|
-
* @interface MatchedAndUnmatched
|
|
22931
|
-
* @property {Set<Track.ID>} matched
|
|
22932
|
-
* @property {Set<Track.ID>} unmatched
|
|
22933
|
-
*/
|
|
22934
|
-
/**
|
|
22935
|
-
* Create a new instance of {@link MatchedAndUnmatched}.
|
|
22936
|
-
* @returns {MatchedAndUnmatched}
|
|
22937
|
-
*/
|
|
22938
|
-
function create() {
|
|
22939
|
-
return {
|
|
22940
|
-
matched: new Set(),
|
|
22941
|
-
unmatched: new Set()
|
|
22942
|
-
};
|
|
22943
|
-
}
|
|
22944
|
-
/**
|
|
22945
|
-
* Attempt to match a MediaStreamTrack ID.
|
|
22946
|
-
* @param {MatchedAndUnmatched} mAndM
|
|
22947
|
-
* @returns {?Track.ID} id
|
|
22948
|
-
*/
|
|
22949
|
-
function match(mAndM) {
|
|
22950
|
-
var unmatched = Array.from(mAndM.unmatched);
|
|
22951
|
-
if (!unmatched.length) {
|
|
22952
|
-
return null;
|
|
22953
|
-
}
|
|
22954
|
-
var id = unmatched[0];
|
|
22955
|
-
mAndM.matched.add(id);
|
|
22956
|
-
mAndM.unmatched.delete(id);
|
|
22957
|
-
return id;
|
|
22958
|
-
}
|
|
22959
|
-
/**
|
|
22960
|
-
* Update a {@link MatchedAndUnmatched}'s MediaStreamTrack IDs.
|
|
22961
|
-
* @param {MatchedAndUnmatched} mAndM
|
|
22962
|
-
* @param {Set<Track.ID>} ids
|
|
22963
|
-
* @returns {void}
|
|
22964
|
-
*/
|
|
22965
|
-
function update(mAndM, ids) {
|
|
22966
|
-
ids = new Set(ids);
|
|
22967
|
-
var removedMatchedIds = util.difference(mAndM.matched, ids);
|
|
22968
|
-
removedMatchedIds.forEach(mAndM.matched.delete, mAndM.matched);
|
|
22969
|
-
mAndM.unmatched = util.difference(ids, mAndM.matched);
|
|
22970
|
-
}
|
|
22971
|
-
/**
|
|
22972
|
-
* Parse MediaStreamTrack IDs of a particular kind from an SDP.
|
|
22973
|
-
* @param {string} kind
|
|
22974
|
-
* @param {string} sdp
|
|
22975
|
-
* @returns {Set<Track.ID>} ids
|
|
22976
|
-
*/
|
|
22977
|
-
function parse(kind, sdp) {
|
|
22978
|
-
var mediaSections = getMediaSections(sdp, kind);
|
|
22979
|
-
var pattern = 'msid: ?(.+) +(.+) ?$';
|
|
22980
|
-
return new Set(util.flatMap(mediaSections, function (mediaSection) { return mediaSection.match(new RegExp(pattern, 'mg')) || []; }).map(function (msid) { return msid.match(new RegExp(pattern))[2]; }));
|
|
22981
|
-
}
|
|
22982
|
-
/**
|
|
22983
|
-
* A {@link OrderedTrackMatcher} is used to match RTCTrackEvents.
|
|
22984
|
-
* @property {MatchedAndUnmatched} audio
|
|
22985
|
-
* @property {MatchedAndUnmatched} video
|
|
22986
|
-
*/
|
|
22987
|
-
var OrderedTrackMatcher = /** @class */ (function () {
|
|
22988
|
-
function OrderedTrackMatcher() {
|
|
22989
|
-
if (!(this instanceof OrderedTrackMatcher)) {
|
|
22990
|
-
return new OrderedTrackMatcher();
|
|
22991
|
-
}
|
|
22992
|
-
Object.defineProperties(this, {
|
|
22993
|
-
audio: {
|
|
22994
|
-
enumerable: true,
|
|
22995
|
-
value: create()
|
|
22996
|
-
},
|
|
22997
|
-
video: {
|
|
22998
|
-
enumerable: true,
|
|
22999
|
-
value: create()
|
|
23000
|
-
}
|
|
23001
|
-
});
|
|
23002
|
-
}
|
|
23003
|
-
/**
|
|
23004
|
-
* Attempt to match a new MediaStreamTrack ID.
|
|
23005
|
-
* @param {RTCTrackEvent} event
|
|
23006
|
-
* @returns {?Track.ID} id
|
|
23007
|
-
*/
|
|
23008
|
-
OrderedTrackMatcher.prototype.match = function (event) {
|
|
23009
|
-
return match(this[event.track.kind]);
|
|
23010
|
-
};
|
|
23011
|
-
/**
|
|
23012
|
-
* Update the {@link OrderedTrackMatcher} with a new SDP.
|
|
23013
|
-
* @param {string} sdp
|
|
23014
|
-
* @returns {void}
|
|
23015
|
-
*/
|
|
23016
|
-
OrderedTrackMatcher.prototype.update = function (sdp) {
|
|
23017
|
-
['audio', 'video'].forEach(function (kind) {
|
|
23018
|
-
update(this[kind], parse(kind, sdp));
|
|
23019
|
-
}, this);
|
|
23020
|
-
};
|
|
23021
|
-
return OrderedTrackMatcher;
|
|
23256
|
+
return TrackMatcher;
|
|
23022
23257
|
}());
|
|
23023
|
-
module.exports =
|
|
23258
|
+
module.exports = TrackMatcher;
|
|
23024
23259
|
|
|
23025
|
-
},{"
|
|
23260
|
+
},{"./":135}],139:[function(require,module,exports){
|
|
23026
23261
|
var SID_CHARS = '1234567890abcdef';
|
|
23027
23262
|
var SID_CHAR_LENGTH = 32;
|
|
23028
23263
|
// copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
|
|
@@ -23041,7 +23276,7 @@ function createSID(prefix) {
|
|
|
23041
23276
|
exports.sessionSID = createSID('SS');
|
|
23042
23277
|
exports.createSID = createSID;
|
|
23043
23278
|
|
|
23044
|
-
},{}],
|
|
23279
|
+
},{}],140:[function(require,module,exports){
|
|
23045
23280
|
'use strict';
|
|
23046
23281
|
var _a = require('@twilio/webrtc/lib/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
|
|
23047
23282
|
var _b = require('./browserdetection'), isAndroid = _b.isAndroid, isMobile = _b.isMobile, isNonChromiumEdge = _b.isNonChromiumEdge, rebrandedChromeBrowser = _b.rebrandedChromeBrowser, mobileWebKitBrowser = _b.mobileWebKitBrowser;
|
|
@@ -23086,7 +23321,7 @@ function isSupported() {
|
|
|
23086
23321
|
}
|
|
23087
23322
|
module.exports = isSupported;
|
|
23088
23323
|
|
|
23089
|
-
},{"./browserdetection":
|
|
23324
|
+
},{"./browserdetection":119,"@twilio/webrtc/lib/util":164}],141:[function(require,module,exports){
|
|
23090
23325
|
'use strict';
|
|
23091
23326
|
/**
|
|
23092
23327
|
* A {@link Timeout} represents a resettable and clearable timeout.
|
|
@@ -23181,7 +23416,7 @@ var Timeout = /** @class */ (function () {
|
|
|
23181
23416
|
}());
|
|
23182
23417
|
module.exports = Timeout;
|
|
23183
23418
|
|
|
23184
|
-
},{}],
|
|
23419
|
+
},{}],142:[function(require,module,exports){
|
|
23185
23420
|
// NOTE: Do not edit this file. This code is auto-generated. Contact the
|
|
23186
23421
|
// Twilio SDK Team for more information.
|
|
23187
23422
|
'use strict';
|
|
@@ -24205,7 +24440,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
|
|
|
24205
24440
|
exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
|
|
24206
24441
|
Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
|
|
24207
24442
|
|
|
24208
|
-
},{"./twilioerror":
|
|
24443
|
+
},{"./twilioerror":143}],143:[function(require,module,exports){
|
|
24209
24444
|
'use strict';
|
|
24210
24445
|
var __extends = (this && this.__extends) || (function () {
|
|
24211
24446
|
var extendStatics = function (d, b) {
|
|
@@ -24287,7 +24522,7 @@ var TwilioError = /** @class */ (function (_super) {
|
|
|
24287
24522
|
}(Error));
|
|
24288
24523
|
module.exports = TwilioError;
|
|
24289
24524
|
|
|
24290
|
-
},{}],
|
|
24525
|
+
},{}],144:[function(require,module,exports){
|
|
24291
24526
|
'use strict';
|
|
24292
24527
|
var isNonArrayObject = require('./').isNonArrayObject;
|
|
24293
24528
|
var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
|
|
@@ -24404,7 +24639,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
|
|
|
24404
24639
|
exports.validateLocalTrack = validateLocalTrack;
|
|
24405
24640
|
exports.validateObject = validateObject;
|
|
24406
24641
|
|
|
24407
|
-
},{"./":
|
|
24642
|
+
},{"./":127,"./constants":121}],145:[function(require,module,exports){
|
|
24408
24643
|
/**
|
|
24409
24644
|
* Copyright (c) 2013 Tim Perry
|
|
24410
24645
|
* Licensed under the MIT license.
|
|
@@ -24644,7 +24879,7 @@ defaultLogger.getLoggers = function getLoggers() {
|
|
|
24644
24879
|
defaultLogger['default'] = defaultLogger;
|
|
24645
24880
|
module.exports = defaultLogger;
|
|
24646
24881
|
|
|
24647
|
-
},{}],
|
|
24882
|
+
},{}],146:[function(require,module,exports){
|
|
24648
24883
|
/* globals webkitAudioContext, AudioContext */
|
|
24649
24884
|
'use strict';
|
|
24650
24885
|
var NativeAudioContext = typeof AudioContext !== 'undefined'
|
|
@@ -24727,7 +24962,7 @@ var AudioContextFactory = /** @class */ (function () {
|
|
|
24727
24962
|
}());
|
|
24728
24963
|
module.exports = new AudioContextFactory();
|
|
24729
24964
|
|
|
24730
|
-
},{}],
|
|
24965
|
+
},{}],147:[function(require,module,exports){
|
|
24731
24966
|
'use strict';
|
|
24732
24967
|
/**
|
|
24733
24968
|
* Return a Promise that resolves after `timeout` milliseconds.
|
|
@@ -24780,7 +25015,7 @@ function detectSilence(audioContext, stream, timeout) {
|
|
|
24780
25015
|
}
|
|
24781
25016
|
module.exports = detectSilence;
|
|
24782
25017
|
|
|
24783
|
-
},{}],
|
|
25018
|
+
},{}],148:[function(require,module,exports){
|
|
24784
25019
|
'use strict';
|
|
24785
25020
|
var detectSilence = require('./detectsilence');
|
|
24786
25021
|
/**
|
|
@@ -24850,7 +25085,7 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
|
|
|
24850
25085
|
}
|
|
24851
25086
|
module.exports = workaround;
|
|
24852
25087
|
|
|
24853
|
-
},{"./audiocontext":
|
|
25088
|
+
},{"./audiocontext":146,"./detectsilence":147}],149:[function(require,module,exports){
|
|
24854
25089
|
'use strict';
|
|
24855
25090
|
|
|
24856
25091
|
var flatMap = require('./util').flatMap;
|
|
@@ -25311,6 +25546,7 @@ function standardizeChromeOrSafariStats(response) {
|
|
|
25311
25546
|
var remoteOutbound = null;
|
|
25312
25547
|
var track = null;
|
|
25313
25548
|
var codec = null;
|
|
25549
|
+
var localMedia = null;
|
|
25314
25550
|
|
|
25315
25551
|
response.forEach(function(stat) {
|
|
25316
25552
|
switch (stat.type) {
|
|
@@ -25320,6 +25556,9 @@ function standardizeChromeOrSafariStats(response) {
|
|
|
25320
25556
|
case 'outbound-rtp':
|
|
25321
25557
|
outbound.push(stat);
|
|
25322
25558
|
break;
|
|
25559
|
+
case 'media-source':
|
|
25560
|
+
localMedia = stat;
|
|
25561
|
+
break;
|
|
25323
25562
|
case 'track':
|
|
25324
25563
|
track = stat;
|
|
25325
25564
|
break;
|
|
@@ -25344,6 +25583,7 @@ function standardizeChromeOrSafariStats(response) {
|
|
|
25344
25583
|
var standardizedStats = {};
|
|
25345
25584
|
var statSources = [
|
|
25346
25585
|
source, // local rtp stats
|
|
25586
|
+
localMedia,
|
|
25347
25587
|
track,
|
|
25348
25588
|
codec,
|
|
25349
25589
|
remoteSource && remoteSource.ssrc === source.ssrc ? remoteSource : null, // remote rtp stats
|
|
@@ -25387,6 +25627,7 @@ function standardizeChromeOrSafariStats(response) {
|
|
|
25387
25627
|
standardizedStats.frameWidthReceived = frameWidth;
|
|
25388
25628
|
} else {
|
|
25389
25629
|
standardizedStats.frameWidthSent = frameWidth;
|
|
25630
|
+
standardizedStats.frameWidthInput = track.frameWidth;
|
|
25390
25631
|
}
|
|
25391
25632
|
}
|
|
25392
25633
|
|
|
@@ -25396,12 +25637,13 @@ function standardizeChromeOrSafariStats(response) {
|
|
|
25396
25637
|
standardizedStats.frameHeightReceived = frameHeight;
|
|
25397
25638
|
} else {
|
|
25398
25639
|
standardizedStats.frameHeightSent = frameHeight;
|
|
25640
|
+
standardizedStats.frameHeightInput = track.frameHeight;
|
|
25399
25641
|
}
|
|
25400
25642
|
}
|
|
25401
25643
|
|
|
25402
25644
|
var framesPerSecond = getStatValue('framesPerSecond');
|
|
25403
25645
|
if (typeof framesPerSecond === 'number') {
|
|
25404
|
-
standardizedStats
|
|
25646
|
+
standardizedStats[isRemote ? 'frameRateReceived' : 'frameRateSent'] = framesPerSecond;
|
|
25405
25647
|
}
|
|
25406
25648
|
|
|
25407
25649
|
var bytesReceived = getStatValue('bytesReceived');
|
|
@@ -25736,7 +25978,7 @@ function standardizeFirefoxStats(response, isRemote) {
|
|
|
25736
25978
|
|
|
25737
25979
|
module.exports = getStats;
|
|
25738
25980
|
|
|
25739
|
-
},{"./util":
|
|
25981
|
+
},{"./util":164,"./util/sdp":166}],150:[function(require,module,exports){
|
|
25740
25982
|
/* globals navigator */
|
|
25741
25983
|
'use strict';
|
|
25742
25984
|
|
|
@@ -25762,7 +26004,7 @@ function getUserMedia(constraints) {
|
|
|
25762
26004
|
|
|
25763
26005
|
module.exports = getUserMedia;
|
|
25764
26006
|
|
|
25765
|
-
},{}],
|
|
26007
|
+
},{}],151:[function(require,module,exports){
|
|
25766
26008
|
'use strict';
|
|
25767
26009
|
|
|
25768
26010
|
var WebRTC = {};
|
|
@@ -25804,7 +26046,7 @@ Object.defineProperties(WebRTC, {
|
|
|
25804
26046
|
|
|
25805
26047
|
module.exports = WebRTC;
|
|
25806
26048
|
|
|
25807
|
-
},{"../package.json":
|
|
26049
|
+
},{"../package.json":167,"./getstats":149,"./getusermedia":150,"./mediastream":152,"./mediastreamtrack":153,"./rtcicecandidate":154,"./rtcpeerconnection":157,"./rtcsessiondescription":162}],152:[function(require,module,exports){
|
|
25808
26050
|
/* globals MediaStream */
|
|
25809
26051
|
'use strict';
|
|
25810
26052
|
|
|
@@ -25816,7 +26058,7 @@ if (typeof MediaStream === 'function') {
|
|
|
25816
26058
|
};
|
|
25817
26059
|
}
|
|
25818
26060
|
|
|
25819
|
-
},{}],
|
|
26061
|
+
},{}],153:[function(require,module,exports){
|
|
25820
26062
|
/* global MediaStreamTrack */
|
|
25821
26063
|
'use strict';
|
|
25822
26064
|
|
|
@@ -25828,7 +26070,7 @@ if (typeof MediaStreamTrack === 'function') {
|
|
|
25828
26070
|
};
|
|
25829
26071
|
}
|
|
25830
26072
|
|
|
25831
|
-
},{}],
|
|
26073
|
+
},{}],154:[function(require,module,exports){
|
|
25832
26074
|
/* global RTCIceCandidate */
|
|
25833
26075
|
'use strict';
|
|
25834
26076
|
|
|
@@ -25840,7 +26082,7 @@ if (typeof RTCIceCandidate === 'function') {
|
|
|
25840
26082
|
};
|
|
25841
26083
|
}
|
|
25842
26084
|
|
|
25843
|
-
},{}],
|
|
26085
|
+
},{}],155:[function(require,module,exports){
|
|
25844
26086
|
/* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
|
|
25845
26087
|
'use strict';
|
|
25846
26088
|
|
|
@@ -26404,7 +26646,7 @@ function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
|
|
|
26404
26646
|
|
|
26405
26647
|
module.exports = ChromeRTCPeerConnection;
|
|
26406
26648
|
|
|
26407
|
-
},{"../mediastream":
|
|
26649
|
+
},{"../mediastream":152,"../rtcrtpsender":159,"../rtcsessiondescription/chrome":160,"../util":164,"../util/eventtarget":163,"../util/latch":165,"../util/sdp":166,"util":197}],156:[function(require,module,exports){
|
|
26408
26650
|
/* globals RTCPeerConnection */
|
|
26409
26651
|
'use strict';
|
|
26410
26652
|
|
|
@@ -26737,7 +26979,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
|
|
|
26737
26979
|
|
|
26738
26980
|
module.exports = FirefoxRTCPeerConnection;
|
|
26739
26981
|
|
|
26740
|
-
},{"../rtcsessiondescription/firefox":
|
|
26982
|
+
},{"../rtcsessiondescription/firefox":161,"../util":164,"../util/eventtarget":163,"../util/sdp":166,"util":197}],157:[function(require,module,exports){
|
|
26741
26983
|
'use strict';
|
|
26742
26984
|
|
|
26743
26985
|
if (typeof RTCPeerConnection === 'function') {
|
|
@@ -26762,7 +27004,7 @@ if (typeof RTCPeerConnection === 'function') {
|
|
|
26762
27004
|
};
|
|
26763
27005
|
}
|
|
26764
27006
|
|
|
26765
|
-
},{"../util":
|
|
27007
|
+
},{"../util":164,"./chrome":155,"./firefox":156,"./safari":158}],158:[function(require,module,exports){
|
|
26766
27008
|
/* globals RTCPeerConnection, RTCSessionDescription */
|
|
26767
27009
|
'use strict';
|
|
26768
27010
|
|
|
@@ -27153,7 +27395,7 @@ function shimDataChannel(dataChannel) {
|
|
|
27153
27395
|
|
|
27154
27396
|
module.exports = SafariRTCPeerConnection;
|
|
27155
27397
|
|
|
27156
|
-
},{"../util":
|
|
27398
|
+
},{"../util":164,"../util/eventtarget":163,"../util/latch":165,"../util/sdp":166,"util":197}],159:[function(require,module,exports){
|
|
27157
27399
|
'use strict';
|
|
27158
27400
|
|
|
27159
27401
|
/**
|
|
@@ -27194,7 +27436,7 @@ function RTCRtpSenderShim(track) {
|
|
|
27194
27436
|
|
|
27195
27437
|
module.exports = RTCRtpSenderShim;
|
|
27196
27438
|
|
|
27197
|
-
},{}],
|
|
27439
|
+
},{}],160:[function(require,module,exports){
|
|
27198
27440
|
/* globals RTCSessionDescription */
|
|
27199
27441
|
'use strict';
|
|
27200
27442
|
|
|
@@ -27235,13 +27477,13 @@ function ChromeRTCSessionDescription(descriptionInitDict) {
|
|
|
27235
27477
|
|
|
27236
27478
|
module.exports = ChromeRTCSessionDescription;
|
|
27237
27479
|
|
|
27238
|
-
},{}],
|
|
27480
|
+
},{}],161:[function(require,module,exports){
|
|
27239
27481
|
/* globals RTCSessionDescription */
|
|
27240
27482
|
'use strict';
|
|
27241
27483
|
|
|
27242
27484
|
module.exports = RTCSessionDescription;
|
|
27243
27485
|
|
|
27244
|
-
},{}],
|
|
27486
|
+
},{}],162:[function(require,module,exports){
|
|
27245
27487
|
/* globals RTCSessionDescription */
|
|
27246
27488
|
'use strict';
|
|
27247
27489
|
|
|
@@ -27264,7 +27506,7 @@ if (typeof RTCSessionDescription === 'function') {
|
|
|
27264
27506
|
};
|
|
27265
27507
|
}
|
|
27266
27508
|
|
|
27267
|
-
},{"../util":
|
|
27509
|
+
},{"../util":164,"./chrome":160,"./firefox":161}],163:[function(require,module,exports){
|
|
27268
27510
|
'use strict';
|
|
27269
27511
|
|
|
27270
27512
|
var EventEmitter = require('events').EventEmitter;
|
|
@@ -27305,7 +27547,7 @@ EventTarget.prototype.removeEventListener = function removeEventListener() {
|
|
|
27305
27547
|
|
|
27306
27548
|
module.exports = EventTarget;
|
|
27307
27549
|
|
|
27308
|
-
},{"events":
|
|
27550
|
+
},{"events":178}],164:[function(require,module,exports){
|
|
27309
27551
|
'use strict';
|
|
27310
27552
|
|
|
27311
27553
|
/**
|
|
@@ -27642,7 +27884,7 @@ exports.makeUUID = makeUUID;
|
|
|
27642
27884
|
exports.proxyProperties = proxyProperties;
|
|
27643
27885
|
exports.support = support;
|
|
27644
27886
|
|
|
27645
|
-
},{}],
|
|
27887
|
+
},{}],165:[function(require,module,exports){
|
|
27646
27888
|
'use strict';
|
|
27647
27889
|
|
|
27648
27890
|
var defer = require('./').defer;
|
|
@@ -27757,7 +27999,7 @@ function createUnreachableStateError(from, to) {
|
|
|
27757
27999
|
|
|
27758
28000
|
module.exports = Latch;
|
|
27759
28001
|
|
|
27760
|
-
},{"./":
|
|
28002
|
+
},{"./":164}],166:[function(require,module,exports){
|
|
27761
28003
|
/* globals RTCPeerConnection, RTCRtpTransceiver */
|
|
27762
28004
|
|
|
27763
28005
|
'use strict';
|
|
@@ -28067,56 +28309,43 @@ exports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;
|
|
|
28067
28309
|
exports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;
|
|
28068
28310
|
exports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;
|
|
28069
28311
|
|
|
28070
|
-
},{"./":
|
|
28312
|
+
},{"./":164}],167:[function(require,module,exports){
|
|
28071
28313
|
module.exports={
|
|
28072
|
-
"
|
|
28073
|
-
"
|
|
28074
|
-
"
|
|
28075
|
-
"
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
"
|
|
28080
|
-
"
|
|
28081
|
-
"
|
|
28082
|
-
"
|
|
28083
|
-
"
|
|
28084
|
-
"scope": "@twilio",
|
|
28085
|
-
"rawSpec": "4.5.1",
|
|
28086
|
-
"saveSpec": null,
|
|
28087
|
-
"fetchSpec": "4.5.1"
|
|
28314
|
+
"name": "@twilio/webrtc",
|
|
28315
|
+
"version": "4.5.2",
|
|
28316
|
+
"description": "WebRTC-related APIs and shims used by twilio-video.js",
|
|
28317
|
+
"scripts": {
|
|
28318
|
+
"build": "npm-run-all clean lint test",
|
|
28319
|
+
"clean": "rimraf coverage",
|
|
28320
|
+
"lint": "eslint ./lib",
|
|
28321
|
+
"test:unit": "istanbul cover node_modules/mocha/bin/_mocha -- ./test/unit/index.js",
|
|
28322
|
+
"test:integration:native": "karma start karma/integration.conf.js",
|
|
28323
|
+
"test:integration:adapter": "karma start karma/integration.adapter.conf.js",
|
|
28324
|
+
"test:integration": "npm-run-all test:integration:*",
|
|
28325
|
+
"test": "npm-run-all test:*"
|
|
28088
28326
|
},
|
|
28089
|
-
"
|
|
28090
|
-
"
|
|
28091
|
-
|
|
28092
|
-
"_resolved": "https://registry.npmjs.org/@twilio/webrtc/-/webrtc-4.5.1.tgz",
|
|
28093
|
-
"_shasum": "9a69b8f3709624b215e9481097626b1d3ae879ba",
|
|
28094
|
-
"_spec": "@twilio/webrtc@4.5.1",
|
|
28095
|
-
"_where": "/home/circleci/project",
|
|
28096
|
-
"author": {
|
|
28097
|
-
"name": "Manjesh Malavalli",
|
|
28098
|
-
"email": "mmalavalli@twilio.com"
|
|
28327
|
+
"repository": {
|
|
28328
|
+
"type": "git",
|
|
28329
|
+
"url": "git+https://github.com/twilio/twilio-webrtc.js.git"
|
|
28099
28330
|
},
|
|
28331
|
+
"keywords": [
|
|
28332
|
+
"shim",
|
|
28333
|
+
"twilio",
|
|
28334
|
+
"video",
|
|
28335
|
+
"webrtc"
|
|
28336
|
+
],
|
|
28337
|
+
"author": "Manjesh Malavalli <mmalavalli@twilio.com>",
|
|
28338
|
+
"contributors": [
|
|
28339
|
+
"Mark Roberts <mroberts@twilio.com>",
|
|
28340
|
+
"Ryan Rowland <rrowland@twilio.com>",
|
|
28341
|
+
"Makarand Patwardhan <mpatwardhan@twilio.com>"
|
|
28342
|
+
],
|
|
28343
|
+
"license": "BSD-3-Clause",
|
|
28344
|
+
"main": "./lib/index.js",
|
|
28100
28345
|
"bugs": {
|
|
28101
28346
|
"url": "https://github.com/twilio/twilio-webrtc.js/issues"
|
|
28102
28347
|
},
|
|
28103
|
-
"
|
|
28104
|
-
"contributors": [
|
|
28105
|
-
{
|
|
28106
|
-
"name": "Mark Roberts",
|
|
28107
|
-
"email": "mroberts@twilio.com"
|
|
28108
|
-
},
|
|
28109
|
-
{
|
|
28110
|
-
"name": "Ryan Rowland",
|
|
28111
|
-
"email": "rrowland@twilio.com"
|
|
28112
|
-
},
|
|
28113
|
-
{
|
|
28114
|
-
"name": "Makarand Patwardhan",
|
|
28115
|
-
"email": "mpatwardhan@twilio.com"
|
|
28116
|
-
}
|
|
28117
|
-
],
|
|
28118
|
-
"deprecated": false,
|
|
28119
|
-
"description": "WebRTC-related APIs and shims used by twilio-video.js",
|
|
28348
|
+
"homepage": "https://github.com/twilio/twilio-webrtc.js#readme",
|
|
28120
28349
|
"devDependencies": {
|
|
28121
28350
|
"browserify": "^14.4.0",
|
|
28122
28351
|
"electron": "9.4.0",
|
|
@@ -28142,35 +28371,10 @@ module.exports={
|
|
|
28142
28371
|
"twilio-release-tool": "^1.0.0",
|
|
28143
28372
|
"watchify": "^4.0.0",
|
|
28144
28373
|
"webrtc-adapter": "^6.4.8"
|
|
28145
|
-
}
|
|
28146
|
-
"homepage": "https://github.com/twilio/twilio-webrtc.js#readme",
|
|
28147
|
-
"keywords": [
|
|
28148
|
-
"shim",
|
|
28149
|
-
"twilio",
|
|
28150
|
-
"video",
|
|
28151
|
-
"webrtc"
|
|
28152
|
-
],
|
|
28153
|
-
"license": "BSD-3-Clause",
|
|
28154
|
-
"main": "./lib/index.js",
|
|
28155
|
-
"name": "@twilio/webrtc",
|
|
28156
|
-
"repository": {
|
|
28157
|
-
"type": "git",
|
|
28158
|
-
"url": "git+https://github.com/twilio/twilio-webrtc.js.git"
|
|
28159
|
-
},
|
|
28160
|
-
"scripts": {
|
|
28161
|
-
"build": "npm-run-all clean lint test",
|
|
28162
|
-
"clean": "rimraf coverage",
|
|
28163
|
-
"lint": "eslint ./lib",
|
|
28164
|
-
"test": "npm-run-all test:*",
|
|
28165
|
-
"test:integration": "npm-run-all test:integration:*",
|
|
28166
|
-
"test:integration:adapter": "karma start karma/integration.adapter.conf.js",
|
|
28167
|
-
"test:integration:native": "karma start karma/integration.conf.js",
|
|
28168
|
-
"test:unit": "istanbul cover node_modules/mocha/bin/_mocha -- ./test/unit/index.js"
|
|
28169
|
-
},
|
|
28170
|
-
"version": "4.5.1"
|
|
28374
|
+
}
|
|
28171
28375
|
}
|
|
28172
28376
|
|
|
28173
|
-
},{}],
|
|
28377
|
+
},{}],168:[function(require,module,exports){
|
|
28174
28378
|
(function (global){(function (){
|
|
28175
28379
|
'use strict';
|
|
28176
28380
|
|
|
@@ -28201,7 +28405,7 @@ module.exports = function availableTypedArrays() {
|
|
|
28201
28405
|
};
|
|
28202
28406
|
|
|
28203
28407
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
28204
|
-
},{}],
|
|
28408
|
+
},{}],169:[function(require,module,exports){
|
|
28205
28409
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28206
28410
|
// Licensed under the MIT license.
|
|
28207
28411
|
|
|
@@ -28234,7 +28438,7 @@ module.exports.call = function(fn, vargs, callback) {
|
|
|
28234
28438
|
return new FunctionCall(fn, vargs, callback);
|
|
28235
28439
|
};
|
|
28236
28440
|
|
|
28237
|
-
},{"./lib/backoff":
|
|
28441
|
+
},{"./lib/backoff":170,"./lib/function_call.js":171,"./lib/strategy/exponential":172,"./lib/strategy/fibonacci":173}],170:[function(require,module,exports){
|
|
28238
28442
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28239
28443
|
// Licensed under the MIT license.
|
|
28240
28444
|
|
|
@@ -28301,7 +28505,7 @@ Backoff.prototype.reset = function() {
|
|
|
28301
28505
|
|
|
28302
28506
|
module.exports = Backoff;
|
|
28303
28507
|
|
|
28304
|
-
},{"events":
|
|
28508
|
+
},{"events":178,"precond":191,"util":197}],171:[function(require,module,exports){
|
|
28305
28509
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28306
28510
|
// Licensed under the MIT license.
|
|
28307
28511
|
|
|
@@ -28493,7 +28697,7 @@ FunctionCall.prototype.handleBackoff_ = function(number, delay, err) {
|
|
|
28493
28697
|
|
|
28494
28698
|
module.exports = FunctionCall;
|
|
28495
28699
|
|
|
28496
|
-
},{"./backoff":
|
|
28700
|
+
},{"./backoff":170,"./strategy/fibonacci":173,"events":178,"precond":191,"util":197}],172:[function(require,module,exports){
|
|
28497
28701
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28498
28702
|
// Licensed under the MIT license.
|
|
28499
28703
|
|
|
@@ -28536,7 +28740,7 @@ ExponentialBackoffStrategy.prototype.reset_ = function() {
|
|
|
28536
28740
|
|
|
28537
28741
|
module.exports = ExponentialBackoffStrategy;
|
|
28538
28742
|
|
|
28539
|
-
},{"./strategy":
|
|
28743
|
+
},{"./strategy":174,"precond":191,"util":197}],173:[function(require,module,exports){
|
|
28540
28744
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28541
28745
|
// Licensed under the MIT license.
|
|
28542
28746
|
|
|
@@ -28566,7 +28770,7 @@ FibonacciBackoffStrategy.prototype.reset_ = function() {
|
|
|
28566
28770
|
|
|
28567
28771
|
module.exports = FibonacciBackoffStrategy;
|
|
28568
28772
|
|
|
28569
|
-
},{"./strategy":
|
|
28773
|
+
},{"./strategy":174,"util":197}],174:[function(require,module,exports){
|
|
28570
28774
|
// Copyright (c) 2012 Mathieu Turcotte
|
|
28571
28775
|
// Licensed under the MIT license.
|
|
28572
28776
|
|
|
@@ -28648,7 +28852,7 @@ BackoffStrategy.prototype.reset_ = function() {
|
|
|
28648
28852
|
|
|
28649
28853
|
module.exports = BackoffStrategy;
|
|
28650
28854
|
|
|
28651
|
-
},{"events":
|
|
28855
|
+
},{"events":178,"util":197}],175:[function(require,module,exports){
|
|
28652
28856
|
'use strict';
|
|
28653
28857
|
|
|
28654
28858
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -28665,7 +28869,7 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
|
28665
28869
|
return intrinsic;
|
|
28666
28870
|
};
|
|
28667
28871
|
|
|
28668
|
-
},{"./":
|
|
28872
|
+
},{"./":176,"get-intrinsic":182}],176:[function(require,module,exports){
|
|
28669
28873
|
'use strict';
|
|
28670
28874
|
|
|
28671
28875
|
var bind = require('function-bind');
|
|
@@ -28714,7 +28918,7 @@ if ($defineProperty) {
|
|
|
28714
28918
|
module.exports.apply = applyBind;
|
|
28715
28919
|
}
|
|
28716
28920
|
|
|
28717
|
-
},{"function-bind":
|
|
28921
|
+
},{"function-bind":181,"get-intrinsic":182}],177:[function(require,module,exports){
|
|
28718
28922
|
'use strict';
|
|
28719
28923
|
|
|
28720
28924
|
var GetIntrinsic = require('get-intrinsic');
|
|
@@ -28731,7 +28935,7 @@ if ($gOPD) {
|
|
|
28731
28935
|
|
|
28732
28936
|
module.exports = $gOPD;
|
|
28733
28937
|
|
|
28734
|
-
},{"get-intrinsic":
|
|
28938
|
+
},{"get-intrinsic":182}],178:[function(require,module,exports){
|
|
28735
28939
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
28736
28940
|
//
|
|
28737
28941
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -29230,7 +29434,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
29230
29434
|
}
|
|
29231
29435
|
}
|
|
29232
29436
|
|
|
29233
|
-
},{}],
|
|
29437
|
+
},{}],179:[function(require,module,exports){
|
|
29234
29438
|
|
|
29235
29439
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
29236
29440
|
var toString = Object.prototype.toString;
|
|
@@ -29254,7 +29458,7 @@ module.exports = function forEach (obj, fn, ctx) {
|
|
|
29254
29458
|
};
|
|
29255
29459
|
|
|
29256
29460
|
|
|
29257
|
-
},{}],
|
|
29461
|
+
},{}],180:[function(require,module,exports){
|
|
29258
29462
|
'use strict';
|
|
29259
29463
|
|
|
29260
29464
|
/* eslint no-invalid-this: 1 */
|
|
@@ -29308,14 +29512,14 @@ module.exports = function bind(that) {
|
|
|
29308
29512
|
return bound;
|
|
29309
29513
|
};
|
|
29310
29514
|
|
|
29311
|
-
},{}],
|
|
29515
|
+
},{}],181:[function(require,module,exports){
|
|
29312
29516
|
'use strict';
|
|
29313
29517
|
|
|
29314
29518
|
var implementation = require('./implementation');
|
|
29315
29519
|
|
|
29316
29520
|
module.exports = Function.prototype.bind || implementation;
|
|
29317
29521
|
|
|
29318
|
-
},{"./implementation":
|
|
29522
|
+
},{"./implementation":180}],182:[function(require,module,exports){
|
|
29319
29523
|
'use strict';
|
|
29320
29524
|
|
|
29321
29525
|
var undefined;
|
|
@@ -29647,7 +29851,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
|
|
|
29647
29851
|
return value;
|
|
29648
29852
|
};
|
|
29649
29853
|
|
|
29650
|
-
},{"function-bind":
|
|
29854
|
+
},{"function-bind":181,"has":186,"has-symbols":183}],183:[function(require,module,exports){
|
|
29651
29855
|
'use strict';
|
|
29652
29856
|
|
|
29653
29857
|
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
@@ -29662,7 +29866,7 @@ module.exports = function hasNativeSymbols() {
|
|
|
29662
29866
|
return hasSymbolSham();
|
|
29663
29867
|
};
|
|
29664
29868
|
|
|
29665
|
-
},{"./shams":
|
|
29869
|
+
},{"./shams":184}],184:[function(require,module,exports){
|
|
29666
29870
|
'use strict';
|
|
29667
29871
|
|
|
29668
29872
|
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
@@ -29706,7 +29910,7 @@ module.exports = function hasSymbols() {
|
|
|
29706
29910
|
return true;
|
|
29707
29911
|
};
|
|
29708
29912
|
|
|
29709
|
-
},{}],
|
|
29913
|
+
},{}],185:[function(require,module,exports){
|
|
29710
29914
|
'use strict';
|
|
29711
29915
|
|
|
29712
29916
|
var hasSymbols = require('has-symbols/shams');
|
|
@@ -29715,14 +29919,14 @@ module.exports = function hasToStringTagShams() {
|
|
|
29715
29919
|
return hasSymbols() && !!Symbol.toStringTag;
|
|
29716
29920
|
};
|
|
29717
29921
|
|
|
29718
|
-
},{"has-symbols/shams":
|
|
29922
|
+
},{"has-symbols/shams":184}],186:[function(require,module,exports){
|
|
29719
29923
|
'use strict';
|
|
29720
29924
|
|
|
29721
29925
|
var bind = require('function-bind');
|
|
29722
29926
|
|
|
29723
29927
|
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
29724
29928
|
|
|
29725
|
-
},{"function-bind":
|
|
29929
|
+
},{"function-bind":181}],187:[function(require,module,exports){
|
|
29726
29930
|
if (typeof Object.create === 'function') {
|
|
29727
29931
|
// implementation from standard node.js 'util' module
|
|
29728
29932
|
module.exports = function inherits(ctor, superCtor) {
|
|
@@ -29751,7 +29955,7 @@ if (typeof Object.create === 'function') {
|
|
|
29751
29955
|
}
|
|
29752
29956
|
}
|
|
29753
29957
|
|
|
29754
|
-
},{}],
|
|
29958
|
+
},{}],188:[function(require,module,exports){
|
|
29755
29959
|
'use strict';
|
|
29756
29960
|
|
|
29757
29961
|
var hasToStringTag = require('has-tostringtag/shams')();
|
|
@@ -29786,7 +29990,7 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
|
|
|
29786
29990
|
|
|
29787
29991
|
module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
|
|
29788
29992
|
|
|
29789
|
-
},{"call-bind/callBound":
|
|
29993
|
+
},{"call-bind/callBound":175,"has-tostringtag/shams":185}],189:[function(require,module,exports){
|
|
29790
29994
|
'use strict';
|
|
29791
29995
|
|
|
29792
29996
|
var toStr = Object.prototype.toString;
|
|
@@ -29826,7 +30030,7 @@ module.exports = function isGeneratorFunction(fn) {
|
|
|
29826
30030
|
return getProto(fn) === GeneratorFunction;
|
|
29827
30031
|
};
|
|
29828
30032
|
|
|
29829
|
-
},{"has-tostringtag/shams":
|
|
30033
|
+
},{"has-tostringtag/shams":185}],190:[function(require,module,exports){
|
|
29830
30034
|
(function (global){(function (){
|
|
29831
30035
|
'use strict';
|
|
29832
30036
|
|
|
@@ -29890,14 +30094,14 @@ module.exports = function isTypedArray(value) {
|
|
|
29890
30094
|
};
|
|
29891
30095
|
|
|
29892
30096
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
29893
|
-
},{"available-typed-arrays":
|
|
30097
|
+
},{"available-typed-arrays":168,"call-bind/callBound":175,"es-abstract/helpers/getOwnPropertyDescriptor":177,"foreach":179,"has-tostringtag/shams":185}],191:[function(require,module,exports){
|
|
29894
30098
|
/*
|
|
29895
30099
|
* Copyright (c) 2012 Mathieu Turcotte
|
|
29896
30100
|
* Licensed under the MIT license.
|
|
29897
30101
|
*/
|
|
29898
30102
|
|
|
29899
30103
|
module.exports = require('./lib/checks');
|
|
29900
|
-
},{"./lib/checks":
|
|
30104
|
+
},{"./lib/checks":192}],192:[function(require,module,exports){
|
|
29901
30105
|
/*
|
|
29902
30106
|
* Copyright (c) 2012 Mathieu Turcotte
|
|
29903
30107
|
* Licensed under the MIT license.
|
|
@@ -29993,7 +30197,7 @@ module.exports.checkIsBoolean = typeCheck('boolean');
|
|
|
29993
30197
|
module.exports.checkIsFunction = typeCheck('function');
|
|
29994
30198
|
module.exports.checkIsObject = typeCheck('object');
|
|
29995
30199
|
|
|
29996
|
-
},{"./errors":
|
|
30200
|
+
},{"./errors":193,"util":197}],193:[function(require,module,exports){
|
|
29997
30201
|
/*
|
|
29998
30202
|
* Copyright (c) 2012 Mathieu Turcotte
|
|
29999
30203
|
* Licensed under the MIT license.
|
|
@@ -30019,7 +30223,7 @@ IllegalStateError.prototype.name = 'IllegalStateError';
|
|
|
30019
30223
|
|
|
30020
30224
|
module.exports.IllegalStateError = IllegalStateError;
|
|
30021
30225
|
module.exports.IllegalArgumentError = IllegalArgumentError;
|
|
30022
|
-
},{"util":
|
|
30226
|
+
},{"util":197}],194:[function(require,module,exports){
|
|
30023
30227
|
// shim for using process in browser
|
|
30024
30228
|
var process = module.exports = {};
|
|
30025
30229
|
|
|
@@ -30205,14 +30409,14 @@ process.chdir = function (dir) {
|
|
|
30205
30409
|
};
|
|
30206
30410
|
process.umask = function() { return 0; };
|
|
30207
30411
|
|
|
30208
|
-
},{}],
|
|
30412
|
+
},{}],195:[function(require,module,exports){
|
|
30209
30413
|
module.exports = function isBuffer(arg) {
|
|
30210
30414
|
return arg && typeof arg === 'object'
|
|
30211
30415
|
&& typeof arg.copy === 'function'
|
|
30212
30416
|
&& typeof arg.fill === 'function'
|
|
30213
30417
|
&& typeof arg.readUInt8 === 'function';
|
|
30214
30418
|
}
|
|
30215
|
-
},{}],
|
|
30419
|
+
},{}],196:[function(require,module,exports){
|
|
30216
30420
|
// Currently in sync with Node.js lib/internal/util/types.js
|
|
30217
30421
|
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
|
|
30218
30422
|
|
|
@@ -30548,7 +30752,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
|
30548
30752
|
});
|
|
30549
30753
|
});
|
|
30550
30754
|
|
|
30551
|
-
},{"is-arguments":
|
|
30755
|
+
},{"is-arguments":188,"is-generator-function":189,"is-typed-array":190,"which-typed-array":198}],197:[function(require,module,exports){
|
|
30552
30756
|
(function (process){(function (){
|
|
30553
30757
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
30554
30758
|
//
|
|
@@ -31267,7 +31471,7 @@ function callbackify(original) {
|
|
|
31267
31471
|
exports.callbackify = callbackify;
|
|
31268
31472
|
|
|
31269
31473
|
}).call(this)}).call(this,require('_process'))
|
|
31270
|
-
},{"./support/isBuffer":
|
|
31474
|
+
},{"./support/isBuffer":195,"./support/types":196,"_process":194,"inherits":187}],198:[function(require,module,exports){
|
|
31271
31475
|
(function (global){(function (){
|
|
31272
31476
|
'use strict';
|
|
31273
31477
|
|
|
@@ -31326,12 +31530,12 @@ module.exports = function whichTypedArray(value) {
|
|
|
31326
31530
|
};
|
|
31327
31531
|
|
|
31328
31532
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
31329
|
-
},{"available-typed-arrays":
|
|
31533
|
+
},{"available-typed-arrays":168,"call-bind/callBound":175,"es-abstract/helpers/getOwnPropertyDescriptor":177,"foreach":179,"has-tostringtag/shams":185,"is-typed-array":190}],199:[function(require,module,exports){
|
|
31330
31534
|
module.exports={
|
|
31331
31535
|
"name": "twilio-video",
|
|
31332
31536
|
"title": "Twilio Video",
|
|
31333
31537
|
"description": "Twilio Video JavaScript Library",
|
|
31334
|
-
"version": "2.
|
|
31538
|
+
"version": "2.20.0",
|
|
31335
31539
|
"homepage": "https://twilio.com",
|
|
31336
31540
|
"author": "Mark Andrus Roberts <mroberts@twilio.com>",
|
|
31337
31541
|
"contributors": [
|
|
@@ -31465,7 +31669,7 @@ module.exports={
|
|
|
31465
31669
|
"test:framework:install": "npm install chromedriver && npm install selenium-webdriver && npm install geckodriver && npm install puppeteer",
|
|
31466
31670
|
"test:framework": "npm-run-all test:framework:install test:framework:no-framework test:framework:react",
|
|
31467
31671
|
"test": "npm-run-all test:unit test:integration",
|
|
31468
|
-
"build:es5": "rimraf ./es5 && tsc tsdef/twilio-video-tests.ts --noEmit && tsc",
|
|
31672
|
+
"build:es5": "rimraf ./es5 && tsc tsdef/twilio-video-tests.ts --noEmit --lib es2018,dom && tsc ",
|
|
31469
31673
|
"build:js": "node ./scripts/build.js ./src/twilio-video.js ./LICENSE.md ./dist/twilio-video.js",
|
|
31470
31674
|
"build:min.js": "uglifyjs ./dist/twilio-video.js -o ./dist/twilio-video.min.js --comments \"/^! twilio-video.js/\" -b beautify=false,ascii_only=true",
|
|
31471
31675
|
"build": "npm-run-all clean lint docs test:unit test:integration build:es5 build:js build:min.js test:umd",
|
|
@@ -31475,7 +31679,7 @@ module.exports={
|
|
|
31475
31679
|
"clean": "rimraf ./coverage ./es5 ./dist"
|
|
31476
31680
|
},
|
|
31477
31681
|
"dependencies": {
|
|
31478
|
-
"@twilio/webrtc": "4.5.
|
|
31682
|
+
"@twilio/webrtc": "4.5.2",
|
|
31479
31683
|
"backoff": "^2.5.0",
|
|
31480
31684
|
"ws": "^7.4.6",
|
|
31481
31685
|
"xmlhttprequest": "^1.8.0"
|
|
@@ -31486,7 +31690,7 @@ module.exports={
|
|
|
31486
31690
|
}
|
|
31487
31691
|
}
|
|
31488
31692
|
|
|
31489
|
-
},{}],
|
|
31693
|
+
},{}],200:[function(require,module,exports){
|
|
31490
31694
|
module.exports = WebSocket;
|
|
31491
31695
|
|
|
31492
31696
|
},{}]},{},[11]);
|