twilio-video 2.18.3 → 2.19.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -1
  4. package/dist/twilio-video.js +709 -258
  5. package/dist/twilio-video.min.js +23 -23
  6. package/es5/connect.js +24 -3
  7. package/es5/connect.js.map +1 -1
  8. package/es5/encodingparameters.js +5 -1
  9. package/es5/encodingparameters.js.map +1 -1
  10. package/es5/localparticipant.js +4 -0
  11. package/es5/localparticipant.js.map +1 -1
  12. package/es5/media/track/sender.js +50 -2
  13. package/es5/media/track/sender.js.map +1 -1
  14. package/es5/signaling/v2/cancelableroomsignalingpromise.js +2 -0
  15. package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
  16. package/es5/signaling/v2/localparticipant.js +35 -1
  17. package/es5/signaling/v2/localparticipant.js.map +1 -1
  18. package/es5/signaling/v2/peerconnection.js +225 -47
  19. package/es5/signaling/v2/peerconnection.js.map +1 -1
  20. package/es5/signaling/v2/peerconnectionmanager.js +8 -0
  21. package/es5/signaling/v2/peerconnectionmanager.js.map +1 -1
  22. package/es5/signaling/v2/publisherhintsignaling.js +85 -0
  23. package/es5/signaling/v2/publisherhintsignaling.js.map +1 -0
  24. package/es5/signaling/v2/renderhintssignaling.js +28 -17
  25. package/es5/signaling/v2/renderhintssignaling.js.map +1 -1
  26. package/es5/signaling/v2/room.js +33 -1
  27. package/es5/signaling/v2/room.js.map +1 -1
  28. package/es5/signaling/v2/twilioconnectiontransport.js +4 -1
  29. package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
  30. package/es5/util/index.js +22 -6
  31. package/es5/util/index.js.map +1 -1
  32. package/es5/util/sdp/index.js +7 -3
  33. package/es5/util/sdp/index.js.map +1 -1
  34. package/es5/util/sdp/simulcast.js.map +1 -1
  35. package/lib/connect.js +29 -3
  36. package/lib/encodingparameters.js +5 -1
  37. package/lib/localparticipant.js +5 -0
  38. package/lib/media/track/sender.js +36 -2
  39. package/lib/signaling/v2/cancelableroomsignalingpromise.js +2 -0
  40. package/lib/signaling/v2/localparticipant.js +41 -1
  41. package/lib/signaling/v2/peerconnection.js +224 -49
  42. package/lib/signaling/v2/peerconnectionmanager.js +9 -0
  43. package/lib/signaling/v2/publisherhintsignaling.js +71 -0
  44. package/lib/signaling/v2/renderhintssignaling.js +28 -17
  45. package/lib/signaling/v2/room.js +37 -1
  46. package/lib/signaling/v2/twilioconnectiontransport.js +4 -0
  47. package/lib/util/index.js +21 -6
  48. package/lib/util/sdp/index.js +6 -3
  49. package/lib/util/sdp/simulcast.js +0 -1
  50. package/package.json +1 -1
  51. package/tsdef/twilio-video-tests.ts +6 -0
  52. package/tsdef/types.d.ts +2 -1
@@ -1,9 +1,9 @@
1
- /*! twilio-video.js 2.18.3
1
+ /*! twilio-video.js 2.19.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-2021 Twilio, inc.
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":119}],2:[function(require,module,exports){
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>} [preferredVideoCodecs=[]] -
498
- * Preferred video codecs; An empty array preserves the current video codec
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":126,"./util/cancelablepromise":119,"./util/constants":120,"./util/eventobserver":124,"./util/insightspublisher":127,"./util/insightspublisher/null":128,"./util/log":130,"./util/validate":145,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],3:[function(require,module,exports){
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":146,"@twilio/webrtc":153,"@twilio/webrtc/lib/util":166}],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":120}],4:[function(require,module,exports){
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":126,"./util/constants":120,"./util/log":130,"./webaudio/workaround180748":149,"@twilio/webrtc":152}],5:[function(require,module,exports){
1269
+ },{"./media/track/es5":14,"./util":127,"./util/constants":121,"./util/log":131,"./webaudio/workaround180748":150,"@twilio/webrtc":153}],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":126,"./transceiver":7}],7:[function(require,module,exports){
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":115}],8:[function(require,module,exports){
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":179}],9:[function(require,module,exports){
1625
+ },{"events":180}],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":179}],10:[function(require,module,exports){
1723
+ },{"events":180}],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":126,"events":179}],11:[function(require,module,exports){
1729
+ },{"./util":127,"events":180}],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":200,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":48,"./util/support":141,"./vendor/loglevel":146}],12:[function(require,module,exports){
1792
+ },{"../package.json":201,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":48,"./util/support":142,"./vendor/loglevel":147}],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":126,"./util/constants":120,"./util/validate":145,"@twilio/webrtc":152}],13:[function(require,module,exports){
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":146,"@twilio/webrtc":153}],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":198}],16:[function(require,module,exports){
2660
+ },{"../localaudiotrack":19,"util":199}],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":198}],17:[function(require,module,exports){
2675
+ },{"../localdatatrack":21,"util":199}],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":198}],18:[function(require,module,exports){
2690
+ },{"../localvideotrack":25,"util":199}],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":126,"../../util/constants":120,"../../util/log":130}],19:[function(require,module,exports){
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) {
@@ -3513,7 +3542,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3513
3542
  }
3514
3543
  module.exports = mixinLocalMediaTrack;
3515
3544
 
3516
- },{"../../util":126,"../../util/constants":120,"../../util/detectsilentaudio":121,"../../util/detectsilentvideo":122,"../../util/documentvisibilitymonitor.js":123,"../../util/localmediarestartdeferreds":129,"../../webaudio/workaround180748":149,"./sender":37,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],24:[function(require,module,exports){
3545
+ },{"../../util":127,"../../util/constants":121,"../../util/detectsilentaudio":122,"../../util/detectsilentvideo":123,"../../util/documentvisibilitymonitor.js":124,"../../util/localmediarestartdeferreds":130,"../../webaudio/workaround180748":150,"./sender":37,"@twilio/webrtc":153,"@twilio/webrtc/lib/util":166}],24:[function(require,module,exports){
3517
3546
  /* eslint new-cap:0 */
3518
3547
  'use strict';
3519
3548
  var __extends = (this && this.__extends) || (function () {
@@ -3627,7 +3656,7 @@ var LocalTrackPublication = /** @class */ (function (_super) {
3627
3656
  }(TrackPublication));
3628
3657
  module.exports = LocalTrackPublication;
3629
3658
 
3630
- },{"../../util/constants":120,"./trackpublication":38}],25:[function(require,module,exports){
3659
+ },{"../../util/constants":121,"./trackpublication":38}],25:[function(require,module,exports){
3631
3660
  'use strict';
3632
3661
  var __extends = (this && this.__extends) || (function () {
3633
3662
  var extendStatics = function (d, b) {
@@ -3974,7 +4003,7 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
3974
4003
  */
3975
4004
  module.exports = LocalVideoTrack;
3976
4005
 
3977
- },{"../../util":126,"../../util/detectsilentvideo":122,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":165}],26:[function(require,module,exports){
4006
+ },{"../../util":127,"../../util/detectsilentvideo":123,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":166}],26:[function(require,module,exports){
3978
4007
  'use strict';
3979
4008
  var __extends = (this && this.__extends) || (function () {
3980
4009
  var extendStatics = function (d, b) {
@@ -4384,7 +4413,7 @@ function shimMediaElement(el, onUnintentionallyPaused) {
4384
4413
  }
4385
4414
  module.exports = MediaTrack;
4386
4415
 
4387
- },{"../../util":126,"../../util/localmediarestartdeferreds":129,"./":18,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],28:[function(require,module,exports){
4416
+ },{"../../util":127,"../../util/localmediarestartdeferreds":130,"./":18,"@twilio/webrtc":153,"@twilio/webrtc/lib/util":166}],28:[function(require,module,exports){
4388
4417
  'use strict';
4389
4418
  var __extends = (this && this.__extends) || (function () {
4390
4419
  var extendStatics = function (d, b) {
@@ -4776,7 +4805,7 @@ var RemoteDataTrack = /** @class */ (function (_super) {
4776
4805
  */
4777
4806
  module.exports = RemoteDataTrack;
4778
4807
 
4779
- },{"../../util/constants":120,"./":18}],32:[function(require,module,exports){
4808
+ },{"../../util/constants":121,"./":18}],32:[function(require,module,exports){
4780
4809
  'use strict';
4781
4810
  var __extends = (this && this.__extends) || (function () {
4782
4811
  var extendStatics = function (d, b) {
@@ -5124,7 +5153,7 @@ function playIfPausedWhileInBackground(remoteMediaTrack) {
5124
5153
  */
5125
5154
  module.exports = mixinRemoteMediaTrack;
5126
5155
 
5127
- },{"../../util/constants":120,"../../util/documentvisibilitymonitor.js":123,"@twilio/webrtc/lib/util":165}],34:[function(require,module,exports){
5156
+ },{"../../util/constants":121,"../../util/documentvisibilitymonitor.js":124,"@twilio/webrtc/lib/util":166}],34:[function(require,module,exports){
5128
5157
  'use strict';
5129
5158
  var __extends = (this && this.__extends) || (function () {
5130
5159
  var extendStatics = function (d, b) {
@@ -5753,7 +5782,7 @@ function maybeUpdateDimensionHint(remoteVideoTrack) {
5753
5782
  */
5754
5783
  module.exports = RemoteVideoTrack;
5755
5784
 
5756
- },{"../../util/documentvisibilitymonitor.js":123,"../../util/nullobserver.js":133,"../../util/timeout":142,"./remotemediatrack":33,"./videotrack":41}],36:[function(require,module,exports){
5785
+ },{"../../util/documentvisibilitymonitor.js":124,"../../util/nullobserver.js":134,"../../util/timeout":143,"./remotemediatrack":33,"./videotrack":41}],36:[function(require,module,exports){
5757
5786
  'use strict';
5758
5787
  var __extends = (this && this.__extends) || (function () {
5759
5788
  var extendStatics = function (d, b) {
@@ -5842,10 +5871,27 @@ var __extends = (this && this.__extends) || (function () {
5842
5871
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5843
5872
  };
5844
5873
  })();
5874
+ var __read = (this && this.__read) || function (o, n) {
5875
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5876
+ if (!m) return o;
5877
+ var i = m.call(o), r, ar = [], e;
5878
+ try {
5879
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
5880
+ }
5881
+ catch (error) { e = { error: error }; }
5882
+ finally {
5883
+ try {
5884
+ if (r && !r.done && (m = i["return"])) m.call(i);
5885
+ }
5886
+ finally { if (e) throw e.error; }
5887
+ }
5888
+ return ar;
5889
+ };
5845
5890
  var MediaTrackTransceiver = require('./transceiver');
5846
5891
  /**
5847
5892
  * A {@link MediaTrackSender} represents one or more local RTCRtpSenders.
5848
5893
  * @extends MediaTrackTransceiver
5894
+ * @emits MediaTrackSender#replaced
5849
5895
  */
5850
5896
  var MediaTrackSender = /** @class */ (function (_super) {
5851
5897
  __extends(MediaTrackSender, _super);
@@ -5862,6 +5908,9 @@ var MediaTrackSender = /** @class */ (function (_super) {
5862
5908
  _senders: {
5863
5909
  value: new Set()
5864
5910
  },
5911
+ _senderToPublisherHintCallbacks: {
5912
+ value: new Map()
5913
+ },
5865
5914
  isPublishing: {
5866
5915
  get: function () {
5867
5916
  return !!this._clones.size;
@@ -5899,7 +5948,7 @@ var MediaTrackSender = /** @class */ (function (_super) {
5899
5948
  return Promise.all(clones.map(function (clone) {
5900
5949
  return clone.setMediaStreamTrack(mediaStreamTrack.clone());
5901
5950
  }).concat(senders.map(function (sender) {
5902
- return sender.replaceTrack(mediaStreamTrack);
5951
+ return _this._replaceTrack(sender, mediaStreamTrack);
5903
5952
  }))).finally(function () {
5904
5953
  _this._track = mediaStreamTrack;
5905
5954
  });
@@ -5907,10 +5956,14 @@ var MediaTrackSender = /** @class */ (function (_super) {
5907
5956
  /**
5908
5957
  * Add an RTCRtpSender.
5909
5958
  * @param {RTCRtpSender} sender
5959
+ * @param {?()=>Promise<string>} publisherHintCallback
5910
5960
  * @returns {this}
5911
5961
  */
5912
- MediaTrackSender.prototype.addSender = function (sender) {
5962
+ MediaTrackSender.prototype.addSender = function (sender, publisherHintCallback) {
5913
5963
  this._senders.add(sender);
5964
+ if (publisherHintCallback) {
5965
+ this._senderToPublisherHintCallbacks.set(sender, publisherHintCallback);
5966
+ }
5914
5967
  return this;
5915
5968
  };
5916
5969
  /**
@@ -5920,10 +5973,34 @@ var MediaTrackSender = /** @class */ (function (_super) {
5920
5973
  */
5921
5974
  MediaTrackSender.prototype.removeSender = function (sender) {
5922
5975
  this._senders.delete(sender);
5976
+ this._senderToPublisherHintCallbacks.delete(sender);
5923
5977
  return this;
5924
5978
  };
5979
+ /**
5980
+ * Applies given encodings, or resets encodings if none specified.
5981
+ * @param {Array<{enabled: boolean, layer_index: number}>|null} encodings
5982
+ * @returns {Promise<string>}
5983
+ */
5984
+ MediaTrackSender.prototype.setPublisherHint = function (encodings) {
5985
+ // Note(mpatwardhan): since publisher hint applies only to group rooms we only look at 1st call callback.
5986
+ var _a = __read(Array.from(this._senderToPublisherHintCallbacks.values()), 1), publisherHintCallback = _a[0];
5987
+ return publisherHintCallback ? publisherHintCallback(encodings) : Promise.resolve('COULD_NOT_APPLY_HINT');
5988
+ };
5989
+ MediaTrackSender.prototype._replaceTrack = function (sender, mediaStreamTrack) {
5990
+ var _this = this;
5991
+ return sender.replaceTrack(mediaStreamTrack).then(function (replaceTrackResult) {
5992
+ // clear any publisherHints and apply default encodings.
5993
+ _this.setPublisherHint(null).catch(function () { });
5994
+ _this.emit('replaced');
5995
+ return replaceTrackResult;
5996
+ });
5997
+ };
5925
5998
  return MediaTrackSender;
5926
5999
  }(MediaTrackTransceiver));
6000
+ /**
6001
+ * The {@link MediaTrackSender} replaced the underlying mediaStreamTrack
6002
+ * @event MediaTrackSender#replaced
6003
+ */
5927
6004
  module.exports = MediaTrackSender;
5928
6005
 
5929
6006
  },{"./transceiver":39}],38:[function(require,module,exports){
@@ -6023,7 +6100,7 @@ var TrackPublication = /** @class */ (function (_super) {
6023
6100
  */
6024
6101
  module.exports = TrackPublication;
6025
6102
 
6026
- },{"../../eventemitter":10,"../../util":126,"../../util/constants":120,"../../util/log":130}],39:[function(require,module,exports){
6103
+ },{"../../eventemitter":10,"../../util":127,"../../util/constants":121,"../../util/log":131}],39:[function(require,module,exports){
6027
6104
  'use strict';
6028
6105
  var __extends = (this && this.__extends) || (function () {
6029
6106
  var extendStatics = function (d, b) {
@@ -6090,7 +6167,7 @@ var MediaTrackTransceiver = /** @class */ (function (_super) {
6090
6167
  }(TrackTransceiver));
6091
6168
  module.exports = MediaTrackTransceiver;
6092
6169
 
6093
- },{"../../transceiver":115}],40:[function(require,module,exports){
6170
+ },{"../../transceiver":116}],40:[function(require,module,exports){
6094
6171
  'use strict';
6095
6172
  var __extends = (this && this.__extends) || (function () {
6096
6173
  var extendStatics = function (d, b) {
@@ -6245,7 +6322,7 @@ var VideoProcessorEventObserver = /** @class */ (function (_super) {
6245
6322
  }(EventEmitter));
6246
6323
  module.exports = VideoProcessorEventObserver;
6247
6324
 
6248
- },{"../../util/constants":120,"events":179}],41:[function(require,module,exports){
6325
+ },{"../../util/constants":121,"events":180}],41:[function(require,module,exports){
6249
6326
  'use strict';
6250
6327
  var __extends = (this && this.__extends) || (function () {
6251
6328
  var extendStatics = function (d, b) {
@@ -6759,7 +6836,7 @@ function dimensionsChanged(track, elem) {
6759
6836
  */
6760
6837
  module.exports = VideoTrack;
6761
6838
 
6762
- },{"../../util/constants":120,"./mediatrack":27,"./videoprocessoreventobserver":40}],42:[function(require,module,exports){
6839
+ },{"../../util/constants":121,"./mediatrack":27,"./videoprocessoreventobserver":40}],42:[function(require,module,exports){
6763
6840
  'use strict';
6764
6841
  var __extends = (this && this.__extends) || (function () {
6765
6842
  var extendStatics = function (d, b) {
@@ -6858,7 +6935,7 @@ var NetworkQualityConfigurationImpl = /** @class */ (function (_super) {
6858
6935
  }(EventEmitter));
6859
6936
  module.exports = NetworkQualityConfigurationImpl;
6860
6937
 
6861
- },{"./util":126,"./util/constants":120,"events":179}],43:[function(require,module,exports){
6938
+ },{"./util":127,"./util/constants":121,"events":180}],43:[function(require,module,exports){
6862
6939
  'use strict';
6863
6940
  var __extends = (this && this.__extends) || (function () {
6864
6941
  var extendStatics = function (d, b) {
@@ -7475,7 +7552,7 @@ function reemitTrackPublicationEvents(participant, publication) {
7475
7552
  }
7476
7553
  module.exports = Participant;
7477
7554
 
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":126}],44:[function(require,module,exports){
7555
+ },{"./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
7556
  "use strict";
7480
7557
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7481
7558
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -7672,7 +7749,7 @@ function getTurnCredentials(token, wsServer) {
7672
7749
  }
7673
7750
  exports.getTurnCredentials = getTurnCredentials;
7674
7751
 
7675
- },{"../twilioconnection.js":116,"../util/constants":120,"events":179}],46:[function(require,module,exports){
7752
+ },{"../twilioconnection.js":117,"../util/constants":121,"events":180}],46:[function(require,module,exports){
7676
7753
  "use strict";
7677
7754
  var __read = (this && this.__read) || function (o, n) {
7678
7755
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -8378,7 +8455,7 @@ function runPreflight(token, options) {
8378
8455
  }
8379
8456
  exports.runPreflight = runPreflight;
8380
8457
 
8381
- },{"../eventemitter":10,"../util":126,"../util/constants":120,"../util/eventobserver":124,"../util/insightspublisher":127,"../util/log":130,"../util/movingaveragedelta":131,"../util/sid":140,"./getCombinedConnectionStats":44,"./getturncredentials":45,"./makestat":46,"./mos":47,"./syntheticaudio":49,"./syntheticvideo":50,"./timer":51}],49:[function(require,module,exports){
8458
+ },{"../eventemitter":10,"../util":127,"../util/constants":121,"../util/eventobserver":125,"../util/insightspublisher":128,"../util/log":131,"../util/movingaveragedelta":132,"../util/sid":141,"./getCombinedConnectionStats":44,"./getturncredentials":45,"./makestat":46,"./mos":47,"./syntheticaudio":49,"./syntheticvideo":50,"./timer":51}],49:[function(require,module,exports){
8382
8459
  "use strict";
8383
8460
  Object.defineProperty(exports, "__esModule", { value: true });
8384
8461
  exports.syntheticAudio = void 0;
@@ -8401,7 +8478,7 @@ function syntheticAudio() {
8401
8478
  }
8402
8479
  exports.syntheticAudio = syntheticAudio;
8403
8480
 
8404
- },{"../webaudio/audiocontext":147}],50:[function(require,module,exports){
8481
+ },{"../webaudio/audiocontext":148}],50:[function(require,module,exports){
8405
8482
  "use strict";
8406
8483
  Object.defineProperty(exports, "__esModule", { value: true });
8407
8484
  exports.syntheticVideo = void 0;
@@ -8566,7 +8643,7 @@ var QueueingEventEmitter = /** @class */ (function (_super) {
8566
8643
  }(EventEmitter));
8567
8644
  module.exports = QueueingEventEmitter;
8568
8645
 
8569
- },{"events":179}],53:[function(require,module,exports){
8646
+ },{"events":180}],53:[function(require,module,exports){
8570
8647
  'use strict';
8571
8648
  var __extends = (this && this.__extends) || (function () {
8572
8649
  var extendStatics = function (d, b) {
@@ -9403,7 +9480,7 @@ function handleSignalingEvents(room, signaling) {
9403
9480
  }
9404
9481
  module.exports = Room;
9405
9482
 
9406
- },{"./eventemitter":10,"./remoteparticipant":53,"./stats/statsreport":112,"./util":126}],55:[function(require,module,exports){
9483
+ },{"./eventemitter":10,"./remoteparticipant":53,"./stats/statsreport":113,"./util":127}],55:[function(require,module,exports){
9407
9484
  /* eslint consistent-return:0 */
9408
9485
  'use strict';
9409
9486
  var __extends = (this && this.__extends) || (function () {
@@ -9573,7 +9650,7 @@ var Signaling = /** @class */ (function (_super) {
9573
9650
  }(StateMachine));
9574
9651
  module.exports = Signaling;
9575
9652
 
9576
- },{"../statemachine":84,"./participant":58,"./room":62}],56:[function(require,module,exports){
9653
+ },{"../statemachine":85,"./participant":58,"./room":62}],56:[function(require,module,exports){
9577
9654
  'use strict';
9578
9655
  var __extends = (this && this.__extends) || (function () {
9579
9656
  var extendStatics = function (d, b) {
@@ -10009,7 +10086,7 @@ var ParticipantSignaling = /** @class */ (function (_super) {
10009
10086
  */
10010
10087
  module.exports = ParticipantSignaling;
10011
10088
 
10012
- },{"../statemachine":84,"../stats/networkqualitystats":99}],59:[function(require,module,exports){
10089
+ },{"../statemachine":85,"../stats/networkqualitystats":100}],59:[function(require,module,exports){
10013
10090
  'use strict';
10014
10091
  var __extends = (this && this.__extends) || (function () {
10015
10092
  var extendStatics = function (d, b) {
@@ -10082,7 +10159,7 @@ var RecordingSignaling = /** @class */ (function (_super) {
10082
10159
  */
10083
10160
  module.exports = RecordingSignaling;
10084
10161
 
10085
- },{"events":179}],60:[function(require,module,exports){
10162
+ },{"events":180}],60:[function(require,module,exports){
10086
10163
  'use strict';
10087
10164
  var __extends = (this && this.__extends) || (function () {
10088
10165
  var extendStatics = function (d, b) {
@@ -10508,7 +10585,7 @@ function maybeUpdateState(roomSignaling) {
10508
10585
  }
10509
10586
  module.exports = RoomSignaling;
10510
10587
 
10511
- },{"../statemachine":84,"../util":126,"../util/constants":120,"../util/log":130,"../util/timeout":142,"../util/twilio-video-errors":143,"./recording":59}],63:[function(require,module,exports){
10588
+ },{"../statemachine":85,"../util":127,"../util/constants":121,"../util/log":131,"../util/timeout":143,"../util/twilio-video-errors":144,"./recording":59}],63:[function(require,module,exports){
10512
10589
  'use strict';
10513
10590
  var __extends = (this && this.__extends) || (function () {
10514
10591
  var extendStatics = function (d, b) {
@@ -10691,7 +10768,7 @@ var TrackSignaling = /** @class */ (function (_super) {
10691
10768
  */
10692
10769
  module.exports = TrackSignaling;
10693
10770
 
10694
- },{"events":179}],64:[function(require,module,exports){
10771
+ },{"events":180}],64:[function(require,module,exports){
10695
10772
  'use strict';
10696
10773
  var CancelablePromise = require('../../util/cancelablepromise');
10697
10774
  var DefaultPeerConnectionManager = require('./peerconnectionmanager');
@@ -10705,6 +10782,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10705
10782
  RoomV2: DefaultRoomV2,
10706
10783
  Transport: DefaultTransport
10707
10784
  }, options);
10785
+ var adaptiveSimulcast = preferredCodecs.video[0] && preferredCodecs.video[0].adaptiveSimulcast === true;
10708
10786
  var PeerConnectionManager = options.PeerConnectionManager, RoomV2 = options.RoomV2, Transport = options.Transport, iceServers = options.iceServers, log = options.log;
10709
10787
  var peerConnectionManager = new PeerConnectionManager(encodingParameters, preferredCodecs, options);
10710
10788
  var trackSenders = flatMap(localParticipant.tracks, function (trackV2) { return [trackV2.trackTransceiver]; });
@@ -10745,6 +10823,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10745
10823
  var renderHints = !!bandwidthProfile &&
10746
10824
  (options.clientTrackSwitchOffControl !== 'disabled' || options.contentPreferencesMode !== 'disabled');
10747
10825
  var transportOptions = Object.assign({
10826
+ adaptiveSimulcast: adaptiveSimulcast,
10748
10827
  automaticSubscription: automaticSubscription,
10749
10828
  dominantSpeaker: dominantSpeaker,
10750
10829
  environment: environment,
@@ -10807,7 +10886,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10807
10886
  }
10808
10887
  module.exports = createCancelableRoomSignalingPromise;
10809
10888
 
10810
- },{"../../util":126,"../../util/cancelablepromise":119,"../../util/twilio-video-errors":143,"./peerconnectionmanager":75,"./room":80,"./twilioconnectiontransport":83}],65:[function(require,module,exports){
10889
+ },{"../../util":127,"../../util/cancelablepromise":120,"../../util/twilio-video-errors":144,"./peerconnectionmanager":75,"./room":81,"./twilioconnectiontransport":84}],65:[function(require,module,exports){
10811
10890
  'use strict';
10812
10891
  var __extends = (this && this.__extends) || (function () {
10813
10892
  var extendStatics = function (d, b) {
@@ -10953,7 +11032,7 @@ var IceBox = /** @class */ (function () {
10953
11032
  }());
10954
11033
  module.exports = IceBox;
10955
11034
 
10956
- },{"../../util/filter":125}],67:[function(require,module,exports){
11035
+ },{"../../util/filter":126}],67:[function(require,module,exports){
10957
11036
  'use strict';
10958
11037
  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
11038
  /**
@@ -11090,7 +11169,7 @@ var IceConnectionMonitor = /** @class */ (function () {
11090
11169
  }());
11091
11170
  module.exports = IceConnectionMonitor;
11092
11171
 
11093
- },{"../../util/constants":120}],68:[function(require,module,exports){
11172
+ },{"../../util/constants":121}],68:[function(require,module,exports){
11094
11173
  'use strict';
11095
11174
  var __extends = (this && this.__extends) || (function () {
11096
11175
  var extendStatics = function (d, b) {
@@ -11174,7 +11253,9 @@ var __extends = (this && this.__extends) || (function () {
11174
11253
  })();
11175
11254
  var LocalParticipantSignaling = require('../localparticipant');
11176
11255
  var LocalTrackPublicationV2 = require('./localtrackpublication');
11177
- var isDeepEqual = require('../../util').isDeepEqual;
11256
+ var DEFAULT_LOG_LEVEL = require('../../util/constants').DEFAULT_LOG_LEVEL;
11257
+ var Log = require('../../util/log');
11258
+ var _a = require('../../util'), buildLogLevels = _a.buildLogLevels, isDeepEqual = _a.isDeepEqual;
11178
11259
  /**
11179
11260
  * @extends ParticipantSignaling
11180
11261
  * @property {BandwidthProfileOptions} bandwidthProfile
@@ -11193,9 +11274,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11193
11274
  function LocalParticipantV2(encodingParameters, networkQualityConfiguration, options) {
11194
11275
  var _this = this;
11195
11276
  options = Object.assign({
11277
+ logLevel: DEFAULT_LOG_LEVEL,
11196
11278
  LocalTrackPublicationV2: LocalTrackPublicationV2
11197
11279
  }, options);
11198
11280
  _this = _super.call(this) || this;
11281
+ var logLevels = buildLogLevels(options.logLevel);
11199
11282
  Object.defineProperties(_this, {
11200
11283
  _bandwidthProfile: {
11201
11284
  value: null,
@@ -11214,6 +11297,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11214
11297
  _LocalTrackPublicationV2: {
11215
11298
  value: options.LocalTrackPublicationV2
11216
11299
  },
11300
+ _log: {
11301
+ value: options.log
11302
+ ? options.log.createLog('default', _this)
11303
+ : new Log('default', _this, logLevels, options.loggerName)
11304
+ },
11217
11305
  _publishedRevision: {
11218
11306
  writable: true,
11219
11307
  value: 0
@@ -11257,6 +11345,9 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11257
11345
  });
11258
11346
  return _this;
11259
11347
  }
11348
+ LocalParticipantV2.prototype.toString = function () {
11349
+ return "[LocalParticipantSignaling: " + this.sid + "]";
11350
+ };
11260
11351
  /**
11261
11352
  * Set the signalingRegion.
11262
11353
  * @param {string} signalingRegion.
@@ -11280,6 +11371,13 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11280
11371
  this.didUpdate();
11281
11372
  }
11282
11373
  };
11374
+ /**
11375
+ * returns current {@link EncodingParametersImpl}.
11376
+ * @returns {EncodingParametersImpl}
11377
+ */
11378
+ LocalParticipantV2.prototype.getParameters = function () {
11379
+ return this._encodingParameters;
11380
+ };
11283
11381
  /**
11284
11382
  * Set the {@link EncodingParameters}.
11285
11383
  * @param {?EncodingParameters} encodingParameters
@@ -11400,6 +11498,21 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11400
11498
  LocalParticipantV2.prototype.setNetworkQualityConfiguration = function (networkQualityConfiguration) {
11401
11499
  this.networkQualityConfiguration.update(networkQualityConfiguration);
11402
11500
  };
11501
+ /**
11502
+ * updates encodings for simulcast layers.
11503
+ * @param {Track.SID} trackSid
11504
+ * @param {Array<{enabled: boolean, layer_index: number}>} encodings
11505
+ * @returns {Promise<string>} string indicating result of the operation. can be one of
11506
+ * "OK", "INVALID_HINT", "COULD_NOT_APPLY_HINT", "UNKNOWN_TRACK"
11507
+ */
11508
+ LocalParticipantV2.prototype.setPublisherHint = function (trackSid, encodings) {
11509
+ var trackSignaling = Array.from(this.tracks.values()).find(function (trackPub) { return trackPub.sid === trackSid; });
11510
+ if (!trackSignaling) {
11511
+ this._log.warn("track:" + trackSid + " not found");
11512
+ return Promise.resolve('UNKNOWN_TRACK');
11513
+ }
11514
+ return trackSignaling.trackTransceiver.setPublisherHint(encodings);
11515
+ };
11403
11516
  return LocalParticipantV2;
11404
11517
  }(LocalParticipantSignaling));
11405
11518
  /**
@@ -11437,7 +11550,7 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11437
11550
  */
11438
11551
  module.exports = LocalParticipantV2;
11439
11552
 
11440
- },{"../../util":126,"../localparticipant":56,"./localtrackpublication":70}],70:[function(require,module,exports){
11553
+ },{"../../util":127,"../../util/constants":121,"../../util/log":131,"../localparticipant":56,"./localtrackpublication":70}],70:[function(require,module,exports){
11441
11554
  'use strict';
11442
11555
  var __extends = (this && this.__extends) || (function () {
11443
11556
  var extendStatics = function (d, b) {
@@ -11519,7 +11632,7 @@ var LocalTrackPublicationV2 = /** @class */ (function (_super) {
11519
11632
  */
11520
11633
  module.exports = LocalTrackPublicationV2;
11521
11634
 
11522
- },{"../../util/twilio-video-errors":143,"../localtrackpublication":57}],71:[function(require,module,exports){
11635
+ },{"../../util/twilio-video-errors":144,"../localtrackpublication":57}],71:[function(require,module,exports){
11523
11636
  /* eslint callback-return:0 */
11524
11637
  'use strict';
11525
11638
  var __extends = (this && this.__extends) || (function () {
@@ -11616,7 +11729,7 @@ var MediaSignaling = /** @class */ (function (_super) {
11616
11729
  }(EventEmitter));
11617
11730
  module.exports = MediaSignaling;
11618
11731
 
11619
- },{"events":179}],72:[function(require,module,exports){
11732
+ },{"events":180}],72:[function(require,module,exports){
11620
11733
  /* eslint callback-return:0 */
11621
11734
  'use strict';
11622
11735
  var __extends = (this && this.__extends) || (function () {
@@ -11775,7 +11888,7 @@ function next(monitor) {
11775
11888
  */
11776
11889
  module.exports = NetworkQualityMonitor;
11777
11890
 
11778
- },{"../../stats/peerconnectionreportfactory":102,"events":179}],73:[function(require,module,exports){
11891
+ },{"../../stats/peerconnectionreportfactory":103,"events":180}],73:[function(require,module,exports){
11779
11892
  'use strict';
11780
11893
  var __extends = (this && this.__extends) || (function () {
11781
11894
  var extendStatics = function (d, b) {
@@ -12021,7 +12134,7 @@ function createNetworkQualityInputsMessage(networkQualityInputs, networkQualityR
12021
12134
  }
12022
12135
  module.exports = NetworkQualitySignaling;
12023
12136
 
12024
- },{"../../util/asyncvar":117,"./mediasignaling":71}],74:[function(require,module,exports){
12137
+ },{"../../util/asyncvar":118,"./mediasignaling":71}],74:[function(require,module,exports){
12025
12138
  'use strict';
12026
12139
  var __extends = (this && this.__extends) || (function () {
12027
12140
  var extendStatics = function (d, b) {
@@ -12061,13 +12174,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
12061
12174
  };
12062
12175
  var DefaultBackoff = require('backoff');
12063
12176
  var _a = require('@twilio/webrtc'), DefaultMediaStream = _a.MediaStream, DefaultRTCIceCandidate = _a.RTCIceCandidate, DefaultRTCPeerConnection = _a.RTCPeerConnection, DefaultRTCSessionDescription = _a.RTCSessionDescription, getStatistics = _a.getStats;
12064
- var guessBrowser = require('@twilio/webrtc/lib/util').guessBrowser;
12177
+ var util = require('@twilio/webrtc/lib/util');
12178
+ var guessBrowser = util.guessBrowser;
12065
12179
  var getSdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat;
12066
12180
  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'), createCodecMapForMediaSection = _c.createCodecMapForMediaSection, disableRtx = _c.disableRtx, enableDtxForOpus = _c.enableDtxForOpus, getMediaSections = _c.getMediaSections, removeSSRCAttributes = _c.removeSSRCAttributes, revertSimulcastForNonVP8MediaSections = _c.revertSimulcastForNonVP8MediaSections, setBitrateParameters = _c.setBitrateParameters, setCodecPreferences = _c.setCodecPreferences, setSimulcast = _c.setSimulcast, unifiedPlanAddOrRewriteNewTrackIds = _c.unifiedPlanAddOrRewriteNewTrackIds, unifiedPlanAddOrRewriteTrackIds = _c.unifiedPlanAddOrRewriteTrackIds, unifiedPlanFilterLocalCodecs = _c.unifiedPlanFilterLocalCodecs;
12181
+ var _c = require('../../util/sdp'), createCodecMapForMediaSection = _c.createCodecMapForMediaSection, disableRtx = _c.disableRtx, enableDtxForOpus = _c.enableDtxForOpus, getMediaSections = _c.getMediaSections, removeSSRCAttributes = _c.removeSSRCAttributes, revertSimulcast = _c.revertSimulcast, setBitrateParameters = _c.setBitrateParameters, setCodecPreferences = _c.setCodecPreferences, setSimulcast = _c.setSimulcast, unifiedPlanAddOrRewriteNewTrackIds = _c.unifiedPlanAddOrRewriteNewTrackIds, unifiedPlanAddOrRewriteTrackIds = _c.unifiedPlanAddOrRewriteTrackIds, unifiedPlanFilterLocalCodecs = _c.unifiedPlanFilterLocalCodecs;
12068
12182
  var DefaultTimeout = require('../../util/timeout');
12069
12183
  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;
12184
+ var _e = require('../../util'), buildLogLevels = _e.buildLogLevels, getPlatform = _e.getPlatform, isChromeScreenShareTrack = _e.isChromeScreenShareTrack, oncePerTick = _e.oncePerTick, defer = _e.defer;
12071
12185
  var IceBox = require('./icebox');
12072
12186
  var DefaultIceConnectionMonitor = require('./iceconnectionmonitor.js');
12073
12187
  var DataTrackReceiver = require('../../data/receiver');
@@ -12146,7 +12260,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12146
12260
  isRTCRtpSenderParamsSupported: isRTCRtpSenderParamsSupported,
12147
12261
  logLevel: DEFAULT_LOG_LEVEL,
12148
12262
  offerOptions: {},
12149
- revertSimulcastForNonVP8MediaSections: revertSimulcastForNonVP8MediaSections,
12263
+ revertSimulcast: revertSimulcast,
12150
12264
  sessionTimeout: DEFAULT_SESSION_TIMEOUT_SEC * 1000,
12151
12265
  setBitrateParameters: setBitrateParameters,
12152
12266
  setCodecPreferences: setCodecPreferences,
@@ -12284,6 +12398,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12284
12398
  _rtpSenders: {
12285
12399
  value: new Map()
12286
12400
  },
12401
+ _rtpNewSenders: {
12402
+ value: new Set()
12403
+ },
12287
12404
  _iceConnectionMonitor: {
12288
12405
  value: new options.IceConnectionMonitor(peerConnection)
12289
12406
  },
@@ -12332,9 +12449,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12332
12449
  return codec === 'opus' && dtx;
12333
12450
  })
12334
12451
  },
12335
- _shouldApplySimulcast: {
12336
- value: (isChrome || isSafari) && preferredCodecs.video.some(function (codecSettings) { return codecSettings.codec.toLowerCase() === 'vp8' && codecSettings.simulcast; })
12337
- },
12338
12452
  _queuedDescription: {
12339
12453
  writable: true,
12340
12454
  value: null
@@ -12376,8 +12490,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12376
12490
  _setSimulcast: {
12377
12491
  value: options.setSimulcast
12378
12492
  },
12379
- _revertSimulcastForNonVP8MediaSections: {
12380
- value: options.revertSimulcastForNonVP8MediaSections
12493
+ _revertSimulcast: {
12494
+ value: options.revertSimulcast
12381
12495
  },
12382
12496
  _RTCIceCandidate: {
12383
12497
  value: options.RTCIceCandidate
@@ -12404,6 +12518,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12404
12518
  writable: true,
12405
12519
  value: null
12406
12520
  },
12521
+ _mediaTrackSenderToPublisherHints: {
12522
+ value: new Map()
12523
+ },
12407
12524
  id: {
12408
12525
  enumerable: true,
12409
12526
  value: id
@@ -12433,6 +12550,29 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12433
12550
  PeerConnectionV2.prototype.toString = function () {
12434
12551
  return "[PeerConnectionV2 #" + this._instanceId + ": " + this.id + "]";
12435
12552
  };
12553
+ PeerConnectionV2.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {
12554
+ this._log.debug('Setting setEffectiveAdaptiveSimulcast: ', effectiveAdaptiveSimulcast);
12555
+ // clear adaptive simulcast from codec preferences if it was set.
12556
+ this._preferredVideoCodecs.forEach(function (cs) {
12557
+ if ('adaptiveSimulcast' in cs) {
12558
+ cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;
12559
+ }
12560
+ });
12561
+ };
12562
+ Object.defineProperty(PeerConnectionV2.prototype, "_shouldApplySimulcast", {
12563
+ get: function () {
12564
+ if (!isChrome && !isSafari) {
12565
+ return false;
12566
+ }
12567
+ // adaptiveSimulcast is set to false after connected message is received if other party does not support it.
12568
+ var simulcast = this._preferredVideoCodecs.some(function (cs) {
12569
+ return cs.codec.toLowerCase() === 'vp8' && cs.simulcast && cs.adaptiveSimulcast !== false;
12570
+ });
12571
+ return simulcast;
12572
+ },
12573
+ enumerable: false,
12574
+ configurable: true
12575
+ });
12436
12576
  Object.defineProperty(PeerConnectionV2.prototype, "connectionState", {
12437
12577
  /**
12438
12578
  * The {@link PeerConnectionV2}'s underlying RTCPeerConnection's RTCPeerConnectionState
@@ -12477,35 +12617,97 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12477
12617
  enumerable: false,
12478
12618
  configurable: true
12479
12619
  });
12620
+ Object.defineProperty(PeerConnectionV2.prototype, "_isAdaptiveSimulcastEnabled", {
12621
+ /**
12622
+ * Whether adaptive simulcast is enabled.
12623
+ * @returns {boolean}
12624
+ */
12625
+ get: function () {
12626
+ var adaptiveSimulcastEntry = this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });
12627
+ return adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === true;
12628
+ },
12629
+ enumerable: false,
12630
+ configurable: true
12631
+ });
12480
12632
  /**
12481
- * Updates scaleResolutionDownBy for encoding layers.
12482
- * @param {number} width
12483
- * @param {number} height
12633
+ * @param {MediaStreamTrack} track
12484
12634
  * @param {Array<RTCRtpEncodingParameters>} encodings
12635
+ * @param {boolean} trackReplaced
12636
+ * @returns {boolean} true if encodings were updated.
12485
12637
  */
12486
- PeerConnectionV2.prototype._updateEncodings = function (width, height, encodings) {
12487
- var _this = this;
12488
- // NOTE(mpatwardhan): All the simulcast encodings in Safari have
12489
- // the same resolution. So, here we make sure that the lower layers have
12490
- // lower resolution, as seen in Chrome.
12491
- var pixelsToMaxActiveLayers = [
12492
- { pixels: 960 * 540, maxActiveLayers: 3 },
12493
- { pixels: 480 * 270, maxActiveLayers: 2 },
12494
- { pixels: 0, maxActiveLayers: 1 }
12495
- ];
12496
- var trackPixels = width * height;
12497
- var activeLayersInfo = pixelsToMaxActiveLayers.find(function (layer) { return trackPixels >= layer.pixels; });
12498
- var activeLayers = Math.min(encodings.length, activeLayersInfo.maxActiveLayers);
12499
- encodings.forEach(function (encoding, i) {
12500
- encoding.active = i < activeLayers;
12501
- if (encoding.active) {
12502
- encoding.scaleResolutionDownBy = 1 << (activeLayers - i - 1);
12503
- }
12504
- else {
12505
- delete encoding.scaleResolutionDownBy;
12506
- }
12507
- _this._log.debug("setting up simulcast layer " + i + " with active = " + encoding.active + ", scaleResolutionDownBy = " + encoding.scaleResolutionDownBy);
12508
- });
12638
+ PeerConnectionV2.prototype._maybeUpdateEncodings = function (track, encodings, trackReplaced) {
12639
+ if (trackReplaced === void 0) { trackReplaced = false; }
12640
+ if (track.kind !== 'video') {
12641
+ return false;
12642
+ }
12643
+ var browser = util.guessBrowser();
12644
+ // Note(mpatwardhan): always configure encodings for safari.
12645
+ // for chrome only when adaptive simulcast enabled.
12646
+ if (browser === 'safari' || (browser === 'chrome' && this._isAdaptiveSimulcastEnabled)) {
12647
+ this._updateEncodings(track, encodings, trackReplaced);
12648
+ return true;
12649
+ }
12650
+ return false;
12651
+ };
12652
+ /**
12653
+ * Configures with default encodings depending on track type and resolution.
12654
+ * Default configuration sets some encodings to disabled, and for others set scaleResolutionDownBy
12655
+ * values. When trackReplaced is set to true, it will clear 'active' for any encodings that
12656
+ * needs to be enabled.
12657
+ * @param {MediaStreamTrack} track
12658
+ * @param {Array<RTCRtpEncodingParameters>} encodings
12659
+ * @param {boolean} trackReplaced
12660
+ */
12661
+ PeerConnectionV2.prototype._updateEncodings = function (track, encodings, trackReplaced) {
12662
+ if (this._isChromeScreenShareTrack(track)) {
12663
+ var screenShareActiveLayerConfig_1 = [
12664
+ { scaleResolutionDownBy: 1 },
12665
+ { scaleResolutionDownBy: 1 }
12666
+ ];
12667
+ encodings.forEach(function (encoding, i) {
12668
+ var activeLayerConfig = screenShareActiveLayerConfig_1[i];
12669
+ if (activeLayerConfig) {
12670
+ encoding.scaleResolutionDownBy = activeLayerConfig.scaleResolutionDownBy;
12671
+ if (trackReplaced) {
12672
+ delete encoding.active;
12673
+ }
12674
+ }
12675
+ else {
12676
+ encoding.active = false;
12677
+ delete encoding.scaleResolutionDownBy;
12678
+ }
12679
+ });
12680
+ }
12681
+ else {
12682
+ var _a = track.getSettings(), width = _a.width, height = _a.height;
12683
+ // NOTE(mpatwardhan): for non-screen share tracks
12684
+ // enable layers depending on track resolutions
12685
+ var pixelsToMaxActiveLayers = [
12686
+ { pixels: 960 * 540, maxActiveLayers: 3 },
12687
+ { pixels: 480 * 270, maxActiveLayers: 2 },
12688
+ { pixels: 0, maxActiveLayers: 1 }
12689
+ ];
12690
+ var trackPixels_1 = width * height;
12691
+ var activeLayersInfo = pixelsToMaxActiveLayers.find(function (layer) { return trackPixels_1 >= layer.pixels; });
12692
+ var activeLayers_1 = Math.min(encodings.length, activeLayersInfo.maxActiveLayers);
12693
+ encodings.forEach(function (encoding, i) {
12694
+ var enabled = i < activeLayers_1;
12695
+ if (enabled) {
12696
+ encoding.scaleResolutionDownBy = 1 << (activeLayers_1 - i - 1);
12697
+ if (trackReplaced) {
12698
+ delete encoding.active;
12699
+ }
12700
+ }
12701
+ else {
12702
+ encoding.active = false;
12703
+ delete encoding.scaleResolutionDownBy;
12704
+ }
12705
+ });
12706
+ }
12707
+ this._log.debug('_updateEncodings:', encodings.map(function (_a, i) {
12708
+ var active = _a.active, scaleResolutionDownBy = _a.scaleResolutionDownBy;
12709
+ return "[" + i + ": " + active + ", " + (scaleResolutionDownBy || 0) + "]";
12710
+ }).join(', '));
12509
12711
  };
12510
12712
  /**
12511
12713
  * Add an ICE candidate to the {@link PeerConnectionV2}.
@@ -12625,7 +12827,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12625
12827
  // NOTE(syerrapragada): VMS does not support H264 simulcast. So,
12626
12828
  // unset simulcast for sections in local offer where corresponding
12627
12829
  // sections in answer doesn't have vp8 as preferred codec and reapply offer.
12628
- updatedSdp = _this._revertSimulcastForNonVP8MediaSections(updatedSdp, sdpWithoutSimulcast, offer.sdp);
12830
+ updatedSdp = _this._revertSimulcast(updatedSdp, sdpWithoutSimulcast, offer.sdp);
12629
12831
  }
12630
12832
  // NOTE(mmalavalli): Work around Chromium bug 1074421.
12631
12833
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1074421
@@ -13097,7 +13299,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13097
13299
  });
13098
13300
  }
13099
13301
  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 + "\".");
13302
+ _this._log.warn("Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".", error);
13101
13303
  var errorToThrow = new MediaClientLocalDescFailedError();
13102
13304
  var publishWarning = {
13103
13305
  message: "Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed",
@@ -13175,8 +13377,13 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13175
13377
  // NOTE(syerrapragada): VMS does not support H264 simulcast. So,
13176
13378
  // unset simulcast for sections in local offer where corresponding
13177
13379
  // sections in answer doesn't have vp8 as preferred codec and reapply offer.
13178
- if (description.type === 'answer' && _this._shouldApplySimulcast) {
13179
- var sdpWithoutSimulcastForNonVP8MediaSections = _this._revertSimulcastForNonVP8MediaSections(_this._localDescription.sdp, _this._localDescriptionWithoutSimulcast.sdp, description.sdp);
13380
+ if (description.type === 'answer' && _this._localDescriptionWithoutSimulcast) {
13381
+ // NOTE(mpatwardhan):if we were using adaptive simulcast, and if its not supported by server
13382
+ // revert simulcast even for vp8.
13383
+ var adaptiveSimulcastEntry = _this._preferredVideoCodecs.find(function (cs) { return 'adaptiveSimulcast' in cs; });
13384
+ var revertForAll = !!adaptiveSimulcastEntry && adaptiveSimulcastEntry.adaptiveSimulcast === false;
13385
+ var sdpWithoutSimulcastForNonVP8MediaSections = _this._revertSimulcast(_this._localDescription.sdp, _this._localDescriptionWithoutSimulcast.sdp, description.sdp, revertForAll);
13386
+ _this._localDescriptionWithoutSimulcast = null;
13180
13387
  if (sdpWithoutSimulcastForNonVP8MediaSections !== _this._localDescription.sdp) {
13181
13388
  return _this._rollbackAndApplyOffer({
13182
13389
  type: _this._localDescription.type,
@@ -13193,7 +13400,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13193
13400
  negotiationCompleted(_this);
13194
13401
  }
13195
13402
  }, function (error) {
13196
- _this._log.warn("Calling setRemoteDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".");
13403
+ _this._log.warn("Calling setRemoteDescription with an RTCSessionDescription of type \"" + description.type + "\" failed with the error \"" + error.message + "\".", error);
13197
13404
  if (description.sdp) {
13198
13405
  _this._log.warn("The SDP was " + description.sdp);
13199
13406
  }
@@ -13317,12 +13524,82 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13317
13524
  this._log.warn("Error creating an RTCDataChannel for DataTrack \"" + dataTrackSender.id + "\": " + error.message);
13318
13525
  }
13319
13526
  };
13527
+ PeerConnectionV2.prototype._handleQueuedPublisherHints = function () {
13528
+ var _this = this;
13529
+ if (this._peerConnection.signalingState === 'stable') {
13530
+ this._mediaTrackSenderToPublisherHints.forEach(function (_a, mediaTrackSender) {
13531
+ var deferred = _a.deferred, encodings = _a.encodings;
13532
+ _this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
13533
+ _this._setPublisherHint(mediaTrackSender, encodings)
13534
+ .then(function (result) { return deferred.resolve(result); })
13535
+ .catch(function (error) { return deferred.reject(error); });
13536
+ });
13537
+ }
13538
+ };
13539
+ /**
13540
+ * updates encodings for simulcast layers of given sender.
13541
+ * @param {RTCRtpSender} sender
13542
+ * @param {Array<{enabled: boolean, layer_index: number}>|null} encodings
13543
+ * @returns {Promise<string>} string indicating result of the operation. can be one of
13544
+ * "OK", "INVALID_HINT", "COULD_NOT_APPLY_HINT", "UNKNOWN_TRACK"
13545
+ */
13546
+ PeerConnectionV2.prototype._setPublisherHint = function (mediaTrackSender, encodings) {
13547
+ var _this = this;
13548
+ if (isFirefox) {
13549
+ return Promise.resolve('COULD_NOT_APPLY_HINT');
13550
+ }
13551
+ if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {
13552
+ // skip any stale hint associated with the mediaTrackSender.
13553
+ var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);
13554
+ queuedHint.deferred.resolve('REQUEST_SKIPPED');
13555
+ this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
13556
+ }
13557
+ var sender = this._rtpSenders.get(mediaTrackSender);
13558
+ if (!sender) {
13559
+ this._log.warn('Could not apply publisher hint because RTCRtpSender was not found');
13560
+ return Promise.resolve('UNKNOWN_TRACK');
13561
+ }
13562
+ if (this._peerConnection.signalingState === 'closed') {
13563
+ this._log.warn('Could not apply publisher hint because signalingState was "closed"');
13564
+ return Promise.resolve('COULD_NOT_APPLY_HINT');
13565
+ }
13566
+ if (this._peerConnection.signalingState !== 'stable') {
13567
+ // enqueue this hint to be applied when pc becomes stable.
13568
+ this._log.debug('Queuing up publisher hint because signalingState:', this._peerConnection.signalingState);
13569
+ var deferred = defer();
13570
+ this._mediaTrackSenderToPublisherHints.set(mediaTrackSender, { deferred: deferred, encodings: encodings });
13571
+ return deferred.promise;
13572
+ }
13573
+ var parameters = sender.getParameters();
13574
+ if (encodings !== null) {
13575
+ encodings.forEach(function (_a) {
13576
+ var enabled = _a.enabled, layerIndex = _a.layer_index;
13577
+ if (parameters.encodings.length > layerIndex) {
13578
+ _this._log.debug("layer:" + layerIndex + ", active:" + parameters.encodings[layerIndex].active + " => " + enabled);
13579
+ parameters.encodings[layerIndex].active = enabled;
13580
+ }
13581
+ else {
13582
+ _this._log.warn("invalid layer:" + layerIndex + ", active:" + enabled);
13583
+ }
13584
+ });
13585
+ }
13586
+ // Note(mpatwardhan): after publisher hints are applied, overwrite with default encodings
13587
+ // to disable any encoding that shouldn't have been enabled by publisher_hints.
13588
+ // When encodings===null (that is we are asked to reset encodings for replaceTrack)
13589
+ // along with disabling encodings, clear active flag for encodings that should not be disabled
13590
+ this._maybeUpdateEncodings(sender.track, parameters.encodings, encodings === null /* trackReplaced */);
13591
+ return sender.setParameters(parameters).then(function () { return 'OK'; }).catch(function (error) {
13592
+ _this._log.error('Failed to apply publisher hints:', error);
13593
+ return 'COULD_NOT_APPLY_HINT';
13594
+ });
13595
+ };
13320
13596
  /**
13321
13597
  * Add the {@link MediaTrackSender} to the {@link PeerConnectionV2}.
13322
13598
  * @param {MediaTrackSender} mediaTrackSender
13323
13599
  * @returns {void}
13324
13600
  */
13325
13601
  PeerConnectionV2.prototype.addMediaTrackSender = function (mediaTrackSender) {
13602
+ var _this = this;
13326
13603
  if (this._peerConnection.signalingState === 'closed' || this._rtpSenders.has(mediaTrackSender)) {
13327
13604
  return;
13328
13605
  }
@@ -13335,7 +13612,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13335
13612
  var transceiver = this._addOrUpdateTransceiver(mediaTrackSender.track);
13336
13613
  sender = transceiver.sender;
13337
13614
  }
13338
- mediaTrackSender.addSender(sender);
13615
+ mediaTrackSender.addSender(sender, function (encodings) { return _this._setPublisherHint(mediaTrackSender, encodings); });
13616
+ this._rtpNewSenders.add(sender);
13339
13617
  this._rtpSenders.set(mediaTrackSender, sender);
13340
13618
  };
13341
13619
  /**
@@ -13433,6 +13711,13 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13433
13711
  this._localMediaStream.removeTrack(mediaTrackSender.track);
13434
13712
  }
13435
13713
  mediaTrackSender.removeSender(sender);
13714
+ // clean up any pending publisher hints associated with this mediaTrackSender.
13715
+ if (this._mediaTrackSenderToPublisherHints.has(mediaTrackSender)) {
13716
+ var queuedHint = this._mediaTrackSenderToPublisherHints.get(mediaTrackSender);
13717
+ queuedHint.deferred.resolve('UNKNOWN_TRACK');
13718
+ this._mediaTrackSenderToPublisherHints.delete(mediaTrackSender);
13719
+ }
13720
+ this._rtpNewSenders.delete(sender);
13436
13721
  this._rtpSenders.delete(mediaTrackSender);
13437
13722
  };
13438
13723
  /**
@@ -13661,7 +13946,10 @@ function negotiationCompleted(pcv2) {
13661
13946
  updateRemoteCodecMaps(pcv2);
13662
13947
  }
13663
13948
  if (pcv2._isRTCRtpSenderParamsSupported) {
13664
- updateEncodingParameters(pcv2);
13949
+ updateEncodingParameters(pcv2).then(function () {
13950
+ // if there any any publisher hints queued, apply them now.
13951
+ pcv2._handleQueuedPublisherHints();
13952
+ });
13665
13953
  }
13666
13954
  }
13667
13955
  /**
@@ -13675,6 +13963,7 @@ function updateEncodingParameters(pcv2) {
13675
13963
  ['audio', maxAudioBitrate],
13676
13964
  ['video', maxVideoBitrate]
13677
13965
  ]);
13966
+ var promises = [];
13678
13967
  pcv2._peerConnection.getSenders().filter(function (sender) { return sender.track; }).forEach(function (sender) {
13679
13968
  var maxBitrate = maxBitrates.get(sender.track.kind);
13680
13969
  var params = sender.getParameters();
@@ -13697,14 +13986,16 @@ function updateEncodingParameters(pcv2) {
13697
13986
  // by RTCRtpSender.setParameters() being rejected.
13698
13987
  params.encodings[0].networkPriority = 'high';
13699
13988
  }
13700
- if (isSafari && sender.track.kind === 'video') {
13701
- var _a = sender.track.getSettings(), width = _a.width, height = _a.height;
13702
- pcv2._updateEncodings(width, height, params.encodings);
13703
- }
13704
- sender.setParameters(params).catch(function (error) {
13989
+ // when a sender is reused, delete any active encodings set by server.
13990
+ var trackReplaced = pcv2._rtpNewSenders.has(sender);
13991
+ pcv2._maybeUpdateEncodings(sender.track, params.encodings, trackReplaced);
13992
+ pcv2._rtpNewSenders.delete(sender);
13993
+ var promise = sender.setParameters(params).catch(function (error) {
13705
13994
  pcv2._log.warn("Error while setting encodings parameters for " + sender.track.kind + " Track " + sender.track.id + ": " + (error.message || error.name));
13706
13995
  });
13996
+ promises.push(promise);
13707
13997
  });
13998
+ return Promise.all(promises);
13708
13999
  }
13709
14000
  /**
13710
14001
  * Remove maxBitrate from the RTCRtpSendParameters' encodings.
@@ -13734,7 +14025,7 @@ function setMaxBitrate(params, maxBitrate) {
13734
14025
  }
13735
14026
  module.exports = PeerConnectionV2;
13736
14027
 
13737
- },{"../../data/receiver":5,"../../media/track/receiver":28,"../../statemachine":84,"../../util":126,"../../util/constants":120,"../../util/log":130,"../../util/sdp":134,"../../util/sdp/issue8329":135,"../../util/sdp/trackmatcher/identity":137,"../../util/sdp/trackmatcher/mid":138,"../../util/sdp/trackmatcher/ordered":139,"../../util/timeout":142,"../../util/twilio-video-errors":143,"./icebox":66,"./iceconnectionmonitor.js":67,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165,"@twilio/webrtc/lib/util/sdp":167,"backoff":170}],75:[function(require,module,exports){
14028
+ },{"../../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/identity":138,"../../util/sdp/trackmatcher/mid":139,"../../util/sdp/trackmatcher/ordered":140,"../../util/timeout":143,"../../util/twilio-video-errors":144,"./icebox":66,"./iceconnectionmonitor.js":67,"@twilio/webrtc":153,"@twilio/webrtc/lib/util":166,"@twilio/webrtc/lib/util/sdp":168,"backoff":171}],75:[function(require,module,exports){
13738
14029
  'use strict';
13739
14030
  var __extends = (this && this.__extends) || (function () {
13740
14031
  var extendStatics = function (d, b) {
@@ -13878,6 +14169,14 @@ var PeerConnectionManager = /** @class */ (function (_super) {
13878
14169
  });
13879
14170
  return _this;
13880
14171
  }
14172
+ PeerConnectionManager.prototype.setEffectiveAdaptiveSimulcast = function (effectiveAdaptiveSimulcast) {
14173
+ this._peerConnections.forEach(function (pc) { return pc.setEffectiveAdaptiveSimulcast(effectiveAdaptiveSimulcast); });
14174
+ this._preferredCodecs.video.forEach(function (cs) {
14175
+ if ('adaptiveSimulcast' in cs) {
14176
+ cs.adaptiveSimulcast = effectiveAdaptiveSimulcast;
14177
+ }
14178
+ });
14179
+ };
13881
14180
  Object.defineProperty(PeerConnectionManager.prototype, "connectionState", {
13882
14181
  /**
13883
14182
  * A summarized RTCPeerConnectionState across all the
@@ -14294,7 +14593,93 @@ function updateConnectionState(pcm) {
14294
14593
  }
14295
14594
  module.exports = PeerConnectionManager;
14296
14595
 
14297
- },{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":126,"../../util/twilio-video-errors":143,"../../webaudio/audiocontext":147,"./peerconnection":74,"@twilio/webrtc/lib/util":165}],76:[function(require,module,exports){
14596
+ },{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":127,"../../util/twilio-video-errors":144,"../../webaudio/audiocontext":148,"./peerconnection":74,"@twilio/webrtc/lib/util":166}],76:[function(require,module,exports){
14597
+ /* eslint callback-return:0 */
14598
+ 'use strict';
14599
+ var __extends = (this && this.__extends) || (function () {
14600
+ var extendStatics = function (d, b) {
14601
+ extendStatics = Object.setPrototypeOf ||
14602
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14603
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
14604
+ return extendStatics(d, b);
14605
+ };
14606
+ return function (d, b) {
14607
+ if (typeof b !== "function" && b !== null)
14608
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14609
+ extendStatics(d, b);
14610
+ function __() { this.constructor = d; }
14611
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14612
+ };
14613
+ })();
14614
+ var MediaSignaling = require('./mediasignaling');
14615
+ var messageId = 1;
14616
+ var PublisherHintsSignaling = /** @class */ (function (_super) {
14617
+ __extends(PublisherHintsSignaling, _super);
14618
+ /**
14619
+ * Construct a {@link RenderHintsSignaling}.
14620
+ */
14621
+ function PublisherHintsSignaling(getReceiver, options) {
14622
+ var _this = _super.call(this, getReceiver, 'publisher_hints', options) || this;
14623
+ _this.on('ready', function (transport) {
14624
+ _this._log.debug('publisher_hints transport ready:', transport);
14625
+ transport.on('message', function (message) {
14626
+ _this._log.debug('Incoming: ', message);
14627
+ switch (message.type) {
14628
+ case 'publisher_hints':
14629
+ if (message.publisher && message.publisher.hints && message.publisher.id) {
14630
+ _this._processPublisherHints(message.publisher.hints, message.publisher.id);
14631
+ }
14632
+ break;
14633
+ default:
14634
+ _this._log.warn('Unknown message type: ', message.type);
14635
+ break;
14636
+ }
14637
+ });
14638
+ });
14639
+ return _this;
14640
+ }
14641
+ PublisherHintsSignaling.prototype.sendTrackReplaced = function (_a) {
14642
+ var trackSid = _a.trackSid;
14643
+ if (!this._transport) {
14644
+ return;
14645
+ }
14646
+ var payLoad = {
14647
+ type: 'client_reset',
14648
+ track: trackSid,
14649
+ id: messageId++
14650
+ };
14651
+ this._log.debug('Outgoing: ', payLoad);
14652
+ this._transport.publish(payLoad);
14653
+ };
14654
+ PublisherHintsSignaling.prototype.sendHintResponse = function (_a) {
14655
+ var id = _a.id, hints = _a.hints;
14656
+ if (!this._transport) {
14657
+ return;
14658
+ }
14659
+ var payLoad = {
14660
+ type: 'publisher_hints',
14661
+ id: id,
14662
+ hints: hints
14663
+ };
14664
+ this._log.debug('Outgoing: ', payLoad);
14665
+ this._transport.publish(payLoad);
14666
+ };
14667
+ /**
14668
+ * @private
14669
+ */
14670
+ PublisherHintsSignaling.prototype._processPublisherHints = function (hints, id) {
14671
+ try {
14672
+ this.emit('updated', hints, id);
14673
+ }
14674
+ catch (ex) {
14675
+ this._log.error('error processing hints:', ex);
14676
+ }
14677
+ };
14678
+ return PublisherHintsSignaling;
14679
+ }(MediaSignaling));
14680
+ module.exports = PublisherHintsSignaling;
14681
+
14682
+ },{"./mediasignaling":71}],77:[function(require,module,exports){
14298
14683
  'use strict';
14299
14684
  var __extends = (this && this.__extends) || (function () {
14300
14685
  var extendStatics = function (d, b) {
@@ -14354,7 +14739,7 @@ var RecordingV2 = /** @class */ (function (_super) {
14354
14739
  */
14355
14740
  module.exports = RecordingV2;
14356
14741
 
14357
- },{"../recording":59}],77:[function(require,module,exports){
14742
+ },{"../recording":59}],78:[function(require,module,exports){
14358
14743
  'use strict';
14359
14744
  var __extends = (this && this.__extends) || (function () {
14360
14745
  var extendStatics = function (d, b) {
@@ -14474,7 +14859,7 @@ var RemoteParticipantV2 = /** @class */ (function (_super) {
14474
14859
  }(RemoteParticipantSignaling));
14475
14860
  module.exports = RemoteParticipantV2;
14476
14861
 
14477
- },{"../remoteparticipant":60,"./remotetrackpublication":78}],78:[function(require,module,exports){
14862
+ },{"../remoteparticipant":60,"./remotetrackpublication":79}],79:[function(require,module,exports){
14478
14863
  'use strict';
14479
14864
  var __extends = (this && this.__extends) || (function () {
14480
14865
  var extendStatics = function (d, b) {
@@ -14528,7 +14913,7 @@ var RemoteTrackPublicationV2 = /** @class */ (function (_super) {
14528
14913
  */
14529
14914
  module.exports = RemoteTrackPublicationV2;
14530
14915
 
14531
- },{"../remotetrackpublication":61}],79:[function(require,module,exports){
14916
+ },{"../remotetrackpublication":61}],80:[function(require,module,exports){
14532
14917
  /* eslint callback-return:0 */
14533
14918
  'use strict';
14534
14919
  var __extends = (this && this.__extends) || (function () {
@@ -14547,7 +14932,9 @@ var __extends = (this && this.__extends) || (function () {
14547
14932
  };
14548
14933
  })();
14549
14934
  var MediaSignaling = require('./mediasignaling');
14935
+ var Timeout = require('../../util/timeout');
14550
14936
  var isDeepEqual = require('../../util').isDeepEqual;
14937
+ var RENDER_HINT_RESPONSE_TIME_MS = 2000; // time to wait for server response (before resending all hints.)
14551
14938
  var messageId = 1;
14552
14939
  var RenderHintsSignaling = /** @class */ (function (_super) {
14553
14940
  __extends(RenderHintsSignaling, _super);
@@ -14560,9 +14947,12 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14560
14947
  _trackSidsToRenderHints: {
14561
14948
  value: new Map()
14562
14949
  },
14563
- _isResponsePending: {
14564
- value: false,
14565
- writable: true,
14950
+ _responseTimer: {
14951
+ value: new Timeout(function () {
14952
+ _this._sendAllHints();
14953
+ // once timer fires, for next round double the delay.
14954
+ _this._responseTimer.setDelay(_this._responseTimer.delay * 2);
14955
+ }, RENDER_HINT_RESPONSE_TIME_MS, false),
14566
14956
  }
14567
14957
  });
14568
14958
  _this.on('ready', function (transport) {
@@ -14578,23 +14968,29 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14578
14968
  }
14579
14969
  });
14580
14970
  // NOTE(mpatwardhan): When transport is set (either 1st time of after vms failover)
14581
- // resend all track states. For this simply mark all tracks as dirty.
14582
- Array.from(_this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {
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();
14971
+ // resend all track states.
14972
+ _this._sendAllHints();
14592
14973
  });
14593
14974
  return _this;
14594
14975
  }
14976
+ RenderHintsSignaling.prototype._sendAllHints = function () {
14977
+ var _this = this;
14978
+ // to force sending all hints simply mark all tracks as dirty.
14979
+ Array.from(this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {
14980
+ var trackState = _this._trackSidsToRenderHints.get(trackSid);
14981
+ if (trackState.renderDimensions) {
14982
+ trackState.isDimensionDirty = true;
14983
+ }
14984
+ if ('enabled' in trackState) {
14985
+ trackState.isEnabledDirty = true;
14986
+ }
14987
+ });
14988
+ this._sendHints();
14989
+ };
14595
14990
  RenderHintsSignaling.prototype._processHintResults = function (hintResults) {
14596
14991
  var _this = this;
14597
- this._isResponsePending = false;
14992
+ this._responseTimer.clear();
14993
+ this._responseTimer.setDelay(RENDER_HINT_RESPONSE_TIME_MS);
14598
14994
  hintResults.forEach(function (hintResult) {
14599
14995
  if (hintResult.result !== 'OK') {
14600
14996
  _this._log.debug('Server error processing hint:', hintResult);
@@ -14604,7 +15000,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14604
15000
  };
14605
15001
  RenderHintsSignaling.prototype._sendHints = function () {
14606
15002
  var _this = this;
14607
- if (!this._transport || this._isResponsePending) {
15003
+ if (!this._transport || this._responseTimer.isSet) {
14608
15004
  return;
14609
15005
  }
14610
15006
  var hints = [];
@@ -14636,7 +15032,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14636
15032
  };
14637
15033
  this._log.debug('Outgoing: ', payLoad);
14638
15034
  this._transport.publish(payLoad);
14639
- this._isResponsePending = true;
15035
+ this._responseTimer.start();
14640
15036
  }
14641
15037
  };
14642
15038
  /**
@@ -14668,7 +15064,8 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14668
15064
  }(MediaSignaling));
14669
15065
  module.exports = RenderHintsSignaling;
14670
15066
 
14671
- },{"../../util":126,"./mediasignaling":71}],80:[function(require,module,exports){
15067
+ },{"../../util":127,"../../util/timeout":143,"./mediasignaling":71}],81:[function(require,module,exports){
15068
+ /* eslint-disable no-console */
14672
15069
  'use strict';
14673
15070
  var __extends = (this && this.__extends) || (function () {
14674
15071
  var extendStatics = function (d, b) {
@@ -14711,6 +15108,7 @@ var StatsReport = require('../../stats/statsreport');
14711
15108
  var TrackPrioritySignaling = require('./trackprioritysignaling');
14712
15109
  var TrackSwitchOffSignaling = require('./trackswitchoffsignaling');
14713
15110
  var RenderHintsSignaling = require('./renderhintssignaling');
15111
+ var PublisherHintsSignaling = require('./publisherhintsignaling.js');
14714
15112
  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
15113
  var MovingAverageDelta = require('../../util/movingaveragedelta');
14716
15114
  var createTwilioError = require('../../util/twilio-video-errors').createTwilioError;
@@ -14792,6 +15190,9 @@ var RoomV2 = /** @class */ (function (_super) {
14792
15190
  _renderHintsSignaling: {
14793
15191
  value: new RenderHintsSignaling(getTrackReceiver, { log: log }),
14794
15192
  },
15193
+ _publisherHintsSignaling: {
15194
+ value: new PublisherHintsSignaling(getTrackReceiver, { log: log }),
15195
+ },
14795
15196
  _trackPrioritySignaling: {
14796
15197
  value: new options.TrackPrioritySignaling(getTrackReceiver, { log: log }),
14797
15198
  },
@@ -14815,11 +15216,15 @@ var RoomV2 = /** @class */ (function (_super) {
14815
15216
  _this._initTrackSwitchOffSignaling();
14816
15217
  _this._initDominantSpeakerSignaling();
14817
15218
  _this._initNetworkQualityMonitorSignaling();
15219
+ _this._initPublisherHintSignaling();
14818
15220
  handleLocalParticipantEvents(_this, localParticipant);
14819
15221
  handlePeerConnectionEvents(_this, peerConnectionManager);
14820
15222
  handleTransportEvents(_this, transport);
14821
15223
  periodicallyPublishStats(_this, transport, options.statsPublishIntervalMs);
14822
15224
  _this._update(initialState);
15225
+ // NOTE(mpatwardhan) after initial state we know if publisher_hints are enabled or not
15226
+ // if they are not enabled. we need to undo simulcast that if it was enabled with initial offer.
15227
+ _this._peerConnectionManager.setEffectiveAdaptiveSimulcast(_this._publisherHintsSignaling.isSetup);
14823
15228
  return _this;
14824
15229
  }
14825
15230
  Object.defineProperty(RoomV2.prototype, "connectionState", {
@@ -15073,7 +15478,8 @@ var RoomV2 = /** @class */ (function (_super) {
15073
15478
  this._networkQualitySignaling,
15074
15479
  this._trackPrioritySignaling,
15075
15480
  this._trackSwitchOffSignaling,
15076
- this._renderHintsSignaling
15481
+ this._renderHintsSignaling,
15482
+ this._publisherHintsSignaling
15077
15483
  ].forEach(function (mediaSignaling) {
15078
15484
  var channel = mediaSignaling.channel;
15079
15485
  if (!mediaSignaling.isSetup
@@ -15086,6 +15492,28 @@ var RoomV2 = /** @class */ (function (_super) {
15086
15492
  });
15087
15493
  return this;
15088
15494
  };
15495
+ RoomV2.prototype._initPublisherHintSignaling = function () {
15496
+ var _this = this;
15497
+ this._publisherHintsSignaling.on('updated', function (hints, id) {
15498
+ Promise.all(hints.map(function (hint) {
15499
+ return _this.localParticipant.setPublisherHint(hint.track, hint.encodings).then(function (result) {
15500
+ return { track: hint.track, result: result };
15501
+ });
15502
+ })).then(function (hintResponses) {
15503
+ _this._publisherHintsSignaling.sendHintResponse({ id: id, hints: hintResponses });
15504
+ });
15505
+ });
15506
+ var handleReplaced = function (track) {
15507
+ if (track.kind === 'video') {
15508
+ track.trackTransceiver.on('replaced', function () {
15509
+ _this._publisherHintsSignaling.sendTrackReplaced({ trackSid: track.sid });
15510
+ });
15511
+ }
15512
+ };
15513
+ // hook up for any existing and new tracks getting replaced.
15514
+ Array.from(this.localParticipant.tracks.values()).forEach(function (track) { return handleReplaced(track); });
15515
+ this.localParticipant.on('trackAdded', function (track) { return handleReplaced(track); });
15516
+ };
15089
15517
  RoomV2.prototype._initTrackSwitchOffSignaling = function () {
15090
15518
  var _this = this;
15091
15519
  this._trackSwitchOffSignaling.on('updated', function (tracksOff, tracksOn) {
@@ -15478,7 +15906,7 @@ function replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {
15478
15906
  }
15479
15907
  module.exports = RoomV2;
15480
15908
 
15481
- },{"../../stats/statsreport":112,"../../util":126,"../../util/movingaveragedelta":131,"../../util/twilio-video-errors":143,"../room":62,"./dominantspeakersignaling":65,"./networkqualitymonitor":72,"./networkqualitysignaling":73,"./recording":76,"./remoteparticipant":77,"./renderhintssignaling":79,"./trackprioritysignaling":81,"./trackswitchoffsignaling":82}],81:[function(require,module,exports){
15909
+ },{"../../stats/statsreport":113,"../../util":127,"../../util/movingaveragedelta":132,"../../util/twilio-video-errors":144,"../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
15910
  'use strict';
15483
15911
  var __extends = (this && this.__extends) || (function () {
15484
15912
  var extendStatics = function (d, b) {
@@ -15544,7 +15972,7 @@ var TrackPrioritySignaling = /** @class */ (function (_super) {
15544
15972
  }(MediaSignaling));
15545
15973
  module.exports = TrackPrioritySignaling;
15546
15974
 
15547
- },{"./mediasignaling":71}],82:[function(require,module,exports){
15975
+ },{"./mediasignaling":71}],83:[function(require,module,exports){
15548
15976
  'use strict';
15549
15977
  var __extends = (this && this.__extends) || (function () {
15550
15978
  var extendStatics = function (d, b) {
@@ -15602,7 +16030,7 @@ var TrackSwitchOffSignaling = /** @class */ (function (_super) {
15602
16030
  */
15603
16031
  module.exports = TrackSwitchOffSignaling;
15604
16032
 
15605
- },{"./mediasignaling":71}],83:[function(require,module,exports){
16033
+ },{"./mediasignaling":71}],84:[function(require,module,exports){
15606
16034
  'use strict';
15607
16035
  var __extends = (this && this.__extends) || (function () {
15608
16036
  var extendStatics = function (d, b) {
@@ -15712,6 +16140,9 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15712
16140
  _dominantSpeaker: {
15713
16141
  value: options.dominantSpeaker
15714
16142
  },
16143
+ _adaptiveSimulcast: {
16144
+ value: options.adaptiveSimulcast
16145
+ },
15715
16146
  _eventObserver: {
15716
16147
  value: options.eventObserver,
15717
16148
  writable: false
@@ -15817,7 +16248,7 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15817
16248
  if (this._bandwidthProfile) {
15818
16249
  message.bandwidth_profile = createBandwidthProfilePayload(this._bandwidthProfile);
15819
16250
  }
15820
- message.media_signaling = createMediaSignalingPayload(this._dominantSpeaker, this._networkQuality, this._trackPriority, this._trackSwitchOff, this._renderHints);
16251
+ message.media_signaling = createMediaSignalingPayload(this._dominantSpeaker, this._networkQuality, this._trackPriority, this._trackSwitchOff, this._adaptiveSimulcast, this._renderHints);
15821
16252
  message.subscribe = createSubscribePayload(this._automaticSubscription);
15822
16253
  var sdpFormat = this._options.sdpFormat;
15823
16254
  if (sdpFormat) {
@@ -16185,7 +16616,7 @@ function setupTransport(transport) {
16185
16616
  }
16186
16617
  module.exports = TwilioConnectionTransport;
16187
16618
 
16188
- },{"../../statemachine":84,"../../twilioconnection":116,"../../util":126,"../../util/constants":120,"../../util/timeout":142,"../../util/twilio-video-errors":143,"@twilio/webrtc/lib/util/sdp":167,"backoff":170}],84:[function(require,module,exports){
16619
+ },{"../../statemachine":85,"../../twilioconnection":117,"../../util":127,"../../util/constants":121,"../../util/timeout":143,"../../util/twilio-video-errors":144,"@twilio/webrtc/lib/util/sdp":168,"backoff":171}],85:[function(require,module,exports){
16189
16620
  'use strict';
16190
16621
  var __extends = (this && this.__extends) || (function () {
16191
16622
  var extendStatics = function (d, b) {
@@ -16631,7 +17062,7 @@ function createUnreachableError(here, there) {
16631
17062
  }
16632
17063
  module.exports = StateMachine;
16633
17064
 
16634
- },{"./util":126,"events":179}],85:[function(require,module,exports){
17065
+ },{"./util":127,"events":180}],86:[function(require,module,exports){
16635
17066
  /* eslint no-undefined:0 */
16636
17067
  'use strict';
16637
17068
  /**
@@ -16644,7 +17075,7 @@ function average(xs) {
16644
17075
  }
16645
17076
  module.exports = average;
16646
17077
 
16647
- },{}],86:[function(require,module,exports){
17078
+ },{}],87:[function(require,module,exports){
16648
17079
  'use strict';
16649
17080
  /**
16650
17081
  * @property {number} [availableSend] - bps (undefined in Firefox)
@@ -16702,7 +17133,7 @@ var IceReport = /** @class */ (function () {
16702
17133
  }());
16703
17134
  module.exports = IceReport;
16704
17135
 
16705
- },{}],87:[function(require,module,exports){
17136
+ },{}],88:[function(require,module,exports){
16706
17137
  'use strict';
16707
17138
  var IceReport = require('./icereport');
16708
17139
  /**
@@ -16747,7 +17178,7 @@ var IceReportFactory = /** @class */ (function () {
16747
17178
  }());
16748
17179
  module.exports = IceReportFactory;
16749
17180
 
16750
- },{"./icereport":86}],88:[function(require,module,exports){
17181
+ },{"./icereport":87}],89:[function(require,module,exports){
16751
17182
  'use strict';
16752
17183
  var __extends = (this && this.__extends) || (function () {
16753
17184
  var extendStatics = function (d, b) {
@@ -16805,7 +17236,7 @@ var LocalAudioTrackStats = /** @class */ (function (_super) {
16805
17236
  */
16806
17237
  module.exports = LocalAudioTrackStats;
16807
17238
 
16808
- },{"./localtrackstats":89}],89:[function(require,module,exports){
17239
+ },{"./localtrackstats":90}],90:[function(require,module,exports){
16809
17240
  'use strict';
16810
17241
  var __extends = (this && this.__extends) || (function () {
16811
17242
  var extendStatics = function (d, b) {
@@ -16865,7 +17296,7 @@ var LocalTrackStats = /** @class */ (function (_super) {
16865
17296
  }(TrackStats));
16866
17297
  module.exports = LocalTrackStats;
16867
17298
 
16868
- },{"./trackstats":114}],90:[function(require,module,exports){
17299
+ },{"./trackstats":115}],91:[function(require,module,exports){
16869
17300
  'use strict';
16870
17301
  var __extends = (this && this.__extends) || (function () {
16871
17302
  var extendStatics = function (d, b) {
@@ -16958,7 +17389,7 @@ var LocalVideoTrackStats = /** @class */ (function (_super) {
16958
17389
  }(LocalTrackStats));
16959
17390
  module.exports = LocalVideoTrackStats;
16960
17391
 
16961
- },{"./localtrackstats":89}],91:[function(require,module,exports){
17392
+ },{"./localtrackstats":90}],92:[function(require,module,exports){
16962
17393
  'use strict';
16963
17394
  var __extends = (this && this.__extends) || (function () {
16964
17395
  var extendStatics = function (d, b) {
@@ -16992,7 +17423,7 @@ var NetworkQualityAudioStats = /** @class */ (function (_super) {
16992
17423
  }(NetworkQualityMediaStats));
16993
17424
  module.exports = NetworkQualityAudioStats;
16994
17425
 
16995
- },{"./networkqualitymediastats":95}],92:[function(require,module,exports){
17426
+ },{"./networkqualitymediastats":96}],93:[function(require,module,exports){
16996
17427
  'use strict';
16997
17428
  /**
16998
17429
  * Bandwidth network quality statistics.
@@ -17026,7 +17457,7 @@ var NetworkQualityBandwidthStats = /** @class */ (function () {
17026
17457
  }());
17027
17458
  module.exports = NetworkQualityBandwidthStats;
17028
17459
 
17029
- },{}],93:[function(require,module,exports){
17460
+ },{}],94:[function(require,module,exports){
17030
17461
  'use strict';
17031
17462
  /**
17032
17463
  * Fraction lost network quality statistics.
@@ -17055,7 +17486,7 @@ var NetworkQualityFractionLostStats = /** @class */ (function () {
17055
17486
  }());
17056
17487
  module.exports = NetworkQualityFractionLostStats;
17057
17488
 
17058
- },{}],94:[function(require,module,exports){
17489
+ },{}],95:[function(require,module,exports){
17059
17490
  'use strict';
17060
17491
  /**
17061
17492
  * Latency network quality statistics.
@@ -17089,7 +17520,7 @@ var NetworkQualityLatencyStats = /** @class */ (function () {
17089
17520
  }());
17090
17521
  module.exports = NetworkQualityLatencyStats;
17091
17522
 
17092
- },{}],95:[function(require,module,exports){
17523
+ },{}],96:[function(require,module,exports){
17093
17524
  'use strict';
17094
17525
  var NetworkQualitySendStats = require('./networkqualitysendstats');
17095
17526
  var NetworkQualityRecvStats = require('./networkqualityrecvstats');
@@ -17136,7 +17567,7 @@ var NetworkQualityMediaStats = /** @class */ (function () {
17136
17567
  }());
17137
17568
  module.exports = NetworkQualityMediaStats;
17138
17569
 
17139
- },{"./networkqualityrecvstats":96,"./networkqualitysendstats":98}],96:[function(require,module,exports){
17570
+ },{"./networkqualityrecvstats":97,"./networkqualitysendstats":99}],97:[function(require,module,exports){
17140
17571
  'use strict';
17141
17572
  var __extends = (this && this.__extends) || (function () {
17142
17573
  var extendStatics = function (d, b) {
@@ -17171,7 +17602,7 @@ var NetworkQualityRecvStats = /** @class */ (function (_super) {
17171
17602
  }(NetworkQualitySendOrRecvStats));
17172
17603
  module.exports = NetworkQualityRecvStats;
17173
17604
 
17174
- },{"./networkqualitysendorrecvstats":97}],97:[function(require,module,exports){
17605
+ },{"./networkqualitysendorrecvstats":98}],98:[function(require,module,exports){
17175
17606
  'use strict';
17176
17607
  var NetworkQualityBandwidthStats = require('./networkqualitybandwidthstats');
17177
17608
  var NetworkQualityFractionLostStats = require('./networkqualityfractionloststats');
@@ -17211,7 +17642,7 @@ var NetworkQualitySendOrRecvStats = /** @class */ (function () {
17211
17642
  }());
17212
17643
  module.exports = NetworkQualitySendOrRecvStats;
17213
17644
 
17214
- },{"./networkqualitybandwidthstats":92,"./networkqualityfractionloststats":93,"./networkqualitylatencystats":94}],98:[function(require,module,exports){
17645
+ },{"./networkqualitybandwidthstats":93,"./networkqualityfractionloststats":94,"./networkqualitylatencystats":95}],99:[function(require,module,exports){
17215
17646
  'use strict';
17216
17647
  var __extends = (this && this.__extends) || (function () {
17217
17648
  var extendStatics = function (d, b) {
@@ -17246,7 +17677,7 @@ var NetworkQualitySendStats = /** @class */ (function (_super) {
17246
17677
  }(NetworkQualitySendOrRecvStats));
17247
17678
  module.exports = NetworkQualitySendStats;
17248
17679
 
17249
- },{"./networkqualitysendorrecvstats":97}],99:[function(require,module,exports){
17680
+ },{"./networkqualitysendorrecvstats":98}],100:[function(require,module,exports){
17250
17681
  'use strict';
17251
17682
  var NetworkQualityAudioStats = require('./networkqualityaudiostats');
17252
17683
  var NetworkQualityVideoStats = require('./networkqualityvideostats');
@@ -17286,7 +17717,7 @@ var NetworkQualityStats = /** @class */ (function () {
17286
17717
  }());
17287
17718
  module.exports = NetworkQualityStats;
17288
17719
 
17289
- },{"./networkqualityaudiostats":91,"./networkqualityvideostats":100}],100:[function(require,module,exports){
17720
+ },{"./networkqualityaudiostats":92,"./networkqualityvideostats":101}],101:[function(require,module,exports){
17290
17721
  'use strict';
17291
17722
  var __extends = (this && this.__extends) || (function () {
17292
17723
  var extendStatics = function (d, b) {
@@ -17320,7 +17751,7 @@ var NetworkQualityVideoStats = /** @class */ (function (_super) {
17320
17751
  }(NetworkQualityMediaStats));
17321
17752
  module.exports = NetworkQualityVideoStats;
17322
17753
 
17323
- },{"./networkqualitymediastats":95}],101:[function(require,module,exports){
17754
+ },{"./networkqualitymediastats":96}],102:[function(require,module,exports){
17324
17755
  'use strict';
17325
17756
  var ReceiverReport = require('./receiverreport');
17326
17757
  var SenderReport = require('./senderreport');
@@ -17398,7 +17829,7 @@ var PeerConnectionReport = /** @class */ (function () {
17398
17829
  }());
17399
17830
  module.exports = PeerConnectionReport;
17400
17831
 
17401
- },{"./receiverreport":103,"./senderreport":110}],102:[function(require,module,exports){
17832
+ },{"./receiverreport":104,"./senderreport":111}],103:[function(require,module,exports){
17402
17833
  'use strict';
17403
17834
  var __read = (this && this.__read) || function (o, n) {
17404
17835
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -17828,7 +18259,7 @@ function updateChrome(factory) {
17828
18259
  }
17829
18260
  module.exports = PeerConnectionReportFactory;
17830
18261
 
17831
- },{"./icereportfactory":87,"./peerconnectionreport":101,"./receiverreportfactory":104,"./senderreportfactory":111,"@twilio/webrtc/lib/util":165}],103:[function(require,module,exports){
18262
+ },{"./icereportfactory":88,"./peerconnectionreport":102,"./receiverreportfactory":105,"./senderreportfactory":112,"@twilio/webrtc/lib/util":166}],104:[function(require,module,exports){
17832
18263
  'use strict';
17833
18264
  var __extends = (this && this.__extends) || (function () {
17834
18265
  var extendStatics = function (d, b) {
@@ -17954,7 +18385,7 @@ var ReceiverReport = /** @class */ (function (_super) {
17954
18385
  }(SenderOrReceiverReport));
17955
18386
  module.exports = ReceiverReport;
17956
18387
 
17957
- },{"./average":85,"./senderorreceiverreport":108,"./sum":113}],104:[function(require,module,exports){
18388
+ },{"./average":86,"./senderorreceiverreport":109,"./sum":114}],105:[function(require,module,exports){
17958
18389
  'use strict';
17959
18390
  var __extends = (this && this.__extends) || (function () {
17960
18391
  var extendStatics = function (d, b) {
@@ -18013,7 +18444,7 @@ var ReceiverReportFactory = /** @class */ (function (_super) {
18013
18444
  }(SenderOrReceiverReportFactory));
18014
18445
  module.exports = ReceiverReportFactory;
18015
18446
 
18016
- },{"./receiverreport":103,"./senderorreceiverreportfactory":109}],105:[function(require,module,exports){
18447
+ },{"./receiverreport":104,"./senderorreceiverreportfactory":110}],106:[function(require,module,exports){
18017
18448
  'use strict';
18018
18449
  var __extends = (this && this.__extends) || (function () {
18019
18450
  var extendStatics = function (d, b) {
@@ -18065,7 +18496,7 @@ var RemoteAudioTrackStats = /** @class */ (function (_super) {
18065
18496
  }(RemoteTrackStats));
18066
18497
  module.exports = RemoteAudioTrackStats;
18067
18498
 
18068
- },{"./remotetrackstats":106}],106:[function(require,module,exports){
18499
+ },{"./remotetrackstats":107}],107:[function(require,module,exports){
18069
18500
  'use strict';
18070
18501
  var __extends = (this && this.__extends) || (function () {
18071
18502
  var extendStatics = function (d, b) {
@@ -18117,7 +18548,7 @@ var RemoteTrackStats = /** @class */ (function (_super) {
18117
18548
  }(TrackStats));
18118
18549
  module.exports = RemoteTrackStats;
18119
18550
 
18120
- },{"./trackstats":114}],107:[function(require,module,exports){
18551
+ },{"./trackstats":115}],108:[function(require,module,exports){
18121
18552
  'use strict';
18122
18553
  var __extends = (this && this.__extends) || (function () {
18123
18554
  var extendStatics = function (d, b) {
@@ -18182,7 +18613,7 @@ var RemoteVideoTrackStats = /** @class */ (function (_super) {
18182
18613
  }(RemoteTrackStats));
18183
18614
  module.exports = RemoteVideoTrackStats;
18184
18615
 
18185
- },{"./remotetrackstats":106}],108:[function(require,module,exports){
18616
+ },{"./remotetrackstats":107}],109:[function(require,module,exports){
18186
18617
  'use strict';
18187
18618
  /**
18188
18619
  * @property {StatsId} id
@@ -18216,7 +18647,7 @@ var SenderOrReceiverReport = /** @class */ (function () {
18216
18647
  }());
18217
18648
  module.exports = SenderOrReceiverReport;
18218
18649
 
18219
- },{}],109:[function(require,module,exports){
18650
+ },{}],110:[function(require,module,exports){
18220
18651
  'use strict';
18221
18652
  /**
18222
18653
  * @property {StatsId} id
@@ -18252,7 +18683,7 @@ var SenderOrReceiverReportFactory = /** @class */ (function () {
18252
18683
  }());
18253
18684
  module.exports = SenderOrReceiverReportFactory;
18254
18685
 
18255
- },{}],110:[function(require,module,exports){
18686
+ },{}],111:[function(require,module,exports){
18256
18687
  /* eslint no-undefined:0 */
18257
18688
  'use strict';
18258
18689
  var __extends = (this && this.__extends) || (function () {
@@ -18340,7 +18771,7 @@ var SenderReport = /** @class */ (function (_super) {
18340
18771
  }(SenderOrReceiverReport));
18341
18772
  module.exports = SenderReport;
18342
18773
 
18343
- },{"./average":85,"./senderorreceiverreport":108,"./sum":113}],111:[function(require,module,exports){
18774
+ },{"./average":86,"./senderorreceiverreport":109,"./sum":114}],112:[function(require,module,exports){
18344
18775
  'use strict';
18345
18776
  var __extends = (this && this.__extends) || (function () {
18346
18777
  var extendStatics = function (d, b) {
@@ -18399,7 +18830,7 @@ var SenderReportFactory = /** @class */ (function (_super) {
18399
18830
  }(SenderOrReceiverReportFactory));
18400
18831
  module.exports = SenderReportFactory;
18401
18832
 
18402
- },{"./senderorreceiverreportfactory":109,"./senderreport":110}],112:[function(require,module,exports){
18833
+ },{"./senderorreceiverreportfactory":110,"./senderreport":111}],113:[function(require,module,exports){
18403
18834
  'use strict';
18404
18835
  var LocalAudioTrackStats = require('./localaudiotrackstats');
18405
18836
  var LocalVideoTrackStats = require('./localvideotrackstats');
@@ -18450,7 +18881,7 @@ var StatsReport = /** @class */ (function () {
18450
18881
  }());
18451
18882
  module.exports = StatsReport;
18452
18883
 
18453
- },{"./localaudiotrackstats":88,"./localvideotrackstats":90,"./remoteaudiotrackstats":105,"./remotevideotrackstats":107}],113:[function(require,module,exports){
18884
+ },{"./localaudiotrackstats":89,"./localvideotrackstats":91,"./remoteaudiotrackstats":106,"./remotevideotrackstats":108}],114:[function(require,module,exports){
18454
18885
  'use strict';
18455
18886
  /**
18456
18887
  * @param {Array<number|undefined>} xs
@@ -18461,7 +18892,7 @@ function sum(xs) {
18461
18892
  }
18462
18893
  module.exports = sum;
18463
18894
 
18464
- },{}],114:[function(require,module,exports){
18895
+ },{}],115:[function(require,module,exports){
18465
18896
  'use strict';
18466
18897
  /**
18467
18898
  * Statistics for a {@link Track}.
@@ -18520,7 +18951,7 @@ var TrackStats = /** @class */ (function () {
18520
18951
  }());
18521
18952
  module.exports = TrackStats;
18522
18953
 
18523
- },{}],115:[function(require,module,exports){
18954
+ },{}],116:[function(require,module,exports){
18524
18955
  'use strict';
18525
18956
  var __extends = (this && this.__extends) || (function () {
18526
18957
  var extendStatics = function (d, b) {
@@ -18582,7 +19013,7 @@ var TrackTransceiver = /** @class */ (function (_super) {
18582
19013
  */
18583
19014
  module.exports = TrackTransceiver;
18584
19015
 
18585
- },{"events":179}],116:[function(require,module,exports){
19016
+ },{"events":180}],117:[function(require,module,exports){
18586
19017
  (function (global){(function (){
18587
19018
  'use strict';
18588
19019
  var __extends = (this && this.__extends) || (function () {
@@ -19237,7 +19668,7 @@ TwilioConnection.CloseReason = CloseReason;
19237
19668
  module.exports = TwilioConnection;
19238
19669
 
19239
19670
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
19240
- },{"./statemachine":84,"./util":126,"./util/log":130,"./util/networkmonitor":132,"./util/timeout":142,"ws":201}],117:[function(require,module,exports){
19671
+ },{"./statemachine":85,"./util":127,"./util/log":131,"./util/networkmonitor":133,"./util/timeout":143,"ws":202}],118:[function(require,module,exports){
19241
19672
  'use strict';
19242
19673
  var defer = require('./').defer;
19243
19674
  /**
@@ -19302,7 +19733,7 @@ var AsyncVar = /** @class */ (function () {
19302
19733
  }());
19303
19734
  module.exports = AsyncVar;
19304
19735
 
19305
- },{"./":126}],118:[function(require,module,exports){
19736
+ },{"./":127}],119:[function(require,module,exports){
19306
19737
  /* globals chrome, navigator */
19307
19738
  'use strict';
19308
19739
  var __read = (this && this.__read) || function (o, n) {
@@ -19433,7 +19864,7 @@ module.exports = {
19433
19864
  rebrandedChromeBrowser: rebrandedChromeBrowser
19434
19865
  };
19435
19866
 
19436
- },{}],119:[function(require,module,exports){
19867
+ },{}],120:[function(require,module,exports){
19437
19868
  'use strict';
19438
19869
  var __read = (this && this.__read) || function (o, n) {
19439
19870
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -19576,7 +20007,7 @@ var CancelablePromise = /** @class */ (function () {
19576
20007
  }());
19577
20008
  module.exports = CancelablePromise;
19578
20009
 
19579
- },{}],120:[function(require,module,exports){
20010
+ },{}],121:[function(require,module,exports){
19580
20011
  'use strict';
19581
20012
  var packageInfo = require('../../package.json');
19582
20013
  module.exports.SDK_NAME = packageInfo.name + ".js";
@@ -19664,7 +20095,7 @@ module.exports.videoContentPreferencesMode = {
19664
20095
  MODE_MANUAL: 'manual'
19665
20096
  };
19666
20097
 
19667
- },{"../../package.json":200}],121:[function(require,module,exports){
20098
+ },{"../../package.json":201}],122:[function(require,module,exports){
19668
20099
  'use strict';
19669
20100
  var detectSilence = require('../webaudio/detectsilence');
19670
20101
  var N_ATTEMPTS = 3;
@@ -19705,7 +20136,7 @@ function detectSilentAudio(el) {
19705
20136
  }
19706
20137
  module.exports = detectSilentAudio;
19707
20138
 
19708
- },{"../webaudio/audiocontext":147,"../webaudio/detectsilence":148}],122:[function(require,module,exports){
20139
+ },{"../webaudio/audiocontext":148,"../webaudio/detectsilence":149}],123:[function(require,module,exports){
19709
20140
  'use strict';
19710
20141
  // Cached copy of the <canvas> used to check silent video frames.
19711
20142
  var canvas = null;
@@ -19764,7 +20195,7 @@ function detectSilentVideo(el) {
19764
20195
  }
19765
20196
  module.exports = detectSilentVideo;
19766
20197
 
19767
- },{}],123:[function(require,module,exports){
20198
+ },{}],124:[function(require,module,exports){
19768
20199
  'use strict';
19769
20200
  /**
19770
20201
  * The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM
@@ -19886,7 +20317,7 @@ var DocumentVisibilityMonitor = /** @class */ (function () {
19886
20317
  }());
19887
20318
  module.exports = new DocumentVisibilityMonitor(2);
19888
20319
 
19889
- },{}],124:[function(require,module,exports){
20320
+ },{}],125:[function(require,module,exports){
19890
20321
  /* eslint-disable no-console */
19891
20322
  'use strict';
19892
20323
  var __extends = (this && this.__extends) || (function () {
@@ -19984,7 +20415,7 @@ var EventObserver = /** @class */ (function (_super) {
19984
20415
  */
19985
20416
  module.exports = EventObserver;
19986
20417
 
19987
- },{"events":179}],125:[function(require,module,exports){
20418
+ },{"events":180}],126:[function(require,module,exports){
19988
20419
  'use strict';
19989
20420
  var Filter = /** @class */ (function () {
19990
20421
  function Filter(options) {
@@ -20028,7 +20459,7 @@ var Filter = /** @class */ (function () {
20028
20459
  }());
20029
20460
  module.exports = Filter;
20030
20461
 
20031
- },{}],126:[function(require,module,exports){
20462
+ },{}],127:[function(require,module,exports){
20032
20463
  'use strict';
20033
20464
  var __extends = (this && this.__extends) || (function () {
20034
20465
  var extendStatics = function (d, b) {
@@ -20633,13 +21064,27 @@ function createRoomConnectEventPayload(connectOptions) {
20633
21064
  eventProp = eventProp || prop;
20634
21065
  payload[eventProp] = boolToString(!!connectOptions[prop]);
20635
21066
  });
20636
- // numbers and string properties.
20637
- [['maxVideoBitrate'], ['maxAudioBitrate'], ['iceTransportPolicy'], ['region'], ['name', 'roomName']].forEach(function (_a) {
21067
+ // numbers properties.
21068
+ [['maxVideoBitrate'], ['maxAudioBitrate']].forEach(function (_a) {
20638
21069
  var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
20639
21070
  eventProp = eventProp || prop;
20640
- if (typeof connectOptions[prop] === 'number' || typeof connectOptions[prop] === 'string') {
21071
+ if (typeof connectOptions[prop] === 'number') {
20641
21072
  payload[eventProp] = connectOptions[prop];
20642
21073
  }
21074
+ else if (!isNaN(Number(connectOptions[prop]))) {
21075
+ payload[eventProp] = Number(connectOptions[prop]);
21076
+ }
21077
+ });
21078
+ // string properties.
21079
+ [['iceTransportPolicy'], ['region'], ['name', 'roomName']].forEach(function (_a) {
21080
+ var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
21081
+ eventProp = eventProp || prop;
21082
+ if (typeof connectOptions[prop] === 'string') {
21083
+ payload[eventProp] = connectOptions[prop];
21084
+ }
21085
+ else if (typeof connectOptions[prop] === 'number' && prop === 'name') {
21086
+ payload[eventProp] = connectOptions[prop].toString();
21087
+ }
20643
21088
  });
20644
21089
  // array props stringified.
20645
21090
  ['preferredAudioCodecs', 'preferredVideoCodecs'].forEach(function (prop) {
@@ -20722,7 +21167,7 @@ function createBandwidthProfileVideoPayload(bandwidthProfileVideo) {
20722
21167
  * protocol or not.
20723
21168
  * @returns {object}
20724
21169
  */
20725
- function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, renderHints) {
21170
+ function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, adaptiveSimulcast, renderHints) {
20726
21171
  var transports = { transports: [{ type: 'data-channel' }] };
20727
21172
  return Object.assign(dominantSpeaker
20728
21173
  // eslint-disable-next-line
@@ -20733,6 +21178,9 @@ function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPrior
20733
21178
  : {}, renderHints
20734
21179
  // eslint-disable-next-line
20735
21180
  ? { render_hints: transports }
21181
+ : {}, adaptiveSimulcast
21182
+ // eslint-disable-next-line
21183
+ ? { publisher_hints: transports }
20736
21184
  : {}, trackPriority
20737
21185
  // eslint-disable-next-line
20738
21186
  ? { track_priority: transports }
@@ -20827,8 +21275,7 @@ function inRange(num, min, max) {
20827
21275
  function isChromeScreenShareTrack(track) {
20828
21276
  // NOTE(mpatwardhan): Chrome creates screen share tracks with label like: "screen:69734272*"
20829
21277
  // we will check for label that starts with "screen:D" where D being a digit.
20830
- var isChrome = util.guessBrowser() === 'chrome';
20831
- 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));
21278
+ return util.guessBrowser() === 'chrome' && track.kind === 'video' && 'displaySurface' in track.getSettings();
20832
21279
  }
20833
21280
  /**
20834
21281
  * returns true if given MediaStreamTrack is a user media track
@@ -20898,7 +21345,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
20898
21345
  exports.waitForSometime = waitForSometime;
20899
21346
  exports.waitForEvent = waitForEvent;
20900
21347
 
20901
- },{"./constants":120,"./sid":140,"@twilio/webrtc/lib/util":165}],127:[function(require,module,exports){
21348
+ },{"./constants":121,"./sid":141,"@twilio/webrtc/lib/util":166}],128:[function(require,module,exports){
20902
21349
  (function (global){(function (){
20903
21350
  'use strict';
20904
21351
  var __extends = (this && this.__extends) || (function () {
@@ -21175,7 +21622,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
21175
21622
  module.exports = InsightsPublisher;
21176
21623
 
21177
21624
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21178
- },{"..":126,"../../util":126,"events":179,"ws":201}],128:[function(require,module,exports){
21625
+ },{"..":127,"../../util":127,"events":180,"ws":202}],129:[function(require,module,exports){
21179
21626
  // eslint-disable-next-line no-warning-comments
21180
21627
  // TODO(mroberts): This should be described as implementing some
21181
21628
  // InsightsPublisher interface.
@@ -21220,7 +21667,7 @@ var InsightsPublisher = /** @class */ (function () {
21220
21667
  }());
21221
21668
  module.exports = InsightsPublisher;
21222
21669
 
21223
- },{}],129:[function(require,module,exports){
21670
+ },{}],130:[function(require,module,exports){
21224
21671
  'use strict';
21225
21672
  var defer = require('./').defer;
21226
21673
  /**
@@ -21282,7 +21729,7 @@ var LocalMediaRestartDeferreds = /** @class */ (function () {
21282
21729
  }());
21283
21730
  module.exports = new LocalMediaRestartDeferreds();
21284
21731
 
21285
- },{"./":126}],130:[function(require,module,exports){
21732
+ },{"./":127}],131:[function(require,module,exports){
21286
21733
  /* eslint new-cap:0 */
21287
21734
  'use strict';
21288
21735
  var __read = (this && this.__read) || function (o, n) {
@@ -21569,7 +22016,7 @@ function validateLogLevels(levels) {
21569
22016
  }
21570
22017
  module.exports = Log;
21571
22018
 
21572
- },{"../vendor/loglevel":146,"./constants":120}],131:[function(require,module,exports){
22019
+ },{"../vendor/loglevel":147,"./constants":121}],132:[function(require,module,exports){
21573
22020
  'use strict';
21574
22021
  /**
21575
22022
  * Calculates the moving average delta for the given pair ofsamples. A sample (S)
@@ -21616,7 +22063,7 @@ var MovingAverageDelta = /** @class */ (function () {
21616
22063
  }());
21617
22064
  module.exports = MovingAverageDelta;
21618
22065
 
21619
- },{}],132:[function(require,module,exports){
22066
+ },{}],133:[function(require,module,exports){
21620
22067
  'use strict';
21621
22068
  /**
21622
22069
  * Monitor the network connection status to detect interruptions and handoffs.
@@ -21705,7 +22152,7 @@ var NetworkMonitor = /** @class */ (function () {
21705
22152
  }());
21706
22153
  module.exports = NetworkMonitor;
21707
22154
 
21708
- },{}],133:[function(require,module,exports){
22155
+ },{}],134:[function(require,module,exports){
21709
22156
  /* eslint-disable no-console */
21710
22157
  'use strict';
21711
22158
  var __extends = (this && this.__extends) || (function () {
@@ -21768,7 +22215,7 @@ var NullResizeObserver = /** @class */ (function (_super) {
21768
22215
  }(NullObserver));
21769
22216
  module.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };
21770
22217
 
21771
- },{}],134:[function(require,module,exports){
22218
+ },{}],135:[function(require,module,exports){
21772
22219
  'use strict';
21773
22220
  var __read = (this && this.__read) || function (o, n) {
21774
22221
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -22156,9 +22603,12 @@ function unifiedPlanFilterLocalCodecs(localSdp, remoteSdp) {
22156
22603
  * @param localSdp - simulcast enabled local sdp
22157
22604
  * @param localSdpWithoutSimulcast - local sdp before simulcast was set
22158
22605
  * @param remoteSdp - remote sdp
22606
+ * @param revertForAll - when true simulcast will be reverted for all codecs. when false it will be reverted
22607
+ * only for non-vp8 codecs.
22159
22608
  * @return {string} Updated SDP string
22160
22609
  */
22161
- function revertSimulcastForNonVP8MediaSections(localSdp, localSdpWithoutSimulcast, remoteSdp) {
22610
+ function revertSimulcast(localSdp, localSdpWithoutSimulcast, remoteSdp, revertForAll) {
22611
+ if (revertForAll === void 0) { revertForAll = false; }
22162
22612
  var remoteMidToMediaSections = createMidToMediaSectionMap(remoteSdp);
22163
22613
  var localMidToMediaSectionsWithoutSimulcast = createMidToMediaSectionMap(localSdpWithoutSimulcast);
22164
22614
  var mediaSections = getMediaSections(localSdp);
@@ -22177,7 +22627,8 @@ function revertSimulcastForNonVP8MediaSections(localSdp, localSdpWithoutSimulcas
22177
22627
  var remotePtToCodecs = createPtToCodecName(remoteSection);
22178
22628
  var remotePayloadTypes = getPayloadTypesInMediaSection(remoteSection);
22179
22629
  var isVP8ThePreferredCodec = remotePayloadTypes.length && remotePtToCodecs.get(remotePayloadTypes[0]) === 'vp8';
22180
- return isVP8ThePreferredCodec ? section : localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\r\n$/, '');
22630
+ var shouldRevertSimulcast = revertForAll || !isVP8ThePreferredCodec;
22631
+ return shouldRevertSimulcast ? localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\r\n$/, '') : section;
22181
22632
  })).concat('').join('\r\n');
22182
22633
  }
22183
22634
  /**
@@ -22362,7 +22813,7 @@ exports.disableRtx = disableRtx;
22362
22813
  exports.enableDtxForOpus = enableDtxForOpus;
22363
22814
  exports.getMediaSections = getMediaSections;
22364
22815
  exports.removeSSRCAttributes = removeSSRCAttributes;
22365
- exports.revertSimulcastForNonVP8MediaSections = revertSimulcastForNonVP8MediaSections;
22816
+ exports.revertSimulcast = revertSimulcast;
22366
22817
  exports.setBitrateParameters = setBitrateParameters;
22367
22818
  exports.setCodecPreferences = setCodecPreferences;
22368
22819
  exports.setSimulcast = setSimulcast;
@@ -22370,7 +22821,7 @@ exports.unifiedPlanFilterLocalCodecs = unifiedPlanFilterLocalCodecs;
22370
22821
  exports.unifiedPlanAddOrRewriteNewTrackIds = unifiedPlanAddOrRewriteNewTrackIds;
22371
22822
  exports.unifiedPlanAddOrRewriteTrackIds = unifiedPlanAddOrRewriteTrackIds;
22372
22823
 
22373
- },{"../":126,"./simulcast":136}],135:[function(require,module,exports){
22824
+ },{"../":127,"./simulcast":137}],136:[function(require,module,exports){
22374
22825
  'use strict';
22375
22826
  var RTCSessionDescription = require('@twilio/webrtc').RTCSessionDescription;
22376
22827
  var createPtToCodecName = require('./').createPtToCodecName;
@@ -22564,7 +23015,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
22564
23015
  }
22565
23016
  module.exports = workaround;
22566
23017
 
22567
- },{"./":134,"@twilio/webrtc":152}],136:[function(require,module,exports){
23018
+ },{"./":135,"@twilio/webrtc":153}],137:[function(require,module,exports){
22568
23019
  'use strict';
22569
23020
  var __read = (this && this.__read) || function (o, n) {
22570
23021
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -22850,7 +23301,7 @@ function setSimulcastInMediaSection(section, sdpFormat, trackIdsToAttributes) {
22850
23301
  */
22851
23302
  module.exports = setSimulcastInMediaSection;
22852
23303
 
22853
- },{"../":126}],137:[function(require,module,exports){
23304
+ },{"../":127}],138:[function(require,module,exports){
22854
23305
  'use strict';
22855
23306
  /**
22856
23307
  * An {@link IdentityTrackMatcher} matches RTCTrackEvents with their respective
@@ -22876,7 +23327,7 @@ var IdentityTrackMatcher = /** @class */ (function () {
22876
23327
  }());
22877
23328
  module.exports = IdentityTrackMatcher;
22878
23329
 
22879
- },{}],138:[function(require,module,exports){
23330
+ },{}],139:[function(require,module,exports){
22880
23331
  'use strict';
22881
23332
  var getMediaSections = require('../').getMediaSections;
22882
23333
  /**
@@ -22921,7 +23372,7 @@ var MIDTrackMatcher = /** @class */ (function () {
22921
23372
  }());
22922
23373
  module.exports = MIDTrackMatcher;
22923
23374
 
22924
- },{"../":134}],139:[function(require,module,exports){
23375
+ },{"../":135}],140:[function(require,module,exports){
22925
23376
  'use strict';
22926
23377
  var util = require('../../');
22927
23378
  var getMediaSections = require('../').getMediaSections;
@@ -23033,7 +23484,7 @@ var OrderedTrackMatcher = /** @class */ (function () {
23033
23484
  }());
23034
23485
  module.exports = OrderedTrackMatcher;
23035
23486
 
23036
- },{"../":134,"../../":126}],140:[function(require,module,exports){
23487
+ },{"../":135,"../../":127}],141:[function(require,module,exports){
23037
23488
  var SID_CHARS = '1234567890abcdef';
23038
23489
  var SID_CHAR_LENGTH = 32;
23039
23490
  // copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
@@ -23052,7 +23503,7 @@ function createSID(prefix) {
23052
23503
  exports.sessionSID = createSID('SS');
23053
23504
  exports.createSID = createSID;
23054
23505
 
23055
- },{}],141:[function(require,module,exports){
23506
+ },{}],142:[function(require,module,exports){
23056
23507
  'use strict';
23057
23508
  var _a = require('@twilio/webrtc/lib/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
23058
23509
  var _b = require('./browserdetection'), isAndroid = _b.isAndroid, isMobile = _b.isMobile, isNonChromiumEdge = _b.isNonChromiumEdge, rebrandedChromeBrowser = _b.rebrandedChromeBrowser, mobileWebKitBrowser = _b.mobileWebKitBrowser;
@@ -23097,7 +23548,7 @@ function isSupported() {
23097
23548
  }
23098
23549
  module.exports = isSupported;
23099
23550
 
23100
- },{"./browserdetection":118,"@twilio/webrtc/lib/util":165}],142:[function(require,module,exports){
23551
+ },{"./browserdetection":119,"@twilio/webrtc/lib/util":166}],143:[function(require,module,exports){
23101
23552
  'use strict';
23102
23553
  /**
23103
23554
  * A {@link Timeout} represents a resettable and clearable timeout.
@@ -23192,7 +23643,7 @@ var Timeout = /** @class */ (function () {
23192
23643
  }());
23193
23644
  module.exports = Timeout;
23194
23645
 
23195
- },{}],143:[function(require,module,exports){
23646
+ },{}],144:[function(require,module,exports){
23196
23647
  // NOTE: Do not edit this file. This code is auto-generated. Contact the
23197
23648
  // Twilio SDK Team for more information.
23198
23649
  'use strict';
@@ -24216,7 +24667,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
24216
24667
  exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
24217
24668
  Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
24218
24669
 
24219
- },{"./twilioerror":144}],144:[function(require,module,exports){
24670
+ },{"./twilioerror":145}],145:[function(require,module,exports){
24220
24671
  'use strict';
24221
24672
  var __extends = (this && this.__extends) || (function () {
24222
24673
  var extendStatics = function (d, b) {
@@ -24298,7 +24749,7 @@ var TwilioError = /** @class */ (function (_super) {
24298
24749
  }(Error));
24299
24750
  module.exports = TwilioError;
24300
24751
 
24301
- },{}],145:[function(require,module,exports){
24752
+ },{}],146:[function(require,module,exports){
24302
24753
  'use strict';
24303
24754
  var isNonArrayObject = require('./').isNonArrayObject;
24304
24755
  var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
@@ -24415,7 +24866,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
24415
24866
  exports.validateLocalTrack = validateLocalTrack;
24416
24867
  exports.validateObject = validateObject;
24417
24868
 
24418
- },{"./":126,"./constants":120}],146:[function(require,module,exports){
24869
+ },{"./":127,"./constants":121}],147:[function(require,module,exports){
24419
24870
  /**
24420
24871
  * Copyright (c) 2013 Tim Perry
24421
24872
  * Licensed under the MIT license.
@@ -24655,7 +25106,7 @@ defaultLogger.getLoggers = function getLoggers() {
24655
25106
  defaultLogger['default'] = defaultLogger;
24656
25107
  module.exports = defaultLogger;
24657
25108
 
24658
- },{}],147:[function(require,module,exports){
25109
+ },{}],148:[function(require,module,exports){
24659
25110
  /* globals webkitAudioContext, AudioContext */
24660
25111
  'use strict';
24661
25112
  var NativeAudioContext = typeof AudioContext !== 'undefined'
@@ -24738,7 +25189,7 @@ var AudioContextFactory = /** @class */ (function () {
24738
25189
  }());
24739
25190
  module.exports = new AudioContextFactory();
24740
25191
 
24741
- },{}],148:[function(require,module,exports){
25192
+ },{}],149:[function(require,module,exports){
24742
25193
  'use strict';
24743
25194
  /**
24744
25195
  * Return a Promise that resolves after `timeout` milliseconds.
@@ -24791,7 +25242,7 @@ function detectSilence(audioContext, stream, timeout) {
24791
25242
  }
24792
25243
  module.exports = detectSilence;
24793
25244
 
24794
- },{}],149:[function(require,module,exports){
25245
+ },{}],150:[function(require,module,exports){
24795
25246
  'use strict';
24796
25247
  var detectSilence = require('./detectsilence');
24797
25248
  /**
@@ -24861,7 +25312,7 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
24861
25312
  }
24862
25313
  module.exports = workaround;
24863
25314
 
24864
- },{"./audiocontext":147,"./detectsilence":148}],150:[function(require,module,exports){
25315
+ },{"./audiocontext":148,"./detectsilence":149}],151:[function(require,module,exports){
24865
25316
  'use strict';
24866
25317
 
24867
25318
  var flatMap = require('./util').flatMap;
@@ -25754,7 +26205,7 @@ function standardizeFirefoxStats(response, isRemote) {
25754
26205
 
25755
26206
  module.exports = getStats;
25756
26207
 
25757
- },{"./util":165,"./util/sdp":167}],151:[function(require,module,exports){
26208
+ },{"./util":166,"./util/sdp":168}],152:[function(require,module,exports){
25758
26209
  /* globals navigator */
25759
26210
  'use strict';
25760
26211
 
@@ -25780,7 +26231,7 @@ function getUserMedia(constraints) {
25780
26231
 
25781
26232
  module.exports = getUserMedia;
25782
26233
 
25783
- },{}],152:[function(require,module,exports){
26234
+ },{}],153:[function(require,module,exports){
25784
26235
  'use strict';
25785
26236
 
25786
26237
  var WebRTC = {};
@@ -25822,7 +26273,7 @@ Object.defineProperties(WebRTC, {
25822
26273
 
25823
26274
  module.exports = WebRTC;
25824
26275
 
25825
- },{"../package.json":168,"./getstats":150,"./getusermedia":151,"./mediastream":153,"./mediastreamtrack":154,"./rtcicecandidate":155,"./rtcpeerconnection":158,"./rtcsessiondescription":163}],153:[function(require,module,exports){
26276
+ },{"../package.json":169,"./getstats":151,"./getusermedia":152,"./mediastream":154,"./mediastreamtrack":155,"./rtcicecandidate":156,"./rtcpeerconnection":159,"./rtcsessiondescription":164}],154:[function(require,module,exports){
25826
26277
  /* globals MediaStream */
25827
26278
  'use strict';
25828
26279
 
@@ -25834,7 +26285,7 @@ if (typeof MediaStream === 'function') {
25834
26285
  };
25835
26286
  }
25836
26287
 
25837
- },{}],154:[function(require,module,exports){
26288
+ },{}],155:[function(require,module,exports){
25838
26289
  /* global MediaStreamTrack */
25839
26290
  'use strict';
25840
26291
 
@@ -25846,7 +26297,7 @@ if (typeof MediaStreamTrack === 'function') {
25846
26297
  };
25847
26298
  }
25848
26299
 
25849
- },{}],155:[function(require,module,exports){
26300
+ },{}],156:[function(require,module,exports){
25850
26301
  /* global RTCIceCandidate */
25851
26302
  'use strict';
25852
26303
 
@@ -25858,7 +26309,7 @@ if (typeof RTCIceCandidate === 'function') {
25858
26309
  };
25859
26310
  }
25860
26311
 
25861
- },{}],156:[function(require,module,exports){
26312
+ },{}],157:[function(require,module,exports){
25862
26313
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
25863
26314
  'use strict';
25864
26315
 
@@ -26422,7 +26873,7 @@ function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
26422
26873
 
26423
26874
  module.exports = ChromeRTCPeerConnection;
26424
26875
 
26425
- },{"../mediastream":153,"../rtcrtpsender":160,"../rtcsessiondescription/chrome":161,"../util":165,"../util/eventtarget":164,"../util/latch":166,"../util/sdp":167,"util":198}],157:[function(require,module,exports){
26876
+ },{"../mediastream":154,"../rtcrtpsender":161,"../rtcsessiondescription/chrome":162,"../util":166,"../util/eventtarget":165,"../util/latch":167,"../util/sdp":168,"util":199}],158:[function(require,module,exports){
26426
26877
  /* globals RTCPeerConnection */
26427
26878
  'use strict';
26428
26879
 
@@ -26755,7 +27206,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
26755
27206
 
26756
27207
  module.exports = FirefoxRTCPeerConnection;
26757
27208
 
26758
- },{"../rtcsessiondescription/firefox":162,"../util":165,"../util/eventtarget":164,"../util/sdp":167,"util":198}],158:[function(require,module,exports){
27209
+ },{"../rtcsessiondescription/firefox":163,"../util":166,"../util/eventtarget":165,"../util/sdp":168,"util":199}],159:[function(require,module,exports){
26759
27210
  'use strict';
26760
27211
 
26761
27212
  if (typeof RTCPeerConnection === 'function') {
@@ -26780,7 +27231,7 @@ if (typeof RTCPeerConnection === 'function') {
26780
27231
  };
26781
27232
  }
26782
27233
 
26783
- },{"../util":165,"./chrome":156,"./firefox":157,"./safari":159}],159:[function(require,module,exports){
27234
+ },{"../util":166,"./chrome":157,"./firefox":158,"./safari":160}],160:[function(require,module,exports){
26784
27235
  /* globals RTCPeerConnection, RTCSessionDescription */
26785
27236
  'use strict';
26786
27237
 
@@ -27171,7 +27622,7 @@ function shimDataChannel(dataChannel) {
27171
27622
 
27172
27623
  module.exports = SafariRTCPeerConnection;
27173
27624
 
27174
- },{"../util":165,"../util/eventtarget":164,"../util/latch":166,"../util/sdp":167,"util":198}],160:[function(require,module,exports){
27625
+ },{"../util":166,"../util/eventtarget":165,"../util/latch":167,"../util/sdp":168,"util":199}],161:[function(require,module,exports){
27175
27626
  'use strict';
27176
27627
 
27177
27628
  /**
@@ -27212,7 +27663,7 @@ function RTCRtpSenderShim(track) {
27212
27663
 
27213
27664
  module.exports = RTCRtpSenderShim;
27214
27665
 
27215
- },{}],161:[function(require,module,exports){
27666
+ },{}],162:[function(require,module,exports){
27216
27667
  /* globals RTCSessionDescription */
27217
27668
  'use strict';
27218
27669
 
@@ -27253,13 +27704,13 @@ function ChromeRTCSessionDescription(descriptionInitDict) {
27253
27704
 
27254
27705
  module.exports = ChromeRTCSessionDescription;
27255
27706
 
27256
- },{}],162:[function(require,module,exports){
27707
+ },{}],163:[function(require,module,exports){
27257
27708
  /* globals RTCSessionDescription */
27258
27709
  'use strict';
27259
27710
 
27260
27711
  module.exports = RTCSessionDescription;
27261
27712
 
27262
- },{}],163:[function(require,module,exports){
27713
+ },{}],164:[function(require,module,exports){
27263
27714
  /* globals RTCSessionDescription */
27264
27715
  'use strict';
27265
27716
 
@@ -27282,7 +27733,7 @@ if (typeof RTCSessionDescription === 'function') {
27282
27733
  };
27283
27734
  }
27284
27735
 
27285
- },{"../util":165,"./chrome":161,"./firefox":162}],164:[function(require,module,exports){
27736
+ },{"../util":166,"./chrome":162,"./firefox":163}],165:[function(require,module,exports){
27286
27737
  'use strict';
27287
27738
 
27288
27739
  var EventEmitter = require('events').EventEmitter;
@@ -27323,7 +27774,7 @@ EventTarget.prototype.removeEventListener = function removeEventListener() {
27323
27774
 
27324
27775
  module.exports = EventTarget;
27325
27776
 
27326
- },{"events":179}],165:[function(require,module,exports){
27777
+ },{"events":180}],166:[function(require,module,exports){
27327
27778
  'use strict';
27328
27779
 
27329
27780
  /**
@@ -27660,7 +28111,7 @@ exports.makeUUID = makeUUID;
27660
28111
  exports.proxyProperties = proxyProperties;
27661
28112
  exports.support = support;
27662
28113
 
27663
- },{}],166:[function(require,module,exports){
28114
+ },{}],167:[function(require,module,exports){
27664
28115
  'use strict';
27665
28116
 
27666
28117
  var defer = require('./').defer;
@@ -27775,7 +28226,7 @@ function createUnreachableStateError(from, to) {
27775
28226
 
27776
28227
  module.exports = Latch;
27777
28228
 
27778
- },{"./":165}],167:[function(require,module,exports){
28229
+ },{"./":166}],168:[function(require,module,exports){
27779
28230
  /* globals RTCPeerConnection, RTCRtpTransceiver */
27780
28231
 
27781
28232
  'use strict';
@@ -28085,7 +28536,7 @@ exports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;
28085
28536
  exports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;
28086
28537
  exports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;
28087
28538
 
28088
- },{"./":165}],168:[function(require,module,exports){
28539
+ },{"./":166}],169:[function(require,module,exports){
28089
28540
  module.exports={
28090
28541
  "name": "@twilio/webrtc",
28091
28542
  "version": "4.5.2",
@@ -28150,7 +28601,7 @@ module.exports={
28150
28601
  }
28151
28602
  }
28152
28603
 
28153
- },{}],169:[function(require,module,exports){
28604
+ },{}],170:[function(require,module,exports){
28154
28605
  (function (global){(function (){
28155
28606
  'use strict';
28156
28607
 
@@ -28181,7 +28632,7 @@ module.exports = function availableTypedArrays() {
28181
28632
  };
28182
28633
 
28183
28634
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28184
- },{}],170:[function(require,module,exports){
28635
+ },{}],171:[function(require,module,exports){
28185
28636
  // Copyright (c) 2012 Mathieu Turcotte
28186
28637
  // Licensed under the MIT license.
28187
28638
 
@@ -28214,7 +28665,7 @@ module.exports.call = function(fn, vargs, callback) {
28214
28665
  return new FunctionCall(fn, vargs, callback);
28215
28666
  };
28216
28667
 
28217
- },{"./lib/backoff":171,"./lib/function_call.js":172,"./lib/strategy/exponential":173,"./lib/strategy/fibonacci":174}],171:[function(require,module,exports){
28668
+ },{"./lib/backoff":172,"./lib/function_call.js":173,"./lib/strategy/exponential":174,"./lib/strategy/fibonacci":175}],172:[function(require,module,exports){
28218
28669
  // Copyright (c) 2012 Mathieu Turcotte
28219
28670
  // Licensed under the MIT license.
28220
28671
 
@@ -28281,7 +28732,7 @@ Backoff.prototype.reset = function() {
28281
28732
 
28282
28733
  module.exports = Backoff;
28283
28734
 
28284
- },{"events":179,"precond":192,"util":198}],172:[function(require,module,exports){
28735
+ },{"events":180,"precond":193,"util":199}],173:[function(require,module,exports){
28285
28736
  // Copyright (c) 2012 Mathieu Turcotte
28286
28737
  // Licensed under the MIT license.
28287
28738
 
@@ -28473,7 +28924,7 @@ FunctionCall.prototype.handleBackoff_ = function(number, delay, err) {
28473
28924
 
28474
28925
  module.exports = FunctionCall;
28475
28926
 
28476
- },{"./backoff":171,"./strategy/fibonacci":174,"events":179,"precond":192,"util":198}],173:[function(require,module,exports){
28927
+ },{"./backoff":172,"./strategy/fibonacci":175,"events":180,"precond":193,"util":199}],174:[function(require,module,exports){
28477
28928
  // Copyright (c) 2012 Mathieu Turcotte
28478
28929
  // Licensed under the MIT license.
28479
28930
 
@@ -28516,7 +28967,7 @@ ExponentialBackoffStrategy.prototype.reset_ = function() {
28516
28967
 
28517
28968
  module.exports = ExponentialBackoffStrategy;
28518
28969
 
28519
- },{"./strategy":175,"precond":192,"util":198}],174:[function(require,module,exports){
28970
+ },{"./strategy":176,"precond":193,"util":199}],175:[function(require,module,exports){
28520
28971
  // Copyright (c) 2012 Mathieu Turcotte
28521
28972
  // Licensed under the MIT license.
28522
28973
 
@@ -28546,7 +28997,7 @@ FibonacciBackoffStrategy.prototype.reset_ = function() {
28546
28997
 
28547
28998
  module.exports = FibonacciBackoffStrategy;
28548
28999
 
28549
- },{"./strategy":175,"util":198}],175:[function(require,module,exports){
29000
+ },{"./strategy":176,"util":199}],176:[function(require,module,exports){
28550
29001
  // Copyright (c) 2012 Mathieu Turcotte
28551
29002
  // Licensed under the MIT license.
28552
29003
 
@@ -28628,7 +29079,7 @@ BackoffStrategy.prototype.reset_ = function() {
28628
29079
 
28629
29080
  module.exports = BackoffStrategy;
28630
29081
 
28631
- },{"events":179,"util":198}],176:[function(require,module,exports){
29082
+ },{"events":180,"util":199}],177:[function(require,module,exports){
28632
29083
  'use strict';
28633
29084
 
28634
29085
  var GetIntrinsic = require('get-intrinsic');
@@ -28645,7 +29096,7 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
28645
29096
  return intrinsic;
28646
29097
  };
28647
29098
 
28648
- },{"./":177,"get-intrinsic":183}],177:[function(require,module,exports){
29099
+ },{"./":178,"get-intrinsic":184}],178:[function(require,module,exports){
28649
29100
  'use strict';
28650
29101
 
28651
29102
  var bind = require('function-bind');
@@ -28694,7 +29145,7 @@ if ($defineProperty) {
28694
29145
  module.exports.apply = applyBind;
28695
29146
  }
28696
29147
 
28697
- },{"function-bind":182,"get-intrinsic":183}],178:[function(require,module,exports){
29148
+ },{"function-bind":183,"get-intrinsic":184}],179:[function(require,module,exports){
28698
29149
  'use strict';
28699
29150
 
28700
29151
  var GetIntrinsic = require('get-intrinsic');
@@ -28711,7 +29162,7 @@ if ($gOPD) {
28711
29162
 
28712
29163
  module.exports = $gOPD;
28713
29164
 
28714
- },{"get-intrinsic":183}],179:[function(require,module,exports){
29165
+ },{"get-intrinsic":184}],180:[function(require,module,exports){
28715
29166
  // Copyright Joyent, Inc. and other Node contributors.
28716
29167
  //
28717
29168
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -29210,7 +29661,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
29210
29661
  }
29211
29662
  }
29212
29663
 
29213
- },{}],180:[function(require,module,exports){
29664
+ },{}],181:[function(require,module,exports){
29214
29665
 
29215
29666
  var hasOwn = Object.prototype.hasOwnProperty;
29216
29667
  var toString = Object.prototype.toString;
@@ -29234,7 +29685,7 @@ module.exports = function forEach (obj, fn, ctx) {
29234
29685
  };
29235
29686
 
29236
29687
 
29237
- },{}],181:[function(require,module,exports){
29688
+ },{}],182:[function(require,module,exports){
29238
29689
  'use strict';
29239
29690
 
29240
29691
  /* eslint no-invalid-this: 1 */
@@ -29288,14 +29739,14 @@ module.exports = function bind(that) {
29288
29739
  return bound;
29289
29740
  };
29290
29741
 
29291
- },{}],182:[function(require,module,exports){
29742
+ },{}],183:[function(require,module,exports){
29292
29743
  'use strict';
29293
29744
 
29294
29745
  var implementation = require('./implementation');
29295
29746
 
29296
29747
  module.exports = Function.prototype.bind || implementation;
29297
29748
 
29298
- },{"./implementation":181}],183:[function(require,module,exports){
29749
+ },{"./implementation":182}],184:[function(require,module,exports){
29299
29750
  'use strict';
29300
29751
 
29301
29752
  var undefined;
@@ -29627,7 +30078,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
29627
30078
  return value;
29628
30079
  };
29629
30080
 
29630
- },{"function-bind":182,"has":187,"has-symbols":184}],184:[function(require,module,exports){
30081
+ },{"function-bind":183,"has":188,"has-symbols":185}],185:[function(require,module,exports){
29631
30082
  'use strict';
29632
30083
 
29633
30084
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
@@ -29642,7 +30093,7 @@ module.exports = function hasNativeSymbols() {
29642
30093
  return hasSymbolSham();
29643
30094
  };
29644
30095
 
29645
- },{"./shams":185}],185:[function(require,module,exports){
30096
+ },{"./shams":186}],186:[function(require,module,exports){
29646
30097
  'use strict';
29647
30098
 
29648
30099
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -29686,7 +30137,7 @@ module.exports = function hasSymbols() {
29686
30137
  return true;
29687
30138
  };
29688
30139
 
29689
- },{}],186:[function(require,module,exports){
30140
+ },{}],187:[function(require,module,exports){
29690
30141
  'use strict';
29691
30142
 
29692
30143
  var hasSymbols = require('has-symbols/shams');
@@ -29695,14 +30146,14 @@ module.exports = function hasToStringTagShams() {
29695
30146
  return hasSymbols() && !!Symbol.toStringTag;
29696
30147
  };
29697
30148
 
29698
- },{"has-symbols/shams":185}],187:[function(require,module,exports){
30149
+ },{"has-symbols/shams":186}],188:[function(require,module,exports){
29699
30150
  'use strict';
29700
30151
 
29701
30152
  var bind = require('function-bind');
29702
30153
 
29703
30154
  module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
29704
30155
 
29705
- },{"function-bind":182}],188:[function(require,module,exports){
30156
+ },{"function-bind":183}],189:[function(require,module,exports){
29706
30157
  if (typeof Object.create === 'function') {
29707
30158
  // implementation from standard node.js 'util' module
29708
30159
  module.exports = function inherits(ctor, superCtor) {
@@ -29731,7 +30182,7 @@ if (typeof Object.create === 'function') {
29731
30182
  }
29732
30183
  }
29733
30184
 
29734
- },{}],189:[function(require,module,exports){
30185
+ },{}],190:[function(require,module,exports){
29735
30186
  'use strict';
29736
30187
 
29737
30188
  var hasToStringTag = require('has-tostringtag/shams')();
@@ -29766,7 +30217,7 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
29766
30217
 
29767
30218
  module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
29768
30219
 
29769
- },{"call-bind/callBound":176,"has-tostringtag/shams":186}],190:[function(require,module,exports){
30220
+ },{"call-bind/callBound":177,"has-tostringtag/shams":187}],191:[function(require,module,exports){
29770
30221
  'use strict';
29771
30222
 
29772
30223
  var toStr = Object.prototype.toString;
@@ -29806,7 +30257,7 @@ module.exports = function isGeneratorFunction(fn) {
29806
30257
  return getProto(fn) === GeneratorFunction;
29807
30258
  };
29808
30259
 
29809
- },{"has-tostringtag/shams":186}],191:[function(require,module,exports){
30260
+ },{"has-tostringtag/shams":187}],192:[function(require,module,exports){
29810
30261
  (function (global){(function (){
29811
30262
  'use strict';
29812
30263
 
@@ -29870,14 +30321,14 @@ module.exports = function isTypedArray(value) {
29870
30321
  };
29871
30322
 
29872
30323
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
29873
- },{"available-typed-arrays":169,"call-bind/callBound":176,"es-abstract/helpers/getOwnPropertyDescriptor":178,"foreach":180,"has-tostringtag/shams":186}],192:[function(require,module,exports){
30324
+ },{"available-typed-arrays":170,"call-bind/callBound":177,"es-abstract/helpers/getOwnPropertyDescriptor":179,"foreach":181,"has-tostringtag/shams":187}],193:[function(require,module,exports){
29874
30325
  /*
29875
30326
  * Copyright (c) 2012 Mathieu Turcotte
29876
30327
  * Licensed under the MIT license.
29877
30328
  */
29878
30329
 
29879
30330
  module.exports = require('./lib/checks');
29880
- },{"./lib/checks":193}],193:[function(require,module,exports){
30331
+ },{"./lib/checks":194}],194:[function(require,module,exports){
29881
30332
  /*
29882
30333
  * Copyright (c) 2012 Mathieu Turcotte
29883
30334
  * Licensed under the MIT license.
@@ -29973,7 +30424,7 @@ module.exports.checkIsBoolean = typeCheck('boolean');
29973
30424
  module.exports.checkIsFunction = typeCheck('function');
29974
30425
  module.exports.checkIsObject = typeCheck('object');
29975
30426
 
29976
- },{"./errors":194,"util":198}],194:[function(require,module,exports){
30427
+ },{"./errors":195,"util":199}],195:[function(require,module,exports){
29977
30428
  /*
29978
30429
  * Copyright (c) 2012 Mathieu Turcotte
29979
30430
  * Licensed under the MIT license.
@@ -29999,7 +30450,7 @@ IllegalStateError.prototype.name = 'IllegalStateError';
29999
30450
 
30000
30451
  module.exports.IllegalStateError = IllegalStateError;
30001
30452
  module.exports.IllegalArgumentError = IllegalArgumentError;
30002
- },{"util":198}],195:[function(require,module,exports){
30453
+ },{"util":199}],196:[function(require,module,exports){
30003
30454
  // shim for using process in browser
30004
30455
  var process = module.exports = {};
30005
30456
 
@@ -30185,14 +30636,14 @@ process.chdir = function (dir) {
30185
30636
  };
30186
30637
  process.umask = function() { return 0; };
30187
30638
 
30188
- },{}],196:[function(require,module,exports){
30639
+ },{}],197:[function(require,module,exports){
30189
30640
  module.exports = function isBuffer(arg) {
30190
30641
  return arg && typeof arg === 'object'
30191
30642
  && typeof arg.copy === 'function'
30192
30643
  && typeof arg.fill === 'function'
30193
30644
  && typeof arg.readUInt8 === 'function';
30194
30645
  }
30195
- },{}],197:[function(require,module,exports){
30646
+ },{}],198:[function(require,module,exports){
30196
30647
  // Currently in sync with Node.js lib/internal/util/types.js
30197
30648
  // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
30198
30649
 
@@ -30528,7 +30979,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer;
30528
30979
  });
30529
30980
  });
30530
30981
 
30531
- },{"is-arguments":189,"is-generator-function":190,"is-typed-array":191,"which-typed-array":199}],198:[function(require,module,exports){
30982
+ },{"is-arguments":190,"is-generator-function":191,"is-typed-array":192,"which-typed-array":200}],199:[function(require,module,exports){
30532
30983
  (function (process){(function (){
30533
30984
  // Copyright Joyent, Inc. and other Node contributors.
30534
30985
  //
@@ -31247,7 +31698,7 @@ function callbackify(original) {
31247
31698
  exports.callbackify = callbackify;
31248
31699
 
31249
31700
  }).call(this)}).call(this,require('_process'))
31250
- },{"./support/isBuffer":196,"./support/types":197,"_process":195,"inherits":188}],199:[function(require,module,exports){
31701
+ },{"./support/isBuffer":197,"./support/types":198,"_process":196,"inherits":189}],200:[function(require,module,exports){
31251
31702
  (function (global){(function (){
31252
31703
  'use strict';
31253
31704
 
@@ -31306,12 +31757,12 @@ module.exports = function whichTypedArray(value) {
31306
31757
  };
31307
31758
 
31308
31759
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
31309
- },{"available-typed-arrays":169,"call-bind/callBound":176,"es-abstract/helpers/getOwnPropertyDescriptor":178,"foreach":180,"has-tostringtag/shams":186,"is-typed-array":191}],200:[function(require,module,exports){
31760
+ },{"available-typed-arrays":170,"call-bind/callBound":177,"es-abstract/helpers/getOwnPropertyDescriptor":179,"foreach":181,"has-tostringtag/shams":187,"is-typed-array":192}],201:[function(require,module,exports){
31310
31761
  module.exports={
31311
31762
  "name": "twilio-video",
31312
31763
  "title": "Twilio Video",
31313
31764
  "description": "Twilio Video JavaScript Library",
31314
- "version": "2.18.3",
31765
+ "version": "2.19.0",
31315
31766
  "homepage": "https://twilio.com",
31316
31767
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
31317
31768
  "contributors": [
@@ -31466,7 +31917,7 @@ module.exports={
31466
31917
  }
31467
31918
  }
31468
31919
 
31469
- },{}],201:[function(require,module,exports){
31920
+ },{}],202:[function(require,module,exports){
31470
31921
  module.exports = WebSocket;
31471
31922
 
31472
31923
  },{}]},{},[11]);