twilio-video 2.18.0 → 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 (89) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/COMMON_ISSUES.md +108 -1
  3. package/LICENSE.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/twilio-video.js +975 -436
  6. package/dist/twilio-video.min.js +23 -22
  7. package/es5/connect.js +37 -5
  8. package/es5/connect.js.map +1 -1
  9. package/es5/encodingparameters.js +5 -1
  10. package/es5/encodingparameters.js.map +1 -1
  11. package/es5/localparticipant.js +4 -0
  12. package/es5/localparticipant.js.map +1 -1
  13. package/es5/media/track/localmediatrack.js +2 -0
  14. package/es5/media/track/localmediatrack.js.map +1 -1
  15. package/es5/media/track/remotevideotrack.js +68 -14
  16. package/es5/media/track/remotevideotrack.js.map +1 -1
  17. package/es5/media/track/sender.js +50 -2
  18. package/es5/media/track/sender.js.map +1 -1
  19. package/es5/preflight/getCombinedConnectionStats.js +0 -1
  20. package/es5/preflight/getCombinedConnectionStats.js.map +1 -1
  21. package/es5/preflight/getturncredentials.js +2 -16
  22. package/es5/preflight/getturncredentials.js.map +1 -1
  23. package/es5/preflight/makestat.js +1 -1
  24. package/es5/preflight/makestat.js.map +1 -1
  25. package/es5/preflight/preflighttest.js +83 -11
  26. package/es5/preflight/preflighttest.js.map +1 -1
  27. package/es5/signaling/v2/cancelableroomsignalingpromise.js +4 -9
  28. package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
  29. package/es5/signaling/v2/localparticipant.js +35 -1
  30. package/es5/signaling/v2/localparticipant.js.map +1 -1
  31. package/es5/signaling/v2/mediasignaling.js +2 -4
  32. package/es5/signaling/v2/mediasignaling.js.map +1 -1
  33. package/es5/signaling/v2/peerconnection.js +228 -48
  34. package/es5/signaling/v2/peerconnection.js.map +1 -1
  35. package/es5/signaling/v2/peerconnectionmanager.js +8 -0
  36. package/es5/signaling/v2/peerconnectionmanager.js.map +1 -1
  37. package/es5/signaling/v2/publisherhintsignaling.js +85 -0
  38. package/es5/signaling/v2/publisherhintsignaling.js.map +1 -0
  39. package/es5/signaling/v2/renderhintssignaling.js +28 -17
  40. package/es5/signaling/v2/renderhintssignaling.js.map +1 -1
  41. package/es5/signaling/v2/room.js +33 -1
  42. package/es5/signaling/v2/room.js.map +1 -1
  43. package/es5/signaling/v2/twilioconnectiontransport.js +7 -28
  44. package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
  45. package/es5/util/cancelablepromise.js +11 -0
  46. package/es5/util/cancelablepromise.js.map +1 -1
  47. package/es5/util/constants.js +3 -0
  48. package/es5/util/constants.js.map +1 -1
  49. package/es5/util/eventobserver.js +9 -19
  50. package/es5/util/eventobserver.js.map +1 -1
  51. package/es5/util/index.js +24 -6
  52. package/es5/util/index.js.map +1 -1
  53. package/es5/util/sdp/index.js +7 -3
  54. package/es5/util/sdp/index.js.map +1 -1
  55. package/es5/util/sdp/simulcast.js.map +1 -1
  56. package/es5/util/sid.js +18 -0
  57. package/es5/util/sid.js.map +1 -0
  58. package/lib/connect.js +50 -5
  59. package/lib/encodingparameters.js +5 -1
  60. package/lib/localparticipant.js +5 -0
  61. package/lib/media/track/localmediatrack.js +2 -0
  62. package/lib/media/track/remotevideotrack.js +74 -14
  63. package/lib/media/track/sender.js +36 -2
  64. package/lib/preflight/getCombinedConnectionStats.ts +0 -1
  65. package/lib/preflight/getturncredentials.ts +2 -12
  66. package/lib/preflight/makestat.ts +2 -2
  67. package/lib/preflight/preflighttest.ts +107 -13
  68. package/lib/signaling/v2/cancelableroomsignalingpromise.js +3 -12
  69. package/lib/signaling/v2/localparticipant.js +41 -1
  70. package/lib/signaling/v2/mediasignaling.js +2 -5
  71. package/lib/signaling/v2/peerconnection.js +227 -50
  72. package/lib/signaling/v2/peerconnectionmanager.js +9 -0
  73. package/lib/signaling/v2/publisherhintsignaling.js +71 -0
  74. package/lib/signaling/v2/renderhintssignaling.js +28 -17
  75. package/lib/signaling/v2/room.js +37 -1
  76. package/lib/signaling/v2/twilioconnectiontransport.js +5 -31
  77. package/lib/util/cancelablepromise.js +12 -0
  78. package/lib/util/constants.js +3 -0
  79. package/lib/util/eventobserver.js +10 -22
  80. package/lib/util/index.js +24 -6
  81. package/lib/util/sdp/index.js +6 -3
  82. package/lib/util/sdp/simulcast.js +0 -1
  83. package/lib/util/sid.js +20 -0
  84. package/package.json +5 -4
  85. package/tsconfig.json +1 -1
  86. package/tsdef/PreflightTypes.d.ts +1 -2
  87. package/tsdef/index.d.ts +2 -2
  88. package/tsdef/twilio-video-tests.ts +19 -0
  89. package/tsdef/types.d.ts +5 -1
@@ -1,9 +1,9 @@
1
- /*! twilio-video.js 2.18.0
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;
@@ -91,12 +91,14 @@ var createCancelableRoomPromise = require('./cancelableroompromise');
91
91
  var createLocalTracks = require('./createlocaltracks');
92
92
  var EncodingParametersImpl = require('./encodingparameters');
93
93
  var LocalParticipant = require('./localparticipant');
94
+ var InsightsPublisher = require('./util/insightspublisher');
95
+ var NullInsightsPublisher = require('./util/insightspublisher/null');
94
96
  var _b = require('./media/track/es5'), LocalAudioTrack = _b.LocalAudioTrack, LocalDataTrack = _b.LocalDataTrack, LocalVideoTrack = _b.LocalVideoTrack;
95
97
  var NetworkQualityConfigurationImpl = require('./networkqualityconfiguration');
96
98
  var Room = require('./room');
97
99
  var SignalingV2 = require('./signaling/v2');
98
100
  var _c = require('./util'), asLocalTrack = _c.asLocalTrack, buildLogLevels = _c.buildLogLevels, filterObject = _c.filterObject, isNonArrayObject = _c.isNonArrayObject;
99
- var _d = require('./util/constants'), DEFAULT_ENVIRONMENT = _d.DEFAULT_ENVIRONMENT, DEFAULT_LOG_LEVEL = _d.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _d.DEFAULT_LOGGER_NAME, DEFAULT_REALM = _d.DEFAULT_REALM, DEFAULT_REGION = _d.DEFAULT_REGION, WS_SERVER = _d.WS_SERVER, E = _d.typeErrors;
101
+ var _d = require('./util/constants'), DEFAULT_ENVIRONMENT = _d.DEFAULT_ENVIRONMENT, DEFAULT_LOG_LEVEL = _d.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _d.DEFAULT_LOGGER_NAME, DEFAULT_REALM = _d.DEFAULT_REALM, DEFAULT_REGION = _d.DEFAULT_REGION, WS_SERVER = _d.WS_SERVER, SDK_NAME = _d.SDK_NAME, SDK_VERSION = _d.SDK_VERSION, E = _d.typeErrors;
100
102
  var CancelablePromise = require('./util/cancelablepromise');
101
103
  var EventObserver = require('./util/eventobserver');
102
104
  var DefaultLog = require('./util/log');
@@ -270,6 +272,15 @@ function connect(token, options) {
270
272
  // The warning is displayed only for the first call to connect() per browser session.
271
273
  // Additionally, the options that are no longer needed will be removed.
272
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
+ }
273
284
  options = Object.assign({
274
285
  automaticSubscription: true,
275
286
  createLocalTracks: createLocalTracks,
@@ -298,8 +309,14 @@ function connect(token, options) {
298
309
  signaling: SignalingV2
299
310
  }, filterObject(options));
300
311
  /* eslint new-cap:0 */
312
+ var eventPublisherOptions = {};
313
+ if (typeof options.wsServerInsights === 'string') {
314
+ eventPublisherOptions.gateway = options.wsServerInsights;
315
+ }
316
+ var EventPublisher = options.insights ? InsightsPublisher : NullInsightsPublisher;
317
+ var eventPublisher = new EventPublisher(token, SDK_NAME, SDK_VERSION, options.environment, options.realm, eventPublisherOptions);
301
318
  var wsServer = WS_SERVER(options.environment, options.region);
302
- var eventObserver = new EventObserver(Date.now(), log, options.eventListener);
319
+ var eventObserver = new EventObserver(eventPublisher, Date.now(), log, options.eventListener);
303
320
  options = Object.assign({ eventObserver: eventObserver, wsServer: wsServer }, options);
304
321
  options.log = log;
305
322
  // NOTE(mroberts): Print the Safari warning once if the log-level is at least
@@ -386,7 +403,7 @@ function connect(token, options) {
386
403
  var encodingParameters = new EncodingParametersImpl({
387
404
  maxAudioBitrate: options.maxAudioBitrate,
388
405
  maxVideoBitrate: options.maxVideoBitrate
389
- });
406
+ }, adaptiveSimulcast);
390
407
  var preferredCodecs = {
391
408
  audio: options.preferredAudioCodecs.map(normalizeCodecSettings),
392
409
  video: options.preferredVideoCodecs.map(normalizeCodecSettings)
@@ -399,11 +416,14 @@ function connect(token, options) {
399
416
  // 4 - Create the Room and then resolve the CancelablePromise.
400
417
  var cancelableRoomPromise = createCancelableRoomPromise(getLocalTracks.bind(null, options), createLocalParticipant.bind(null, signaling, log, encodingParameters, networkQualityConfiguration, options), createRoomSignaling.bind(null, token, options, signaling, encodingParameters, preferredCodecs), createRoom.bind(null, options));
401
418
  cancelableRoomPromise.then(function (room) {
419
+ eventPublisher.connect(room.sid, room.localParticipant.sid);
402
420
  log.info('Connected to Room:', room.toString());
403
421
  log.info('Room name:', room.name);
404
422
  log.debug('Room:', room);
423
+ room.once('disconnected', function () { return eventPublisher.disconnect(); });
405
424
  return room;
406
425
  }, function (error) {
426
+ eventPublisher.disconnect();
407
427
  if (cancelableRoomPromise._isCanceled) {
408
428
  log.info('Attempt to connect to a Room was canceled');
409
429
  }
@@ -468,6 +488,7 @@ function connect(token, options) {
468
488
  * effect for fixed bitrate codecs; Based on our tests, Chrome, Firefox and Safari
469
489
  * all seem to support an average bitrate range of 20000 bps (20 kbps) to
470
490
  * 8000000 bps (8 mbps) for a 720p VideoTrack
491
+ * This parameter must not be set when when preferredVideoCodecs is set to `auto`.
471
492
  * @property {?string} [name=null] - Set to connect to a {@link Room} by name
472
493
  * @property {boolean|NetworkQualityConfiguration} [networkQuality=false] - Whether to enable the Network
473
494
  * Quality API or not. This only takes effect in Group Rooms. Pass a {@link NetworkQualityConfiguration}
@@ -483,8 +504,11 @@ function connect(token, options) {
483
504
  * for the list of supported signaling regions.
484
505
  * @property {Array<AudioCodec|AudioCodecSettings>} [preferredAudioCodecs=[]] - Preferred audio codecs;
485
506
  * An empty array preserves the current audio codec preference order.
486
- * @property {Array<VideoCodec|VideoCodecSettings>} [preferredVideoCodecs=[]] -
487
- * 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.
488
512
  * preference order. If you want to set a preferred video codec on a Group Room,
489
513
  * you will need to create the Room using the REST API and set the
490
514
  * <code>VideoCodecs</code> property.
@@ -622,6 +646,14 @@ var AudioCodec = {
622
646
  PCMA: 'PCMA',
623
647
  PCMU: 'PCMU'
624
648
  };
649
+ /**
650
+ * Names of the supported VideoEncodingMode.
651
+ * @enum {string}
652
+ */
653
+ // eslint-disable-next-line
654
+ var VideoEncodingMode = {
655
+ Auto: 'auto',
656
+ };
625
657
  /**
626
658
  * Names of the supported video codecs.
627
659
  * @enum {string}
@@ -960,7 +992,7 @@ function normalizeCodecSettings(nameOrSettings) {
960
992
  }
961
993
  module.exports = connect;
962
994
 
963
- },{"./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/log":130,"./util/validate":144,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],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){
964
996
  'use strict';
965
997
  var defaultCreateLocalTracks = require('./createlocaltracks');
966
998
  var _a = require('./util/constants'), DEFAULT_LOG_LEVEL = _a.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _a.DEFAULT_LOGGER_NAME;
@@ -1073,7 +1105,7 @@ module.exports = {
1073
1105
  video: createLocalVideoTrack
1074
1106
  };
1075
1107
 
1076
- },{"./createlocaltracks":4,"./util/constants":120}],4:[function(require,module,exports){
1108
+ },{"./createlocaltracks":4,"./util/constants":121}],4:[function(require,module,exports){
1077
1109
  'use strict';
1078
1110
  var asLocalTrack = require('./util').asLocalTrack;
1079
1111
  var buildLogLevels = require('./util').buildLogLevels;
@@ -1234,7 +1266,7 @@ function createLocalTracks(options) {
1234
1266
  */
1235
1267
  module.exports = createLocalTracks;
1236
1268
 
1237
- },{"./media/track/es5":14,"./util":126,"./util/constants":120,"./util/log":130,"./webaudio/workaround180748":148,"@twilio/webrtc":151}],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){
1238
1270
  'use strict';
1239
1271
  var __extends = (this && this.__extends) || (function () {
1240
1272
  var extendStatics = function (d, b) {
@@ -1433,7 +1465,7 @@ var DataTrackSender = /** @class */ (function (_super) {
1433
1465
  }(DataTrackTransceiver));
1434
1466
  module.exports = DataTrackSender;
1435
1467
 
1436
- },{"../util":126,"./transceiver":7}],7:[function(require,module,exports){
1468
+ },{"../util":127,"./transceiver":7}],7:[function(require,module,exports){
1437
1469
  'use strict';
1438
1470
  var __extends = (this && this.__extends) || (function () {
1439
1471
  var extendStatics = function (d, b) {
@@ -1493,7 +1525,7 @@ var DataTrackTransceiver = /** @class */ (function (_super) {
1493
1525
  }(TrackTransceiver));
1494
1526
  module.exports = DataTrackTransceiver;
1495
1527
 
1496
- },{"../transceiver":115}],8:[function(require,module,exports){
1528
+ },{"../transceiver":116}],8:[function(require,module,exports){
1497
1529
  'use strict';
1498
1530
  var __extends = (this && this.__extends) || (function () {
1499
1531
  var extendStatics = function (d, b) {
@@ -1590,7 +1622,7 @@ var DataTransport = /** @class */ (function (_super) {
1590
1622
  */
1591
1623
  module.exports = DataTransport;
1592
1624
 
1593
- },{"events":178}],9:[function(require,module,exports){
1625
+ },{"events":180}],9:[function(require,module,exports){
1594
1626
  'use strict';
1595
1627
  var __extends = (this && this.__extends) || (function () {
1596
1628
  var extendStatics = function (d, b) {
@@ -1622,8 +1654,9 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
1622
1654
  /**
1623
1655
  * Construct an {@link EncodingParametersImpl}.
1624
1656
  * @param {EncodingParamters} encodingParameters - Initial {@link EncodingParameters}
1657
+ * @param {Boolean} adaptiveSimulcast - true if adaptive simulcast was enabled by connect options.
1625
1658
  */
1626
- function EncodingParametersImpl(encodingParameters) {
1659
+ function EncodingParametersImpl(encodingParameters, adaptiveSimulcast) {
1627
1660
  var _this = _super.call(this) || this;
1628
1661
  encodingParameters = Object.assign({
1629
1662
  maxAudioBitrate: null,
@@ -1637,6 +1670,9 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
1637
1670
  maxVideoBitrate: {
1638
1671
  value: encodingParameters.maxVideoBitrate,
1639
1672
  writable: true
1673
+ },
1674
+ adaptiveSimulcast: {
1675
+ value: adaptiveSimulcast
1640
1676
  }
1641
1677
  });
1642
1678
  return _this;
@@ -1684,13 +1720,13 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
1684
1720
  */
1685
1721
  module.exports = EncodingParametersImpl;
1686
1722
 
1687
- },{"events":178}],10:[function(require,module,exports){
1723
+ },{"events":180}],10:[function(require,module,exports){
1688
1724
  'use strict';
1689
1725
  var EventEmitter = require('events').EventEmitter;
1690
1726
  var hidePrivateAndCertainPublicPropertiesInClass = require('./util').hidePrivateAndCertainPublicPropertiesInClass;
1691
1727
  module.exports = hidePrivateAndCertainPublicPropertiesInClass(EventEmitter, ['domain']);
1692
1728
 
1693
- },{"./util":126,"events":178}],11:[function(require,module,exports){
1729
+ },{"./util":127,"events":180}],11:[function(require,module,exports){
1694
1730
  'use strict';
1695
1731
  Object.defineProperty(exports, "__esModule", { value: true });
1696
1732
  var preflighttest_1 = require("./preflight/preflighttest");
@@ -1753,7 +1789,7 @@ module.exports = {
1753
1789
  LocalDataTrack: LocalDataTrack
1754
1790
  };
1755
1791
 
1756
- },{"../package.json":199,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":48,"./util/support":140,"./vendor/loglevel":145}],12:[function(require,module,exports){
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){
1757
1793
  'use strict';
1758
1794
  var __extends = (this && this.__extends) || (function () {
1759
1795
  var extendStatics = function (d, b) {
@@ -2255,6 +2291,10 @@ var LocalParticipant = /** @class */ (function (_super) {
2255
2291
  throw E.INVALID_TYPE('encodingParameters', 'EncodingParameters, null or undefined');
2256
2292
  }
2257
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
+ }
2258
2298
  ['maxAudioBitrate', 'maxVideoBitrate'].forEach(function (prop) {
2259
2299
  if (typeof encodingParameters[prop] !== 'undefined'
2260
2300
  && typeof encodingParameters[prop] !== 'number'
@@ -2428,7 +2468,7 @@ function getTrackPublication(trackPublications, track) {
2428
2468
  }
2429
2469
  module.exports = LocalParticipant;
2430
2470
 
2431
- },{"./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":144,"@twilio/webrtc":151}],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){
2432
2472
  'use strict';
2433
2473
  var __extends = (this && this.__extends) || (function () {
2434
2474
  var extendStatics = function (d, b) {
@@ -2617,7 +2657,7 @@ function LocalAudioTrack(mediaStreamTrack, options) {
2617
2657
  inherits(LocalAudioTrack, LocalAudioTrackClass);
2618
2658
  module.exports = LocalAudioTrack;
2619
2659
 
2620
- },{"../localaudiotrack":19,"util":197}],16:[function(require,module,exports){
2660
+ },{"../localaudiotrack":19,"util":199}],16:[function(require,module,exports){
2621
2661
  // eslint-disable-next-line no-warning-comments
2622
2662
  // TODO(mroberts): Remove this when we go to the next major version. This is
2623
2663
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2632,7 +2672,7 @@ function LocalDataTrack(options) {
2632
2672
  inherits(LocalDataTrack, LocalDataTrackClass);
2633
2673
  module.exports = LocalDataTrack;
2634
2674
 
2635
- },{"../localdatatrack":21,"util":197}],17:[function(require,module,exports){
2675
+ },{"../localdatatrack":21,"util":199}],17:[function(require,module,exports){
2636
2676
  // eslint-disable-next-line no-warning-comments
2637
2677
  // TODO(mroberts): Remove this when we go to the next major version. This is
2638
2678
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2647,7 +2687,7 @@ function LocalVideoTrack(mediaStreamTrack, options) {
2647
2687
  inherits(LocalVideoTrack, LocalVideoTrackClass);
2648
2688
  module.exports = LocalVideoTrack;
2649
2689
 
2650
- },{"../localvideotrack":25,"util":197}],18:[function(require,module,exports){
2690
+ },{"../localvideotrack":25,"util":199}],18:[function(require,module,exports){
2651
2691
  'use strict';
2652
2692
  var __extends = (this && this.__extends) || (function () {
2653
2693
  var extendStatics = function (d, b) {
@@ -2759,7 +2799,7 @@ var Track = /** @class */ (function (_super) {
2759
2799
  */
2760
2800
  module.exports = Track;
2761
2801
 
2762
- },{"../../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){
2763
2803
  'use strict';
2764
2804
  var __extends = (this && this.__extends) || (function () {
2765
2805
  var extendStatics = function (d, b) {
@@ -3458,6 +3498,8 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3458
3498
  // after the MediaStreamTrack is re-acquired.
3459
3499
  var promise = (trackChangeInProgress && trackChangeInProgress.promise) || Promise.resolve();
3460
3500
  return promise.finally(function () { return localMediaRestartDeferreds.resolveDeferred(kind); });
3501
+ }).catch(function (ex) {
3502
+ log.error("error in maybeRestart: " + ex.message);
3461
3503
  });
3462
3504
  }
3463
3505
  function onMute() {
@@ -3500,7 +3542,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3500
3542
  }
3501
3543
  module.exports = mixinLocalMediaTrack;
3502
3544
 
3503
- },{"../../util":126,"../../util/constants":120,"../../util/detectsilentaudio":121,"../../util/detectsilentvideo":122,"../../util/documentvisibilitymonitor.js":123,"../../util/localmediarestartdeferreds":129,"../../webaudio/workaround180748":148,"./sender":37,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],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){
3504
3546
  /* eslint new-cap:0 */
3505
3547
  'use strict';
3506
3548
  var __extends = (this && this.__extends) || (function () {
@@ -3614,7 +3656,7 @@ var LocalTrackPublication = /** @class */ (function (_super) {
3614
3656
  }(TrackPublication));
3615
3657
  module.exports = LocalTrackPublication;
3616
3658
 
3617
- },{"../../util/constants":120,"./trackpublication":38}],25:[function(require,module,exports){
3659
+ },{"../../util/constants":121,"./trackpublication":38}],25:[function(require,module,exports){
3618
3660
  'use strict';
3619
3661
  var __extends = (this && this.__extends) || (function () {
3620
3662
  var extendStatics = function (d, b) {
@@ -3961,7 +4003,7 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
3961
4003
  */
3962
4004
  module.exports = LocalVideoTrack;
3963
4005
 
3964
- },{"../../util":126,"../../util/detectsilentvideo":122,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":164}],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){
3965
4007
  'use strict';
3966
4008
  var __extends = (this && this.__extends) || (function () {
3967
4009
  var extendStatics = function (d, b) {
@@ -4371,7 +4413,7 @@ function shimMediaElement(el, onUnintentionallyPaused) {
4371
4413
  }
4372
4414
  module.exports = MediaTrack;
4373
4415
 
4374
- },{"../../util":126,"../../util/localmediarestartdeferreds":129,"./":18,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],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){
4375
4417
  'use strict';
4376
4418
  var __extends = (this && this.__extends) || (function () {
4377
4419
  var extendStatics = function (d, b) {
@@ -4763,7 +4805,7 @@ var RemoteDataTrack = /** @class */ (function (_super) {
4763
4805
  */
4764
4806
  module.exports = RemoteDataTrack;
4765
4807
 
4766
- },{"../../util/constants":120,"./":18}],32:[function(require,module,exports){
4808
+ },{"../../util/constants":121,"./":18}],32:[function(require,module,exports){
4767
4809
  'use strict';
4768
4810
  var __extends = (this && this.__extends) || (function () {
4769
4811
  var extendStatics = function (d, b) {
@@ -5111,7 +5153,7 @@ function playIfPausedWhileInBackground(remoteMediaTrack) {
5111
5153
  */
5112
5154
  module.exports = mixinRemoteMediaTrack;
5113
5155
 
5114
- },{"../../util/constants":120,"../../util/documentvisibilitymonitor.js":123,"@twilio/webrtc/lib/util":164}],34:[function(require,module,exports){
5156
+ },{"../../util/constants":121,"../../util/documentvisibilitymonitor.js":124,"@twilio/webrtc/lib/util":166}],34:[function(require,module,exports){
5115
5157
  'use strict';
5116
5158
  var __extends = (this && this.__extends) || (function () {
5117
5159
  var extendStatics = function (d, b) {
@@ -5403,6 +5445,12 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5403
5445
  _invisibleElements: {
5404
5446
  value: new WeakSet(),
5405
5447
  },
5448
+ _elToPipCallbacks: {
5449
+ value: new WeakMap(),
5450
+ },
5451
+ _elToPipWindows: {
5452
+ value: new WeakMap(),
5453
+ },
5406
5454
  _turnOffTimer: {
5407
5455
  value: new Timeout(function () {
5408
5456
  _this._setRenderHint({ enabled: false });
@@ -5496,6 +5544,45 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5496
5544
  }
5497
5545
  return this;
5498
5546
  };
5547
+ RemoteVideoTrack.prototype._unObservePip = function (el) {
5548
+ var pipCallbacks = this._elToPipCallbacks.get(el);
5549
+ if (pipCallbacks) {
5550
+ el.removeEventListener('enterpictureinpicture', pipCallbacks.onEnterPip);
5551
+ el.removeEventListener('leavepictureinpicture', pipCallbacks.onLeavePip);
5552
+ this._elToPipCallbacks.delete(el);
5553
+ }
5554
+ };
5555
+ RemoteVideoTrack.prototype._observePip = function (el) {
5556
+ var _this = this;
5557
+ var pipCallbacks = this._elToPipCallbacks.get(el);
5558
+ if (!pipCallbacks) {
5559
+ var onEnterPip = function (event) { return _this._onEnterPip(event, el); };
5560
+ var onLeavePip = function (event) { return _this._onLeavePip(event, el); };
5561
+ var onResizePip = function (event) { return _this._onResizePip(event, el); };
5562
+ el.addEventListener('enterpictureinpicture', onEnterPip);
5563
+ el.addEventListener('leavepictureinpicture', onLeavePip);
5564
+ this._elToPipCallbacks.set(el, { onEnterPip: onEnterPip, onLeavePip: onLeavePip, onResizePip: onResizePip });
5565
+ }
5566
+ };
5567
+ RemoteVideoTrack.prototype._onEnterPip = function (event, videoEl) {
5568
+ this._log.debug('onEnterPip');
5569
+ var pipWindow = event.pictureInPictureWindow;
5570
+ this._elToPipWindows.set(videoEl, pipWindow);
5571
+ var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;
5572
+ pipWindow.addEventListener('resize', onResizePip);
5573
+ maybeUpdateEnabledHint(this);
5574
+ };
5575
+ RemoteVideoTrack.prototype._onLeavePip = function (event, videoEl) {
5576
+ this._log.debug('onLeavePip');
5577
+ this._elToPipWindows.delete(videoEl);
5578
+ var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;
5579
+ var pipWindow = event.pictureInPictureWindow;
5580
+ pipWindow.removeEventListener('resize', onResizePip);
5581
+ maybeUpdateEnabledHint(this);
5582
+ };
5583
+ RemoteVideoTrack.prototype._onResizePip = function () {
5584
+ maybeUpdateDimensionHint(this);
5585
+ };
5499
5586
  RemoteVideoTrack.prototype.attach = function (el) {
5500
5587
  var result = _super.prototype.attach.call(this, el);
5501
5588
  if (this._clientTrackSwitchOffControl === 'auto') {
@@ -5508,6 +5595,7 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5508
5595
  if (this._enableDocumentVisibilityTurnOff) {
5509
5596
  this._documentVisibilityTurnOffCleanup = this._documentVisibilityTurnOffCleanup || setupDocumentVisibilityTurnOff(this);
5510
5597
  }
5598
+ this._observePip(result);
5511
5599
  return result;
5512
5600
  };
5513
5601
  RemoteVideoTrack.prototype.detach = function (el) {
@@ -5518,6 +5606,7 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5518
5606
  _this._intersectionObserver.unobserve(element);
5519
5607
  _this._resizeObserver.unobserve(element);
5520
5608
  _this._invisibleElements.delete(element);
5609
+ _this._unObservePip(element);
5521
5610
  });
5522
5611
  if (this._attachments.size === 0) {
5523
5612
  if (this._documentVisibilityTurnOffCleanup) {
@@ -5616,32 +5705,39 @@ function setupDocumentVisibilityTurnOff(removeVideoTrack) {
5616
5705
  documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChanged);
5617
5706
  };
5618
5707
  }
5619
- function maybeUpdateEnabledHint(removeVideoTrack) {
5620
- if (removeVideoTrack._clientTrackSwitchOffControl !== 'auto') {
5708
+ function maybeUpdateEnabledHint(remoteVideoTrack) {
5709
+ if (remoteVideoTrack._clientTrackSwitchOffControl !== 'auto') {
5621
5710
  return;
5622
5711
  }
5623
- var visibleElements = removeVideoTrack._getAllAttachedElements().filter(function (el) { return !removeVideoTrack._invisibleElements.has(el); });
5624
- var enabled = document.visibilityState === 'visible' && visibleElements.length > 0;
5712
+ var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });
5713
+ var pipWindows = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return remoteVideoTrack._elToPipWindows.has(el); });
5714
+ // even when document is invisible we may have track playing in pip window.
5715
+ var enabled = pipWindows.length > 0 || (document.visibilityState === 'visible' && visibleElements.length > 0);
5625
5716
  if (enabled === true) {
5626
- removeVideoTrack._turnOffTimer.clear();
5627
- removeVideoTrack._setRenderHint({ enabled: true });
5717
+ remoteVideoTrack._turnOffTimer.clear();
5718
+ remoteVideoTrack._setRenderHint({ enabled: true });
5628
5719
  }
5629
- else if (!removeVideoTrack._turnOffTimer.isSet) {
5720
+ else if (!remoteVideoTrack._turnOffTimer.isSet) {
5630
5721
  // set the track to be turned off after some delay.
5631
- removeVideoTrack._turnOffTimer.start();
5722
+ remoteVideoTrack._turnOffTimer.start();
5632
5723
  }
5633
5724
  }
5634
- function maybeUpdateDimensionHint(removeVideoTrack) {
5635
- if (removeVideoTrack._contentPreferencesMode !== 'auto') {
5725
+ function maybeUpdateDimensionHint(remoteVideoTrack) {
5726
+ if (remoteVideoTrack._contentPreferencesMode !== 'auto') {
5636
5727
  return;
5637
5728
  }
5638
- var visibleElements = removeVideoTrack._getAllAttachedElements().filter(function (el) { return !removeVideoTrack._invisibleElements.has(el); });
5639
- if (visibleElements.length > 0) {
5640
- var _a = __read(visibleElements.sort(function (el1, el2) {
5729
+ var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });
5730
+ var pipElements = remoteVideoTrack._getAllAttachedElements().map(function (el) {
5731
+ var pipWindow = remoteVideoTrack._elToPipWindows.get(el);
5732
+ return pipWindow ? { clientHeight: pipWindow.height, clientWidth: pipWindow.width } : { clientHeight: 0, clientWidth: 0 };
5733
+ });
5734
+ var totalElements = visibleElements.concat(pipElements);
5735
+ if (totalElements.length > 0) {
5736
+ var _a = __read(totalElements.sort(function (el1, el2) {
5641
5737
  return el2.clientHeight + el2.clientWidth - el1.clientHeight - el1.clientWidth - 1;
5642
5738
  }), 1), _b = _a[0], clientHeight = _b.clientHeight, clientWidth = _b.clientWidth;
5643
5739
  var renderDimensions = { height: clientHeight, width: clientWidth };
5644
- removeVideoTrack._setRenderHint({ renderDimensions: renderDimensions });
5740
+ remoteVideoTrack._setRenderHint({ renderDimensions: renderDimensions });
5645
5741
  }
5646
5742
  }
5647
5743
  /**
@@ -5686,7 +5782,7 @@ function maybeUpdateDimensionHint(removeVideoTrack) {
5686
5782
  */
5687
5783
  module.exports = RemoteVideoTrack;
5688
5784
 
5689
- },{"../../util/documentvisibilitymonitor.js":123,"../../util/nullobserver.js":133,"../../util/timeout":141,"./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){
5690
5786
  'use strict';
5691
5787
  var __extends = (this && this.__extends) || (function () {
5692
5788
  var extendStatics = function (d, b) {
@@ -5775,10 +5871,27 @@ var __extends = (this && this.__extends) || (function () {
5775
5871
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5776
5872
  };
5777
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
+ };
5778
5890
  var MediaTrackTransceiver = require('./transceiver');
5779
5891
  /**
5780
5892
  * A {@link MediaTrackSender} represents one or more local RTCRtpSenders.
5781
5893
  * @extends MediaTrackTransceiver
5894
+ * @emits MediaTrackSender#replaced
5782
5895
  */
5783
5896
  var MediaTrackSender = /** @class */ (function (_super) {
5784
5897
  __extends(MediaTrackSender, _super);
@@ -5795,6 +5908,9 @@ var MediaTrackSender = /** @class */ (function (_super) {
5795
5908
  _senders: {
5796
5909
  value: new Set()
5797
5910
  },
5911
+ _senderToPublisherHintCallbacks: {
5912
+ value: new Map()
5913
+ },
5798
5914
  isPublishing: {
5799
5915
  get: function () {
5800
5916
  return !!this._clones.size;
@@ -5832,7 +5948,7 @@ var MediaTrackSender = /** @class */ (function (_super) {
5832
5948
  return Promise.all(clones.map(function (clone) {
5833
5949
  return clone.setMediaStreamTrack(mediaStreamTrack.clone());
5834
5950
  }).concat(senders.map(function (sender) {
5835
- return sender.replaceTrack(mediaStreamTrack);
5951
+ return _this._replaceTrack(sender, mediaStreamTrack);
5836
5952
  }))).finally(function () {
5837
5953
  _this._track = mediaStreamTrack;
5838
5954
  });
@@ -5840,10 +5956,14 @@ var MediaTrackSender = /** @class */ (function (_super) {
5840
5956
  /**
5841
5957
  * Add an RTCRtpSender.
5842
5958
  * @param {RTCRtpSender} sender
5959
+ * @param {?()=>Promise<string>} publisherHintCallback
5843
5960
  * @returns {this}
5844
5961
  */
5845
- MediaTrackSender.prototype.addSender = function (sender) {
5962
+ MediaTrackSender.prototype.addSender = function (sender, publisherHintCallback) {
5846
5963
  this._senders.add(sender);
5964
+ if (publisherHintCallback) {
5965
+ this._senderToPublisherHintCallbacks.set(sender, publisherHintCallback);
5966
+ }
5847
5967
  return this;
5848
5968
  };
5849
5969
  /**
@@ -5853,10 +5973,34 @@ var MediaTrackSender = /** @class */ (function (_super) {
5853
5973
  */
5854
5974
  MediaTrackSender.prototype.removeSender = function (sender) {
5855
5975
  this._senders.delete(sender);
5976
+ this._senderToPublisherHintCallbacks.delete(sender);
5856
5977
  return this;
5857
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
+ };
5858
5998
  return MediaTrackSender;
5859
5999
  }(MediaTrackTransceiver));
6000
+ /**
6001
+ * The {@link MediaTrackSender} replaced the underlying mediaStreamTrack
6002
+ * @event MediaTrackSender#replaced
6003
+ */
5860
6004
  module.exports = MediaTrackSender;
5861
6005
 
5862
6006
  },{"./transceiver":39}],38:[function(require,module,exports){
@@ -5956,7 +6100,7 @@ var TrackPublication = /** @class */ (function (_super) {
5956
6100
  */
5957
6101
  module.exports = TrackPublication;
5958
6102
 
5959
- },{"../../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){
5960
6104
  'use strict';
5961
6105
  var __extends = (this && this.__extends) || (function () {
5962
6106
  var extendStatics = function (d, b) {
@@ -6023,7 +6167,7 @@ var MediaTrackTransceiver = /** @class */ (function (_super) {
6023
6167
  }(TrackTransceiver));
6024
6168
  module.exports = MediaTrackTransceiver;
6025
6169
 
6026
- },{"../../transceiver":115}],40:[function(require,module,exports){
6170
+ },{"../../transceiver":116}],40:[function(require,module,exports){
6027
6171
  'use strict';
6028
6172
  var __extends = (this && this.__extends) || (function () {
6029
6173
  var extendStatics = function (d, b) {
@@ -6178,7 +6322,7 @@ var VideoProcessorEventObserver = /** @class */ (function (_super) {
6178
6322
  }(EventEmitter));
6179
6323
  module.exports = VideoProcessorEventObserver;
6180
6324
 
6181
- },{"../../util/constants":120,"events":178}],41:[function(require,module,exports){
6325
+ },{"../../util/constants":121,"events":180}],41:[function(require,module,exports){
6182
6326
  'use strict';
6183
6327
  var __extends = (this && this.__extends) || (function () {
6184
6328
  var extendStatics = function (d, b) {
@@ -6692,7 +6836,7 @@ function dimensionsChanged(track, elem) {
6692
6836
  */
6693
6837
  module.exports = VideoTrack;
6694
6838
 
6695
- },{"../../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){
6696
6840
  'use strict';
6697
6841
  var __extends = (this && this.__extends) || (function () {
6698
6842
  var extendStatics = function (d, b) {
@@ -6791,7 +6935,7 @@ var NetworkQualityConfigurationImpl = /** @class */ (function (_super) {
6791
6935
  }(EventEmitter));
6792
6936
  module.exports = NetworkQualityConfigurationImpl;
6793
6937
 
6794
- },{"./util":126,"./util/constants":120,"events":178}],43:[function(require,module,exports){
6938
+ },{"./util":127,"./util/constants":121,"events":180}],43:[function(require,module,exports){
6795
6939
  'use strict';
6796
6940
  var __extends = (this && this.__extends) || (function () {
6797
6941
  var extendStatics = function (d, b) {
@@ -7408,7 +7552,7 @@ function reemitTrackPublicationEvents(participant, publication) {
7408
7552
  }
7409
7553
  module.exports = Participant;
7410
7554
 
7411
- },{"./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){
7412
7556
  "use strict";
7413
7557
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7414
7558
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -7516,7 +7660,6 @@ function makeStandardCandidateStats(input) {
7516
7660
  { key: 'priority', type: 'number' },
7517
7661
  { key: 'protocol', altKeys: ['transport'], type: 'string' },
7518
7662
  { key: 'url', type: 'string' },
7519
- { key: 'deleted', type: 'boolean' },
7520
7663
  { key: 'relayProtocol', type: 'string' },
7521
7664
  ];
7522
7665
  return standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {
@@ -7565,27 +7708,13 @@ function extractSelectedActiveCandidatePair(stats) {
7565
7708
 
7566
7709
  },{}],45:[function(require,module,exports){
7567
7710
  "use strict";
7568
- var __assign = (this && this.__assign) || function () {
7569
- __assign = Object.assign || function(t) {
7570
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7571
- s = arguments[i];
7572
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7573
- t[p] = s[p];
7574
- }
7575
- return t;
7576
- };
7577
- return __assign.apply(this, arguments);
7578
- };
7579
7711
  Object.defineProperty(exports, "__esModule", { value: true });
7580
7712
  exports.getTurnCredentials = void 0;
7581
7713
  var TwilioConnection = require('../twilioconnection.js');
7582
- var _a = require('../util/constants'), WS_SERVER = _a.WS_SERVER, ICE_VERSION = _a.ICE_VERSION;
7714
+ var ICE_VERSION = require('../util/constants').ICE_VERSION;
7583
7715
  var events_1 = require("events");
7584
- function getTurnCredentials(token, options) {
7716
+ function getTurnCredentials(token, wsServer) {
7585
7717
  return new Promise(function (resolve, reject) {
7586
- options = __assign({ environment: 'prod', region: 'gll' }, options);
7587
- // eslint-disable-next-line new-cap
7588
- var wsServer = WS_SERVER(options.environment, options.region);
7589
7718
  var eventObserver = new events_1.EventEmitter();
7590
7719
  var connectionOptions = {
7591
7720
  networkMonitor: null,
@@ -7620,7 +7749,7 @@ function getTurnCredentials(token, options) {
7620
7749
  }
7621
7750
  exports.getTurnCredentials = getTurnCredentials;
7622
7751
 
7623
- },{"../twilioconnection.js":116,"../util/constants":120,"events":178}],46:[function(require,module,exports){
7752
+ },{"../twilioconnection.js":117,"../util/constants":121,"events":180}],46:[function(require,module,exports){
7624
7753
  "use strict";
7625
7754
  var __read = (this && this.__read) || function (o, n) {
7626
7755
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -7651,7 +7780,7 @@ exports.makeStat = void 0;
7651
7780
  * @returns {{min: number, max: number: average: number}|null}
7652
7781
  */
7653
7782
  function makeStat(values) {
7654
- if (values.length) {
7783
+ if (values && values.length) {
7655
7784
  var min = Math.min.apply(Math, __spreadArray([], __read(values)));
7656
7785
  var max = Math.max.apply(Math, __spreadArray([], __read(values)));
7657
7786
  var average = values.reduce(function (total, value) { return total + value; }, 0) / values.length;
@@ -7786,9 +7915,13 @@ var makestat_1 = require("./makestat");
7786
7915
  var syntheticaudio_1 = require("./syntheticaudio");
7787
7916
  var syntheticvideo_1 = require("./syntheticvideo");
7788
7917
  var util_1 = require("../util");
7918
+ var WS_SERVER = require('../util/constants').WS_SERVER;
7789
7919
  var Log = require('../util/log');
7790
7920
  var EventEmitter = require('../eventemitter');
7791
7921
  var MovingAverageDelta = require('../util/movingaveragedelta');
7922
+ var EventObserver = require('../util/eventobserver');
7923
+ var InsightsPublisher = require('../util/insightspublisher');
7924
+ var _a = require('../util/sid'), createSID = _a.createSID, sessionSID = _a.sessionSID;
7792
7925
  var SECOND = 1000;
7793
7926
  var DEFAULT_TEST_DURATION = 10 * SECOND;
7794
7927
  /**
@@ -7858,11 +7991,15 @@ var PreflightTest = /** @class */ (function (_super) {
7858
7991
  _this._sentBytesMovingAverage = new MovingAverageDelta();
7859
7992
  _this._packetLossMovingAverage = new MovingAverageDelta();
7860
7993
  _this._receivedBytesMovingAverage = new MovingAverageDelta();
7994
+ var internalOptions = options;
7995
+ var _a = internalOptions.environment, environment = _a === void 0 ? 'prod' : _a, _b = internalOptions.region, region = _b === void 0 ? 'gll' : _b, _c = internalOptions.duration, duration = _c === void 0 ? DEFAULT_TEST_DURATION : _c;
7996
+ // eslint-disable-next-line new-cap
7997
+ var wsServer = internalOptions.wsServer || WS_SERVER(environment, region);
7861
7998
  _this._log = new Log('default', _this, constants_1.DEFAULT_LOG_LEVEL, constants_1.DEFAULT_LOGGER_NAME);
7862
- _this._testDuration = options.duration || DEFAULT_TEST_DURATION;
7999
+ _this._testDuration = duration;
7863
8000
  _this._instanceId = nInstances++;
7864
8001
  _this._testTiming.start();
7865
- _this._runPreflightTest(token, options);
8002
+ _this._runPreflightTest(token, environment, wsServer);
7866
8003
  return _this;
7867
8004
  }
7868
8005
  PreflightTest.prototype.toString = function () {
@@ -7874,7 +8011,7 @@ var PreflightTest = /** @class */ (function (_super) {
7874
8011
  PreflightTest.prototype.stop = function () {
7875
8012
  this._stopped = true;
7876
8013
  };
7877
- PreflightTest.prototype._generatePreflightReport = function (collectedStats) {
8014
+ PreflightTest.prototype._generatePreflightReport = function (collectedStats, error) {
7878
8015
  this._testTiming.stop();
7879
8016
  return {
7880
8017
  testTiming: this._testTiming.getTimeMeasurement(),
@@ -7886,12 +8023,15 @@ var PreflightTest = /** @class */ (function (_super) {
7886
8023
  media: this._mediaTiming.getTimeMeasurement()
7887
8024
  },
7888
8025
  stats: {
7889
- jitter: makestat_1.makeStat(collectedStats.jitter),
7890
- rtt: makestat_1.makeStat(collectedStats.rtt),
7891
- packetLoss: makestat_1.makeStat(collectedStats.packetLoss),
7892
- },
7893
- selectedIceCandidatePairStats: collectedStats.selectedIceCandidatePairStats,
7894
- iceCandidateStats: collectedStats.iceCandidateStats
8026
+ jitter: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.jitter),
8027
+ rtt: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.rtt),
8028
+ packetLoss: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.packetLoss),
8029
+ },
8030
+ selectedIceCandidatePairStats: collectedStats ? collectedStats.selectedIceCandidatePairStats : null,
8031
+ iceCandidateStats: collectedStats ? collectedStats.iceCandidateStats : [],
8032
+ // NOTE(mpatwardhan): internal properties.
8033
+ error: error === null || error === void 0 ? void 0 : error.toString(),
8034
+ mos: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.mos),
7895
8035
  };
7896
8036
  };
7897
8037
  PreflightTest.prototype._executePreflightStep = function (stepName, step) {
@@ -7966,15 +8106,73 @@ var PreflightTest = /** @class */ (function (_super) {
7966
8106
  });
7967
8107
  }
7968
8108
  };
7969
- PreflightTest.prototype._runPreflightTest = function (token, options) {
8109
+ PreflightTest.prototype._setupInsights = function (_a) {
8110
+ var token = _a.token, _b = _a.environment, environment = _b === void 0 ? constants_1.DEFAULT_ENVIRONMENT : _b, _c = _a.realm, realm = _c === void 0 ? constants_1.DEFAULT_REALM : _c;
8111
+ var eventPublisherOptions = {};
8112
+ var eventPublisher = new InsightsPublisher(token, constants_1.SDK_NAME, constants_1.SDK_VERSION, environment, realm, eventPublisherOptions);
8113
+ // event publisher requires room sid/participant sid. supply fake ones.
8114
+ eventPublisher.connect('PREFLIGHT_ROOM_SID', 'PREFLIGHT_PARTICIPANT');
8115
+ var eventObserver = new EventObserver(eventPublisher, Date.now(), this._log);
8116
+ // eslint-disable-next-line no-undefined
8117
+ var undefinedValue = undefined;
8118
+ return {
8119
+ reportToInsights: function (_a) {
8120
+ var _b, _c;
8121
+ var report = _a.report;
8122
+ var jitterStats = report.stats.jitter || undefinedValue;
8123
+ var rttStats = report.stats.rtt || undefinedValue;
8124
+ var packetLossStats = report.stats.packetLoss || undefinedValue;
8125
+ var mosStats = report.mos || undefinedValue;
8126
+ // stringify important info from ice candidates.
8127
+ var candidateTypeToProtocols = new Map();
8128
+ report.iceCandidateStats.forEach(function (candidateStats) {
8129
+ if (candidateStats.candidateType && candidateStats.protocol) {
8130
+ var protocols = candidateTypeToProtocols.get(candidateStats.candidateType) || [];
8131
+ if (protocols.indexOf(candidateStats.protocol) < 0) {
8132
+ protocols.push(candidateStats.protocol);
8133
+ }
8134
+ candidateTypeToProtocols.set(candidateStats.candidateType, protocols);
8135
+ }
8136
+ });
8137
+ var iceCandidateStats = JSON.stringify(Object.fromEntries(candidateTypeToProtocols));
8138
+ var insightsReport = {
8139
+ name: 'report',
8140
+ group: 'preflight',
8141
+ level: report.error ? 'error' : 'info',
8142
+ payload: {
8143
+ sessionSID: sessionSID,
8144
+ preflightSID: createSID('PF'),
8145
+ testTiming: report.testTiming,
8146
+ dtlsTiming: report.networkTiming.dtls,
8147
+ iceTiming: report.networkTiming.ice,
8148
+ peerConnectionTiming: report.networkTiming.peerConnection,
8149
+ connectTiming: report.networkTiming.connect,
8150
+ mediaTiming: report.networkTiming.media,
8151
+ selectedLocalCandidate: (_b = report.selectedIceCandidatePairStats) === null || _b === void 0 ? void 0 : _b.localCandidate,
8152
+ selectedRemoteCandidate: (_c = report.selectedIceCandidatePairStats) === null || _c === void 0 ? void 0 : _c.remoteCandidate,
8153
+ iceCandidateStats: iceCandidateStats,
8154
+ jitterStats: jitterStats,
8155
+ rttStats: rttStats,
8156
+ packetLossStats: packetLossStats,
8157
+ mosStats: mosStats,
8158
+ error: report.error
8159
+ }
8160
+ };
8161
+ eventObserver.emit('event', insightsReport);
8162
+ setTimeout(function () { return eventPublisher.disconnect(); }, 2000);
8163
+ }
8164
+ };
8165
+ };
8166
+ PreflightTest.prototype._runPreflightTest = function (token, environment, wsServer) {
7970
8167
  return __awaiter(this, void 0, void 0, function () {
7971
- var localTracks, pcs, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1;
8168
+ var localTracks, pcs, reportToInsights, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1;
7972
8169
  var _this = this;
7973
8170
  return __generator(this, function (_a) {
7974
8171
  switch (_a.label) {
7975
8172
  case 0:
7976
8173
  localTracks = [];
7977
8174
  pcs = [];
8175
+ reportToInsights = this._setupInsights({ token: token, environment: environment }).reportToInsights;
7978
8176
  _a.label = 1;
7979
8177
  case 1:
7980
8178
  _a.trys.push([1, 8, 9, 10]);
@@ -7985,7 +8183,7 @@ var PreflightTest = /** @class */ (function (_super) {
7985
8183
  this.emit('progress', PreflightProgress.mediaAcquired);
7986
8184
  this.emit('debug', { localTracks: localTracks });
7987
8185
  this._connectTiming.start();
7988
- return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, options); })];
8186
+ return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, wsServer); })];
7989
8187
  case 3:
7990
8188
  iceServers = _a.sent();
7991
8189
  this._connectTiming.stop();
@@ -8068,10 +8266,13 @@ var PreflightTest = /** @class */ (function (_super) {
8068
8266
  return [4 /*yield*/, this._executePreflightStep('generate report', function () { return _this._generatePreflightReport(collectedStats_1); })];
8069
8267
  case 7:
8070
8268
  report = _a.sent();
8269
+ reportToInsights({ report: report });
8071
8270
  this.emit('completed', report);
8072
8271
  return [3 /*break*/, 10];
8073
8272
  case 8:
8074
8273
  error_1 = _a.sent();
8274
+ // eslint-disable-next-line no-undefined
8275
+ reportToInsights({ report: this._generatePreflightReport(undefined, error_1) });
8075
8276
  this.emit('failed', error_1);
8076
8277
  return [3 /*break*/, 10];
8077
8278
  case 9:
@@ -8254,7 +8455,7 @@ function runPreflight(token, options) {
8254
8455
  }
8255
8456
  exports.runPreflight = runPreflight;
8256
8457
 
8257
- },{"../eventemitter":10,"../util":126,"../util/constants":120,"../util/log":130,"../util/movingaveragedelta":131,"./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){
8258
8459
  "use strict";
8259
8460
  Object.defineProperty(exports, "__esModule", { value: true });
8260
8461
  exports.syntheticAudio = void 0;
@@ -8277,7 +8478,7 @@ function syntheticAudio() {
8277
8478
  }
8278
8479
  exports.syntheticAudio = syntheticAudio;
8279
8480
 
8280
- },{"../webaudio/audiocontext":146}],50:[function(require,module,exports){
8481
+ },{"../webaudio/audiocontext":148}],50:[function(require,module,exports){
8281
8482
  "use strict";
8282
8483
  Object.defineProperty(exports, "__esModule", { value: true });
8283
8484
  exports.syntheticVideo = void 0;
@@ -8442,7 +8643,7 @@ var QueueingEventEmitter = /** @class */ (function (_super) {
8442
8643
  }(EventEmitter));
8443
8644
  module.exports = QueueingEventEmitter;
8444
8645
 
8445
- },{"events":178}],53:[function(require,module,exports){
8646
+ },{"events":180}],53:[function(require,module,exports){
8446
8647
  'use strict';
8447
8648
  var __extends = (this && this.__extends) || (function () {
8448
8649
  var extendStatics = function (d, b) {
@@ -9279,7 +9480,7 @@ function handleSignalingEvents(room, signaling) {
9279
9480
  }
9280
9481
  module.exports = Room;
9281
9482
 
9282
- },{"./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){
9283
9484
  /* eslint consistent-return:0 */
9284
9485
  'use strict';
9285
9486
  var __extends = (this && this.__extends) || (function () {
@@ -9449,7 +9650,7 @@ var Signaling = /** @class */ (function (_super) {
9449
9650
  }(StateMachine));
9450
9651
  module.exports = Signaling;
9451
9652
 
9452
- },{"../statemachine":84,"./participant":58,"./room":62}],56:[function(require,module,exports){
9653
+ },{"../statemachine":85,"./participant":58,"./room":62}],56:[function(require,module,exports){
9453
9654
  'use strict';
9454
9655
  var __extends = (this && this.__extends) || (function () {
9455
9656
  var extendStatics = function (d, b) {
@@ -9885,7 +10086,7 @@ var ParticipantSignaling = /** @class */ (function (_super) {
9885
10086
  */
9886
10087
  module.exports = ParticipantSignaling;
9887
10088
 
9888
- },{"../statemachine":84,"../stats/networkqualitystats":99}],59:[function(require,module,exports){
10089
+ },{"../statemachine":85,"../stats/networkqualitystats":100}],59:[function(require,module,exports){
9889
10090
  'use strict';
9890
10091
  var __extends = (this && this.__extends) || (function () {
9891
10092
  var extendStatics = function (d, b) {
@@ -9958,7 +10159,7 @@ var RecordingSignaling = /** @class */ (function (_super) {
9958
10159
  */
9959
10160
  module.exports = RecordingSignaling;
9960
10161
 
9961
- },{"events":178}],60:[function(require,module,exports){
10162
+ },{"events":180}],60:[function(require,module,exports){
9962
10163
  'use strict';
9963
10164
  var __extends = (this && this.__extends) || (function () {
9964
10165
  var extendStatics = function (d, b) {
@@ -10384,7 +10585,7 @@ function maybeUpdateState(roomSignaling) {
10384
10585
  }
10385
10586
  module.exports = RoomSignaling;
10386
10587
 
10387
- },{"../statemachine":84,"../util":126,"../util/constants":120,"../util/log":130,"../util/timeout":141,"../util/twilio-video-errors":142,"./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){
10388
10589
  'use strict';
10389
10590
  var __extends = (this && this.__extends) || (function () {
10390
10591
  var extendStatics = function (d, b) {
@@ -10567,7 +10768,7 @@ var TrackSignaling = /** @class */ (function (_super) {
10567
10768
  */
10568
10769
  module.exports = TrackSignaling;
10569
10770
 
10570
- },{"events":178}],64:[function(require,module,exports){
10771
+ },{"events":180}],64:[function(require,module,exports){
10571
10772
  'use strict';
10572
10773
  var CancelablePromise = require('../../util/cancelablepromise');
10573
10774
  var DefaultPeerConnectionManager = require('./peerconnectionmanager');
@@ -10581,6 +10782,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10581
10782
  RoomV2: DefaultRoomV2,
10582
10783
  Transport: DefaultTransport
10583
10784
  }, options);
10785
+ var adaptiveSimulcast = preferredCodecs.video[0] && preferredCodecs.video[0].adaptiveSimulcast === true;
10584
10786
  var PeerConnectionManager = options.PeerConnectionManager, RoomV2 = options.RoomV2, Transport = options.Transport, iceServers = options.iceServers, log = options.log;
10585
10787
  var peerConnectionManager = new PeerConnectionManager(encodingParameters, preferredCodecs, options);
10586
10788
  var trackSenders = flatMap(localParticipant.tracks, function (trackV2) { return [trackV2.trackTransceiver]; });
@@ -10613,7 +10815,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10613
10815
  throw error;
10614
10816
  });
10615
10817
  };
10616
- var InsightsPublisher = options.InsightsPublisher, NullInsightsPublisher = options.NullInsightsPublisher, automaticSubscription = options.automaticSubscription, bandwidthProfile = options.bandwidthProfile, dominantSpeaker = options.dominantSpeaker, environment = options.environment, eventObserver = options.eventObserver, loggerName = options.loggerName, logLevel = options.logLevel, name = options.name, networkMonitor = options.networkMonitor, networkQuality = options.networkQuality, insights = options.insights, realm = options.realm, sdpSemantics = options.sdpSemantics, wsServerInsights = options.wsServerInsights;
10818
+ var automaticSubscription = options.automaticSubscription, bandwidthProfile = options.bandwidthProfile, dominantSpeaker = options.dominantSpeaker, environment = options.environment, eventObserver = options.eventObserver, loggerName = options.loggerName, logLevel = options.logLevel, name = options.name, networkMonitor = options.networkMonitor, networkQuality = options.networkQuality, realm = options.realm, sdpSemantics = options.sdpSemantics;
10617
10819
  // decide which msp channels to request
10618
10820
  // dominantSpeaker, networkQuality
10619
10821
  var trackPriority = !!bandwidthProfile;
@@ -10621,6 +10823,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10621
10823
  var renderHints = !!bandwidthProfile &&
10622
10824
  (options.clientTrackSwitchOffControl !== 'disabled' || options.contentPreferencesMode !== 'disabled');
10623
10825
  var transportOptions = Object.assign({
10826
+ adaptiveSimulcast: adaptiveSimulcast,
10624
10827
  automaticSubscription: automaticSubscription,
10625
10828
  dominantSpeaker: dominantSpeaker,
10626
10829
  environment: environment,
@@ -10630,20 +10833,13 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10630
10833
  networkMonitor: networkMonitor,
10631
10834
  networkQuality: networkQuality,
10632
10835
  iceServers: iceServers,
10633
- insights: insights,
10634
10836
  onIced: onIced,
10635
10837
  realm: realm,
10636
10838
  renderHints: renderHints,
10637
10839
  sdpSemantics: sdpSemantics,
10638
10840
  trackPriority: trackPriority,
10639
10841
  trackSwitchOff: trackSwitchOff
10640
- }, typeof wsServerInsights === 'string' ? {
10641
- wsServerInsights: wsServerInsights
10642
- } : {}, InsightsPublisher ? {
10643
- InsightsPublisher: InsightsPublisher
10644
- } : {}, NullInsightsPublisher ? {
10645
- NullInsightsPublisher: NullInsightsPublisher
10646
- } : {}, bandwidthProfile ? {
10842
+ }, bandwidthProfile ? {
10647
10843
  bandwidthProfile: bandwidthProfile
10648
10844
  } : {});
10649
10845
  transport = new Transport(name, token, localParticipant, peerConnectionManager, wsServer, transportOptions);
@@ -10690,7 +10886,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10690
10886
  }
10691
10887
  module.exports = createCancelableRoomSignalingPromise;
10692
10888
 
10693
- },{"../../util":126,"../../util/cancelablepromise":119,"../../util/twilio-video-errors":142,"./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){
10694
10890
  'use strict';
10695
10891
  var __extends = (this && this.__extends) || (function () {
10696
10892
  var extendStatics = function (d, b) {
@@ -10836,7 +11032,7 @@ var IceBox = /** @class */ (function () {
10836
11032
  }());
10837
11033
  module.exports = IceBox;
10838
11034
 
10839
- },{"../../util/filter":125}],67:[function(require,module,exports){
11035
+ },{"../../util/filter":126}],67:[function(require,module,exports){
10840
11036
  'use strict';
10841
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;
10842
11038
  /**
@@ -10973,7 +11169,7 @@ var IceConnectionMonitor = /** @class */ (function () {
10973
11169
  }());
10974
11170
  module.exports = IceConnectionMonitor;
10975
11171
 
10976
- },{"../../util/constants":120}],68:[function(require,module,exports){
11172
+ },{"../../util/constants":121}],68:[function(require,module,exports){
10977
11173
  'use strict';
10978
11174
  var __extends = (this && this.__extends) || (function () {
10979
11175
  var extendStatics = function (d, b) {
@@ -11057,7 +11253,9 @@ var __extends = (this && this.__extends) || (function () {
11057
11253
  })();
11058
11254
  var LocalParticipantSignaling = require('../localparticipant');
11059
11255
  var LocalTrackPublicationV2 = require('./localtrackpublication');
11060
- 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;
11061
11259
  /**
11062
11260
  * @extends ParticipantSignaling
11063
11261
  * @property {BandwidthProfileOptions} bandwidthProfile
@@ -11076,9 +11274,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11076
11274
  function LocalParticipantV2(encodingParameters, networkQualityConfiguration, options) {
11077
11275
  var _this = this;
11078
11276
  options = Object.assign({
11277
+ logLevel: DEFAULT_LOG_LEVEL,
11079
11278
  LocalTrackPublicationV2: LocalTrackPublicationV2
11080
11279
  }, options);
11081
11280
  _this = _super.call(this) || this;
11281
+ var logLevels = buildLogLevels(options.logLevel);
11082
11282
  Object.defineProperties(_this, {
11083
11283
  _bandwidthProfile: {
11084
11284
  value: null,
@@ -11097,6 +11297,11 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11097
11297
  _LocalTrackPublicationV2: {
11098
11298
  value: options.LocalTrackPublicationV2
11099
11299
  },
11300
+ _log: {
11301
+ value: options.log
11302
+ ? options.log.createLog('default', _this)
11303
+ : new Log('default', _this, logLevels, options.loggerName)
11304
+ },
11100
11305
  _publishedRevision: {
11101
11306
  writable: true,
11102
11307
  value: 0
@@ -11140,6 +11345,9 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11140
11345
  });
11141
11346
  return _this;
11142
11347
  }
11348
+ LocalParticipantV2.prototype.toString = function () {
11349
+ return "[LocalParticipantSignaling: " + this.sid + "]";
11350
+ };
11143
11351
  /**
11144
11352
  * Set the signalingRegion.
11145
11353
  * @param {string} signalingRegion.
@@ -11163,6 +11371,13 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11163
11371
  this.didUpdate();
11164
11372
  }
11165
11373
  };
11374
+ /**
11375
+ * returns current {@link EncodingParametersImpl}.
11376
+ * @returns {EncodingParametersImpl}
11377
+ */
11378
+ LocalParticipantV2.prototype.getParameters = function () {
11379
+ return this._encodingParameters;
11380
+ };
11166
11381
  /**
11167
11382
  * Set the {@link EncodingParameters}.
11168
11383
  * @param {?EncodingParameters} encodingParameters
@@ -11283,6 +11498,21 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11283
11498
  LocalParticipantV2.prototype.setNetworkQualityConfiguration = function (networkQualityConfiguration) {
11284
11499
  this.networkQualityConfiguration.update(networkQualityConfiguration);
11285
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
+ };
11286
11516
  return LocalParticipantV2;
11287
11517
  }(LocalParticipantSignaling));
11288
11518
  /**
@@ -11320,7 +11550,7 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
11320
11550
  */
11321
11551
  module.exports = LocalParticipantV2;
11322
11552
 
11323
- },{"../../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){
11324
11554
  'use strict';
11325
11555
  var __extends = (this && this.__extends) || (function () {
11326
11556
  var extendStatics = function (d, b) {
@@ -11402,7 +11632,7 @@ var LocalTrackPublicationV2 = /** @class */ (function (_super) {
11402
11632
  */
11403
11633
  module.exports = LocalTrackPublicationV2;
11404
11634
 
11405
- },{"../../util/twilio-video-errors":142,"../localtrackpublication":57}],71:[function(require,module,exports){
11635
+ },{"../../util/twilio-video-errors":144,"../localtrackpublication":57}],71:[function(require,module,exports){
11406
11636
  /* eslint callback-return:0 */
11407
11637
  'use strict';
11408
11638
  var __extends = (this && this.__extends) || (function () {
@@ -11472,19 +11702,17 @@ var MediaSignaling = /** @class */ (function (_super) {
11472
11702
  var receiverPromise = this._getReceiver(id).then(function (receiver) {
11473
11703
  if (receiver.kind !== 'data') {
11474
11704
  _this._log.error('Expected a DataTrackReceiver');
11475
- throw new Error('Expected a DataTrackReceiver');
11476
11705
  }
11477
11706
  if (_this._receiverPromise !== receiverPromise) {
11478
11707
  return;
11479
11708
  }
11480
11709
  try {
11481
11710
  _this._transport = receiver.toDataTransport();
11711
+ _this.emit('ready', _this._transport);
11482
11712
  }
11483
11713
  catch (ex) {
11484
- _this._log.error('Failed to toDataTransport');
11485
- throw new Error('Failed to toDataTransport');
11714
+ _this._log.error("Failed to toDataTransport: " + ex.message);
11486
11715
  }
11487
- _this.emit('ready', _this._transport);
11488
11716
  receiver.once('close', function () { return _this._teardown(); });
11489
11717
  });
11490
11718
  this._receiverPromise = receiverPromise;
@@ -11501,7 +11729,7 @@ var MediaSignaling = /** @class */ (function (_super) {
11501
11729
  }(EventEmitter));
11502
11730
  module.exports = MediaSignaling;
11503
11731
 
11504
- },{"events":178}],72:[function(require,module,exports){
11732
+ },{"events":180}],72:[function(require,module,exports){
11505
11733
  /* eslint callback-return:0 */
11506
11734
  'use strict';
11507
11735
  var __extends = (this && this.__extends) || (function () {
@@ -11660,7 +11888,7 @@ function next(monitor) {
11660
11888
  */
11661
11889
  module.exports = NetworkQualityMonitor;
11662
11890
 
11663
- },{"../../stats/peerconnectionreportfactory":102,"events":178}],73:[function(require,module,exports){
11891
+ },{"../../stats/peerconnectionreportfactory":103,"events":180}],73:[function(require,module,exports){
11664
11892
  'use strict';
11665
11893
  var __extends = (this && this.__extends) || (function () {
11666
11894
  var extendStatics = function (d, b) {
@@ -11906,7 +12134,7 @@ function createNetworkQualityInputsMessage(networkQualityInputs, networkQualityR
11906
12134
  }
11907
12135
  module.exports = NetworkQualitySignaling;
11908
12136
 
11909
- },{"../../util/asyncvar":117,"./mediasignaling":71}],74:[function(require,module,exports){
12137
+ },{"../../util/asyncvar":118,"./mediasignaling":71}],74:[function(require,module,exports){
11910
12138
  'use strict';
11911
12139
  var __extends = (this && this.__extends) || (function () {
11912
12140
  var extendStatics = function (d, b) {
@@ -11946,13 +12174,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
11946
12174
  };
11947
12175
  var DefaultBackoff = require('backoff');
11948
12176
  var _a = require('@twilio/webrtc'), DefaultMediaStream = _a.MediaStream, DefaultRTCIceCandidate = _a.RTCIceCandidate, DefaultRTCPeerConnection = _a.RTCPeerConnection, DefaultRTCSessionDescription = _a.RTCSessionDescription, getStatistics = _a.getStats;
11949
- var guessBrowser = require('@twilio/webrtc/lib/util').guessBrowser;
12177
+ var util = require('@twilio/webrtc/lib/util');
12178
+ var guessBrowser = util.guessBrowser;
11950
12179
  var getSdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat;
11951
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;
11952
- 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;
11953
12182
  var DefaultTimeout = require('../../util/timeout');
11954
12183
  var _d = require('../../util/twilio-video-errors'), MediaClientLocalDescFailedError = _d.MediaClientLocalDescFailedError, MediaClientRemoteDescFailedError = _d.MediaClientRemoteDescFailedError;
11955
- 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;
11956
12185
  var IceBox = require('./icebox');
11957
12186
  var DefaultIceConnectionMonitor = require('./iceconnectionmonitor.js');
11958
12187
  var DataTrackReceiver = require('../../data/receiver');
@@ -12031,7 +12260,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12031
12260
  isRTCRtpSenderParamsSupported: isRTCRtpSenderParamsSupported,
12032
12261
  logLevel: DEFAULT_LOG_LEVEL,
12033
12262
  offerOptions: {},
12034
- revertSimulcastForNonVP8MediaSections: revertSimulcastForNonVP8MediaSections,
12263
+ revertSimulcast: revertSimulcast,
12035
12264
  sessionTimeout: DEFAULT_SESSION_TIMEOUT_SEC * 1000,
12036
12265
  setBitrateParameters: setBitrateParameters,
12037
12266
  setCodecPreferences: setCodecPreferences,
@@ -12169,6 +12398,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12169
12398
  _rtpSenders: {
12170
12399
  value: new Map()
12171
12400
  },
12401
+ _rtpNewSenders: {
12402
+ value: new Set()
12403
+ },
12172
12404
  _iceConnectionMonitor: {
12173
12405
  value: new options.IceConnectionMonitor(peerConnection)
12174
12406
  },
@@ -12217,9 +12449,6 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12217
12449
  return codec === 'opus' && dtx;
12218
12450
  })
12219
12451
  },
12220
- _shouldApplySimulcast: {
12221
- value: (isChrome || isSafari) && preferredCodecs.video.some(function (codecSettings) { return codecSettings.codec.toLowerCase() === 'vp8' && codecSettings.simulcast; })
12222
- },
12223
12452
  _queuedDescription: {
12224
12453
  writable: true,
12225
12454
  value: null
@@ -12261,8 +12490,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12261
12490
  _setSimulcast: {
12262
12491
  value: options.setSimulcast
12263
12492
  },
12264
- _revertSimulcastForNonVP8MediaSections: {
12265
- value: options.revertSimulcastForNonVP8MediaSections
12493
+ _revertSimulcast: {
12494
+ value: options.revertSimulcast
12266
12495
  },
12267
12496
  _RTCIceCandidate: {
12268
12497
  value: options.RTCIceCandidate
@@ -12289,6 +12518,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12289
12518
  writable: true,
12290
12519
  value: null
12291
12520
  },
12521
+ _mediaTrackSenderToPublisherHints: {
12522
+ value: new Map()
12523
+ },
12292
12524
  id: {
12293
12525
  enumerable: true,
12294
12526
  value: id
@@ -12318,6 +12550,29 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12318
12550
  PeerConnectionV2.prototype.toString = function () {
12319
12551
  return "[PeerConnectionV2 #" + this._instanceId + ": " + this.id + "]";
12320
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
+ });
12321
12576
  Object.defineProperty(PeerConnectionV2.prototype, "connectionState", {
12322
12577
  /**
12323
12578
  * The {@link PeerConnectionV2}'s underlying RTCPeerConnection's RTCPeerConnectionState
@@ -12362,35 +12617,97 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12362
12617
  enumerable: false,
12363
12618
  configurable: true
12364
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
+ });
12365
12632
  /**
12366
- * Updates scaleResolutionDownBy for encoding layers.
12367
- * @param {number} width
12368
- * @param {number} height
12633
+ * @param {MediaStreamTrack} track
12369
12634
  * @param {Array<RTCRtpEncodingParameters>} encodings
12635
+ * @param {boolean} trackReplaced
12636
+ * @returns {boolean} true if encodings were updated.
12370
12637
  */
12371
- PeerConnectionV2.prototype._updateEncodings = function (width, height, encodings) {
12372
- var _this = this;
12373
- // NOTE(mpatwardhan): All the simulcast encodings in Safari have
12374
- // the same resolution. So, here we make sure that the lower layers have
12375
- // lower resolution, as seen in Chrome.
12376
- var pixelsToMaxActiveLayers = [
12377
- { pixels: 960 * 540, maxActiveLayers: 3 },
12378
- { pixels: 480 * 270, maxActiveLayers: 2 },
12379
- { pixels: 0, maxActiveLayers: 1 }
12380
- ];
12381
- var trackPixels = width * height;
12382
- var activeLayersInfo = pixelsToMaxActiveLayers.find(function (layer) { return trackPixels >= layer.pixels; });
12383
- var activeLayers = Math.min(encodings.length, activeLayersInfo.maxActiveLayers);
12384
- encodings.forEach(function (encoding, i) {
12385
- encoding.active = i < activeLayers;
12386
- if (encoding.active) {
12387
- encoding.scaleResolutionDownBy = 1 << (activeLayers - i - 1);
12388
- }
12389
- else {
12390
- delete encoding.scaleResolutionDownBy;
12391
- }
12392
- _this._log.debug("setting up simulcast layer " + i + " with active = " + encoding.active + ", scaleResolutionDownBy = " + encoding.scaleResolutionDownBy);
12393
- });
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(', '));
12394
12711
  };
12395
12712
  /**
12396
12713
  * Add an ICE candidate to the {@link PeerConnectionV2}.
@@ -12510,7 +12827,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12510
12827
  // NOTE(syerrapragada): VMS does not support H264 simulcast. So,
12511
12828
  // unset simulcast for sections in local offer where corresponding
12512
12829
  // sections in answer doesn't have vp8 as preferred codec and reapply offer.
12513
- updatedSdp = _this._revertSimulcastForNonVP8MediaSections(updatedSdp, sdpWithoutSimulcast, offer.sdp);
12830
+ updatedSdp = _this._revertSimulcast(updatedSdp, sdpWithoutSimulcast, offer.sdp);
12514
12831
  }
12515
12832
  // NOTE(mmalavalli): Work around Chromium bug 1074421.
12516
12833
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1074421
@@ -12782,7 +13099,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12782
13099
  log.debug("Starting ICE reconnect timeout: " + delay);
12783
13100
  this._iceReconnectTimeout.start();
12784
13101
  }
12785
- this.offer();
13102
+ this.offer().catch(function (ex) {
13103
+ log.error("offer failed in _initiateIceRestart with: " + ex.message);
13104
+ });
12786
13105
  };
12787
13106
  /**
12788
13107
  * Schedule an ICE Restart.
@@ -12980,7 +13299,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12980
13299
  });
12981
13300
  }
12982
13301
  return this._peerConnection.setLocalDescription(description).catch(function (error) {
12983
- _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);
12984
13303
  var errorToThrow = new MediaClientLocalDescFailedError();
12985
13304
  var publishWarning = {
12986
13305
  message: "Calling setLocalDescription with an RTCSessionDescription of type \"" + description.type + "\" failed",
@@ -13058,8 +13377,13 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13058
13377
  // NOTE(syerrapragada): VMS does not support H264 simulcast. So,
13059
13378
  // unset simulcast for sections in local offer where corresponding
13060
13379
  // sections in answer doesn't have vp8 as preferred codec and reapply offer.
13061
- if (description.type === 'answer' && _this._shouldApplySimulcast) {
13062
- 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;
13063
13387
  if (sdpWithoutSimulcastForNonVP8MediaSections !== _this._localDescription.sdp) {
13064
13388
  return _this._rollbackAndApplyOffer({
13065
13389
  type: _this._localDescription.type,
@@ -13076,7 +13400,7 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13076
13400
  negotiationCompleted(_this);
13077
13401
  }
13078
13402
  }, function (error) {
13079
- _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);
13080
13404
  if (description.sdp) {
13081
13405
  _this._log.warn("The SDP was " + description.sdp);
13082
13406
  }
@@ -13200,12 +13524,82 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13200
13524
  this._log.warn("Error creating an RTCDataChannel for DataTrack \"" + dataTrackSender.id + "\": " + error.message);
13201
13525
  }
13202
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
+ };
13203
13596
  /**
13204
13597
  * Add the {@link MediaTrackSender} to the {@link PeerConnectionV2}.
13205
13598
  * @param {MediaTrackSender} mediaTrackSender
13206
13599
  * @returns {void}
13207
13600
  */
13208
13601
  PeerConnectionV2.prototype.addMediaTrackSender = function (mediaTrackSender) {
13602
+ var _this = this;
13209
13603
  if (this._peerConnection.signalingState === 'closed' || this._rtpSenders.has(mediaTrackSender)) {
13210
13604
  return;
13211
13605
  }
@@ -13218,7 +13612,8 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13218
13612
  var transceiver = this._addOrUpdateTransceiver(mediaTrackSender.track);
13219
13613
  sender = transceiver.sender;
13220
13614
  }
13221
- mediaTrackSender.addSender(sender);
13615
+ mediaTrackSender.addSender(sender, function (encodings) { return _this._setPublisherHint(mediaTrackSender, encodings); });
13616
+ this._rtpNewSenders.add(sender);
13222
13617
  this._rtpSenders.set(mediaTrackSender, sender);
13223
13618
  };
13224
13619
  /**
@@ -13316,6 +13711,13 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
13316
13711
  this._localMediaStream.removeTrack(mediaTrackSender.track);
13317
13712
  }
13318
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);
13319
13721
  this._rtpSenders.delete(mediaTrackSender);
13320
13722
  };
13321
13723
  /**
@@ -13544,7 +13946,10 @@ function negotiationCompleted(pcv2) {
13544
13946
  updateRemoteCodecMaps(pcv2);
13545
13947
  }
13546
13948
  if (pcv2._isRTCRtpSenderParamsSupported) {
13547
- updateEncodingParameters(pcv2);
13949
+ updateEncodingParameters(pcv2).then(function () {
13950
+ // if there any any publisher hints queued, apply them now.
13951
+ pcv2._handleQueuedPublisherHints();
13952
+ });
13548
13953
  }
13549
13954
  }
13550
13955
  /**
@@ -13558,6 +13963,7 @@ function updateEncodingParameters(pcv2) {
13558
13963
  ['audio', maxAudioBitrate],
13559
13964
  ['video', maxVideoBitrate]
13560
13965
  ]);
13966
+ var promises = [];
13561
13967
  pcv2._peerConnection.getSenders().filter(function (sender) { return sender.track; }).forEach(function (sender) {
13562
13968
  var maxBitrate = maxBitrates.get(sender.track.kind);
13563
13969
  var params = sender.getParameters();
@@ -13580,14 +13986,16 @@ function updateEncodingParameters(pcv2) {
13580
13986
  // by RTCRtpSender.setParameters() being rejected.
13581
13987
  params.encodings[0].networkPriority = 'high';
13582
13988
  }
13583
- if (isSafari && sender.track.kind === 'video') {
13584
- var _a = sender.track.getSettings(), width = _a.width, height = _a.height;
13585
- pcv2._updateEncodings(width, height, params.encodings);
13586
- }
13587
- 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) {
13588
13994
  pcv2._log.warn("Error while setting encodings parameters for " + sender.track.kind + " Track " + sender.track.id + ": " + (error.message || error.name));
13589
13995
  });
13996
+ promises.push(promise);
13590
13997
  });
13998
+ return Promise.all(promises);
13591
13999
  }
13592
14000
  /**
13593
14001
  * Remove maxBitrate from the RTCRtpSendParameters' encodings.
@@ -13617,7 +14025,7 @@ function setMaxBitrate(params, maxBitrate) {
13617
14025
  }
13618
14026
  module.exports = PeerConnectionV2;
13619
14027
 
13620
- },{"../../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":141,"../../util/twilio-video-errors":142,"./icebox":66,"./iceconnectionmonitor.js":67,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164,"@twilio/webrtc/lib/util/sdp":166,"backoff":169}],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){
13621
14029
  'use strict';
13622
14030
  var __extends = (this && this.__extends) || (function () {
13623
14031
  var extendStatics = function (d, b) {
@@ -13761,6 +14169,14 @@ var PeerConnectionManager = /** @class */ (function (_super) {
13761
14169
  });
13762
14170
  return _this;
13763
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
+ };
13764
14180
  Object.defineProperty(PeerConnectionManager.prototype, "connectionState", {
13765
14181
  /**
13766
14182
  * A summarized RTCPeerConnectionState across all the
@@ -14177,7 +14593,93 @@ function updateConnectionState(pcm) {
14177
14593
  }
14178
14594
  module.exports = PeerConnectionManager;
14179
14595
 
14180
- },{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":126,"../../util/twilio-video-errors":142,"../../webaudio/audiocontext":146,"./peerconnection":74,"@twilio/webrtc/lib/util":164}],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){
14181
14683
  'use strict';
14182
14684
  var __extends = (this && this.__extends) || (function () {
14183
14685
  var extendStatics = function (d, b) {
@@ -14237,7 +14739,7 @@ var RecordingV2 = /** @class */ (function (_super) {
14237
14739
  */
14238
14740
  module.exports = RecordingV2;
14239
14741
 
14240
- },{"../recording":59}],77:[function(require,module,exports){
14742
+ },{"../recording":59}],78:[function(require,module,exports){
14241
14743
  'use strict';
14242
14744
  var __extends = (this && this.__extends) || (function () {
14243
14745
  var extendStatics = function (d, b) {
@@ -14357,7 +14859,7 @@ var RemoteParticipantV2 = /** @class */ (function (_super) {
14357
14859
  }(RemoteParticipantSignaling));
14358
14860
  module.exports = RemoteParticipantV2;
14359
14861
 
14360
- },{"../remoteparticipant":60,"./remotetrackpublication":78}],78:[function(require,module,exports){
14862
+ },{"../remoteparticipant":60,"./remotetrackpublication":79}],79:[function(require,module,exports){
14361
14863
  'use strict';
14362
14864
  var __extends = (this && this.__extends) || (function () {
14363
14865
  var extendStatics = function (d, b) {
@@ -14411,7 +14913,7 @@ var RemoteTrackPublicationV2 = /** @class */ (function (_super) {
14411
14913
  */
14412
14914
  module.exports = RemoteTrackPublicationV2;
14413
14915
 
14414
- },{"../remotetrackpublication":61}],79:[function(require,module,exports){
14916
+ },{"../remotetrackpublication":61}],80:[function(require,module,exports){
14415
14917
  /* eslint callback-return:0 */
14416
14918
  'use strict';
14417
14919
  var __extends = (this && this.__extends) || (function () {
@@ -14430,7 +14932,9 @@ var __extends = (this && this.__extends) || (function () {
14430
14932
  };
14431
14933
  })();
14432
14934
  var MediaSignaling = require('./mediasignaling');
14935
+ var Timeout = require('../../util/timeout');
14433
14936
  var isDeepEqual = require('../../util').isDeepEqual;
14937
+ var RENDER_HINT_RESPONSE_TIME_MS = 2000; // time to wait for server response (before resending all hints.)
14434
14938
  var messageId = 1;
14435
14939
  var RenderHintsSignaling = /** @class */ (function (_super) {
14436
14940
  __extends(RenderHintsSignaling, _super);
@@ -14443,9 +14947,12 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14443
14947
  _trackSidsToRenderHints: {
14444
14948
  value: new Map()
14445
14949
  },
14446
- _isResponsePending: {
14447
- value: false,
14448
- 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),
14449
14956
  }
14450
14957
  });
14451
14958
  _this.on('ready', function (transport) {
@@ -14461,23 +14968,29 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14461
14968
  }
14462
14969
  });
14463
14970
  // NOTE(mpatwardhan): When transport is set (either 1st time of after vms failover)
14464
- // resend all track states. For this simply mark all tracks as dirty.
14465
- Array.from(_this._trackSidsToRenderHints.keys()).forEach(function (trackSid) {
14466
- var trackState = _this._trackSidsToRenderHints.get(trackSid);
14467
- if (trackState.renderDimensions) {
14468
- trackState.isDimensionDirty = true;
14469
- }
14470
- if ('enabled' in trackState) {
14471
- trackState.isEnabledDirty = true;
14472
- }
14473
- });
14474
- _this._sendHints();
14971
+ // resend all track states.
14972
+ _this._sendAllHints();
14475
14973
  });
14476
14974
  return _this;
14477
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
+ };
14478
14990
  RenderHintsSignaling.prototype._processHintResults = function (hintResults) {
14479
14991
  var _this = this;
14480
- this._isResponsePending = false;
14992
+ this._responseTimer.clear();
14993
+ this._responseTimer.setDelay(RENDER_HINT_RESPONSE_TIME_MS);
14481
14994
  hintResults.forEach(function (hintResult) {
14482
14995
  if (hintResult.result !== 'OK') {
14483
14996
  _this._log.debug('Server error processing hint:', hintResult);
@@ -14487,7 +15000,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14487
15000
  };
14488
15001
  RenderHintsSignaling.prototype._sendHints = function () {
14489
15002
  var _this = this;
14490
- if (!this._transport || this._isResponsePending) {
15003
+ if (!this._transport || this._responseTimer.isSet) {
14491
15004
  return;
14492
15005
  }
14493
15006
  var hints = [];
@@ -14519,7 +15032,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14519
15032
  };
14520
15033
  this._log.debug('Outgoing: ', payLoad);
14521
15034
  this._transport.publish(payLoad);
14522
- this._isResponsePending = true;
15035
+ this._responseTimer.start();
14523
15036
  }
14524
15037
  };
14525
15038
  /**
@@ -14551,7 +15064,8 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
14551
15064
  }(MediaSignaling));
14552
15065
  module.exports = RenderHintsSignaling;
14553
15066
 
14554
- },{"../../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 */
14555
15069
  'use strict';
14556
15070
  var __extends = (this && this.__extends) || (function () {
14557
15071
  var extendStatics = function (d, b) {
@@ -14594,6 +15108,7 @@ var StatsReport = require('../../stats/statsreport');
14594
15108
  var TrackPrioritySignaling = require('./trackprioritysignaling');
14595
15109
  var TrackSwitchOffSignaling = require('./trackswitchoffsignaling');
14596
15110
  var RenderHintsSignaling = require('./renderhintssignaling');
15111
+ var PublisherHintsSignaling = require('./publisherhintsignaling.js');
14597
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;
14598
15113
  var MovingAverageDelta = require('../../util/movingaveragedelta');
14599
15114
  var createTwilioError = require('../../util/twilio-video-errors').createTwilioError;
@@ -14675,6 +15190,9 @@ var RoomV2 = /** @class */ (function (_super) {
14675
15190
  _renderHintsSignaling: {
14676
15191
  value: new RenderHintsSignaling(getTrackReceiver, { log: log }),
14677
15192
  },
15193
+ _publisherHintsSignaling: {
15194
+ value: new PublisherHintsSignaling(getTrackReceiver, { log: log }),
15195
+ },
14678
15196
  _trackPrioritySignaling: {
14679
15197
  value: new options.TrackPrioritySignaling(getTrackReceiver, { log: log }),
14680
15198
  },
@@ -14698,11 +15216,15 @@ var RoomV2 = /** @class */ (function (_super) {
14698
15216
  _this._initTrackSwitchOffSignaling();
14699
15217
  _this._initDominantSpeakerSignaling();
14700
15218
  _this._initNetworkQualityMonitorSignaling();
15219
+ _this._initPublisherHintSignaling();
14701
15220
  handleLocalParticipantEvents(_this, localParticipant);
14702
15221
  handlePeerConnectionEvents(_this, peerConnectionManager);
14703
15222
  handleTransportEvents(_this, transport);
14704
15223
  periodicallyPublishStats(_this, transport, options.statsPublishIntervalMs);
14705
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);
14706
15228
  return _this;
14707
15229
  }
14708
15230
  Object.defineProperty(RoomV2.prototype, "connectionState", {
@@ -14956,7 +15478,8 @@ var RoomV2 = /** @class */ (function (_super) {
14956
15478
  this._networkQualitySignaling,
14957
15479
  this._trackPrioritySignaling,
14958
15480
  this._trackSwitchOffSignaling,
14959
- this._renderHintsSignaling
15481
+ this._renderHintsSignaling,
15482
+ this._publisherHintsSignaling
14960
15483
  ].forEach(function (mediaSignaling) {
14961
15484
  var channel = mediaSignaling.channel;
14962
15485
  if (!mediaSignaling.isSetup
@@ -14969,6 +15492,28 @@ var RoomV2 = /** @class */ (function (_super) {
14969
15492
  });
14970
15493
  return this;
14971
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
+ };
14972
15517
  RoomV2.prototype._initTrackSwitchOffSignaling = function () {
14973
15518
  var _this = this;
14974
15519
  this._trackSwitchOffSignaling.on('updated', function (tracksOff, tracksOn) {
@@ -15361,7 +15906,7 @@ function replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {
15361
15906
  }
15362
15907
  module.exports = RoomV2;
15363
15908
 
15364
- },{"../../stats/statsreport":112,"../../util":126,"../../util/movingaveragedelta":131,"../../util/twilio-video-errors":142,"../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){
15365
15910
  'use strict';
15366
15911
  var __extends = (this && this.__extends) || (function () {
15367
15912
  var extendStatics = function (d, b) {
@@ -15427,7 +15972,7 @@ var TrackPrioritySignaling = /** @class */ (function (_super) {
15427
15972
  }(MediaSignaling));
15428
15973
  module.exports = TrackPrioritySignaling;
15429
15974
 
15430
- },{"./mediasignaling":71}],82:[function(require,module,exports){
15975
+ },{"./mediasignaling":71}],83:[function(require,module,exports){
15431
15976
  'use strict';
15432
15977
  var __extends = (this && this.__extends) || (function () {
15433
15978
  var extendStatics = function (d, b) {
@@ -15485,7 +16030,7 @@ var TrackSwitchOffSignaling = /** @class */ (function (_super) {
15485
16030
  */
15486
16031
  module.exports = TrackSwitchOffSignaling;
15487
16032
 
15488
- },{"./mediasignaling":71}],83:[function(require,module,exports){
16033
+ },{"./mediasignaling":71}],84:[function(require,module,exports){
15489
16034
  'use strict';
15490
16035
  var __extends = (this && this.__extends) || (function () {
15491
16036
  var extendStatics = function (d, b) {
@@ -15503,20 +16048,16 @@ var __extends = (this && this.__extends) || (function () {
15503
16048
  };
15504
16049
  })();
15505
16050
  var getSdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat;
15506
- var packageInfo = require('../../../package.json');
15507
- var InsightsPublisher = require('../../util/insightspublisher');
15508
- var NullInsightsPublisher = require('../../util/insightspublisher/null');
15509
16051
  var StateMachine = require('../../statemachine');
15510
16052
  var TwilioConnection = require('../../twilioconnection');
15511
16053
  var DefaultBackoff = require('backoff');
15512
16054
  var reconnectBackoffConfig = require('../../util/constants').reconnectBackoffConfig;
15513
16055
  var Timeout = require('../../util/timeout');
15514
- var _a = require('../../util'), createBandwidthProfilePayload = _a.createBandwidthProfilePayload, createMediaSignalingPayload = _a.createMediaSignalingPayload, createSubscribePayload = _a.createSubscribePayload, getUserAgent = _a.getUserAgent, isNonArrayObject = _a.isNonArrayObject;
15515
- var _b = require('../../util/twilio-video-errors'), createTwilioError = _b.createTwilioError, RoomCompletedError = _b.RoomCompletedError, SignalingConnectionError = _b.SignalingConnectionError, SignalingServerBusyError = _b.SignalingServerBusyError;
16056
+ var _a = require('../../util/constants'), SDK_NAME = _a.SDK_NAME, SDK_VERSION = _a.SDK_VERSION;
16057
+ var _b = require('../../util'), createBandwidthProfilePayload = _b.createBandwidthProfilePayload, createMediaSignalingPayload = _b.createMediaSignalingPayload, createSubscribePayload = _b.createSubscribePayload, getUserAgent = _b.getUserAgent, isNonArrayObject = _b.isNonArrayObject;
16058
+ var _c = require('../../util/twilio-video-errors'), createTwilioError = _c.createTwilioError, RoomCompletedError = _c.RoomCompletedError, SignalingConnectionError = _c.SignalingConnectionError, SignalingServerBusyError = _c.SignalingServerBusyError;
15516
16059
  var ICE_VERSION = 1;
15517
16060
  var RSP_VERSION = 2;
15518
- var SDK_NAME = packageInfo.name + ".js";
15519
- var SDK_VERSION = packageInfo.version;
15520
16061
  /*
15521
16062
  TwilioConnectionTransport States
15522
16063
  ----------------
@@ -15577,8 +16118,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15577
16118
  var _this = this;
15578
16119
  options = Object.assign({
15579
16120
  Backoff: DefaultBackoff,
15580
- InsightsPublisher: InsightsPublisher,
15581
- NullInsightsPublisher: NullInsightsPublisher,
15582
16121
  TwilioConnection: TwilioConnection,
15583
16122
  iceServers: null,
15584
16123
  sdpFormat: getSdpFormat(options.sdpSemantics),
@@ -15588,12 +16127,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15588
16127
  userAgent: getUserAgent()
15589
16128
  }, options);
15590
16129
  _this = _super.call(this, 'connecting', states) || this;
15591
- var eventPublisherOptions = {};
15592
- if (options.wsServerInsights) {
15593
- eventPublisherOptions.gateway = options.wsServerInsights;
15594
- }
15595
- var EventPublisher = options.insights ? options.InsightsPublisher : options.NullInsightsPublisher;
15596
- var eventPublisher = new EventPublisher(accessToken, SDK_NAME, SDK_VERSION, options.environment, options.realm, eventPublisherOptions);
15597
16130
  Object.defineProperties(_this, {
15598
16131
  _accessToken: {
15599
16132
  value: accessToken
@@ -15604,12 +16137,12 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15604
16137
  _bandwidthProfile: {
15605
16138
  value: options.bandwidthProfile
15606
16139
  },
15607
- _disconnectEventPublisher: {
15608
- value: function () { return eventPublisher.disconnect(); }
15609
- },
15610
16140
  _dominantSpeaker: {
15611
16141
  value: options.dominantSpeaker
15612
16142
  },
16143
+ _adaptiveSimulcast: {
16144
+ value: options.adaptiveSimulcast
16145
+ },
15613
16146
  _eventObserver: {
15614
16147
  value: options.eventObserver,
15615
16148
  writable: false
@@ -15675,15 +16208,7 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15675
16208
  value: wsServer
15676
16209
  }
15677
16210
  });
15678
- // eslint-disable-next-line no-warning-comments
15679
- // TODO(mmalavalli): Create and set EventPublisher outside this class, so
15680
- // that the EventPublisher constructor is no longer a dependency.
15681
- _this._eventObserver.setPublisher(eventPublisher);
15682
16211
  setupTransport(_this);
15683
- _this.once('connected', function (_a) {
15684
- var sid = _a.sid, participant = _a.participant;
15685
- eventPublisher.connect(sid, participant.sid);
15686
- });
15687
16212
  return _this;
15688
16213
  }
15689
16214
  /**
@@ -15723,7 +16248,7 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15723
16248
  if (this._bandwidthProfile) {
15724
16249
  message.bandwidth_profile = createBandwidthProfilePayload(this._bandwidthProfile);
15725
16250
  }
15726
- 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);
15727
16252
  message.subscribe = createSubscribePayload(this._automaticSubscription);
15728
16253
  var sdpFormat = this._options.sdpFormat;
15729
16254
  if (sdpFormat) {
@@ -15773,7 +16298,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15773
16298
  this.preempt('disconnected', null, [error]);
15774
16299
  this._sendConnectOrSyncOrDisconnectMessage();
15775
16300
  this._twilioConnection.close();
15776
- this._disconnectEventPublisher();
15777
16301
  return true;
15778
16302
  }
15779
16303
  return false;
@@ -16092,7 +16616,7 @@ function setupTransport(transport) {
16092
16616
  }
16093
16617
  module.exports = TwilioConnectionTransport;
16094
16618
 
16095
- },{"../../../package.json":199,"../../statemachine":84,"../../twilioconnection":116,"../../util":126,"../../util/constants":120,"../../util/insightspublisher":127,"../../util/insightspublisher/null":128,"../../util/timeout":141,"../../util/twilio-video-errors":142,"@twilio/webrtc/lib/util/sdp":166,"backoff":169}],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){
16096
16620
  'use strict';
16097
16621
  var __extends = (this && this.__extends) || (function () {
16098
16622
  var extendStatics = function (d, b) {
@@ -16538,7 +17062,7 @@ function createUnreachableError(here, there) {
16538
17062
  }
16539
17063
  module.exports = StateMachine;
16540
17064
 
16541
- },{"./util":126,"events":178}],85:[function(require,module,exports){
17065
+ },{"./util":127,"events":180}],86:[function(require,module,exports){
16542
17066
  /* eslint no-undefined:0 */
16543
17067
  'use strict';
16544
17068
  /**
@@ -16551,7 +17075,7 @@ function average(xs) {
16551
17075
  }
16552
17076
  module.exports = average;
16553
17077
 
16554
- },{}],86:[function(require,module,exports){
17078
+ },{}],87:[function(require,module,exports){
16555
17079
  'use strict';
16556
17080
  /**
16557
17081
  * @property {number} [availableSend] - bps (undefined in Firefox)
@@ -16609,7 +17133,7 @@ var IceReport = /** @class */ (function () {
16609
17133
  }());
16610
17134
  module.exports = IceReport;
16611
17135
 
16612
- },{}],87:[function(require,module,exports){
17136
+ },{}],88:[function(require,module,exports){
16613
17137
  'use strict';
16614
17138
  var IceReport = require('./icereport');
16615
17139
  /**
@@ -16654,7 +17178,7 @@ var IceReportFactory = /** @class */ (function () {
16654
17178
  }());
16655
17179
  module.exports = IceReportFactory;
16656
17180
 
16657
- },{"./icereport":86}],88:[function(require,module,exports){
17181
+ },{"./icereport":87}],89:[function(require,module,exports){
16658
17182
  'use strict';
16659
17183
  var __extends = (this && this.__extends) || (function () {
16660
17184
  var extendStatics = function (d, b) {
@@ -16712,7 +17236,7 @@ var LocalAudioTrackStats = /** @class */ (function (_super) {
16712
17236
  */
16713
17237
  module.exports = LocalAudioTrackStats;
16714
17238
 
16715
- },{"./localtrackstats":89}],89:[function(require,module,exports){
17239
+ },{"./localtrackstats":90}],90:[function(require,module,exports){
16716
17240
  'use strict';
16717
17241
  var __extends = (this && this.__extends) || (function () {
16718
17242
  var extendStatics = function (d, b) {
@@ -16772,7 +17296,7 @@ var LocalTrackStats = /** @class */ (function (_super) {
16772
17296
  }(TrackStats));
16773
17297
  module.exports = LocalTrackStats;
16774
17298
 
16775
- },{"./trackstats":114}],90:[function(require,module,exports){
17299
+ },{"./trackstats":115}],91:[function(require,module,exports){
16776
17300
  'use strict';
16777
17301
  var __extends = (this && this.__extends) || (function () {
16778
17302
  var extendStatics = function (d, b) {
@@ -16865,7 +17389,7 @@ var LocalVideoTrackStats = /** @class */ (function (_super) {
16865
17389
  }(LocalTrackStats));
16866
17390
  module.exports = LocalVideoTrackStats;
16867
17391
 
16868
- },{"./localtrackstats":89}],91:[function(require,module,exports){
17392
+ },{"./localtrackstats":90}],92:[function(require,module,exports){
16869
17393
  'use strict';
16870
17394
  var __extends = (this && this.__extends) || (function () {
16871
17395
  var extendStatics = function (d, b) {
@@ -16899,7 +17423,7 @@ var NetworkQualityAudioStats = /** @class */ (function (_super) {
16899
17423
  }(NetworkQualityMediaStats));
16900
17424
  module.exports = NetworkQualityAudioStats;
16901
17425
 
16902
- },{"./networkqualitymediastats":95}],92:[function(require,module,exports){
17426
+ },{"./networkqualitymediastats":96}],93:[function(require,module,exports){
16903
17427
  'use strict';
16904
17428
  /**
16905
17429
  * Bandwidth network quality statistics.
@@ -16933,7 +17457,7 @@ var NetworkQualityBandwidthStats = /** @class */ (function () {
16933
17457
  }());
16934
17458
  module.exports = NetworkQualityBandwidthStats;
16935
17459
 
16936
- },{}],93:[function(require,module,exports){
17460
+ },{}],94:[function(require,module,exports){
16937
17461
  'use strict';
16938
17462
  /**
16939
17463
  * Fraction lost network quality statistics.
@@ -16962,7 +17486,7 @@ var NetworkQualityFractionLostStats = /** @class */ (function () {
16962
17486
  }());
16963
17487
  module.exports = NetworkQualityFractionLostStats;
16964
17488
 
16965
- },{}],94:[function(require,module,exports){
17489
+ },{}],95:[function(require,module,exports){
16966
17490
  'use strict';
16967
17491
  /**
16968
17492
  * Latency network quality statistics.
@@ -16996,7 +17520,7 @@ var NetworkQualityLatencyStats = /** @class */ (function () {
16996
17520
  }());
16997
17521
  module.exports = NetworkQualityLatencyStats;
16998
17522
 
16999
- },{}],95:[function(require,module,exports){
17523
+ },{}],96:[function(require,module,exports){
17000
17524
  'use strict';
17001
17525
  var NetworkQualitySendStats = require('./networkqualitysendstats');
17002
17526
  var NetworkQualityRecvStats = require('./networkqualityrecvstats');
@@ -17043,7 +17567,7 @@ var NetworkQualityMediaStats = /** @class */ (function () {
17043
17567
  }());
17044
17568
  module.exports = NetworkQualityMediaStats;
17045
17569
 
17046
- },{"./networkqualityrecvstats":96,"./networkqualitysendstats":98}],96:[function(require,module,exports){
17570
+ },{"./networkqualityrecvstats":97,"./networkqualitysendstats":99}],97:[function(require,module,exports){
17047
17571
  'use strict';
17048
17572
  var __extends = (this && this.__extends) || (function () {
17049
17573
  var extendStatics = function (d, b) {
@@ -17078,7 +17602,7 @@ var NetworkQualityRecvStats = /** @class */ (function (_super) {
17078
17602
  }(NetworkQualitySendOrRecvStats));
17079
17603
  module.exports = NetworkQualityRecvStats;
17080
17604
 
17081
- },{"./networkqualitysendorrecvstats":97}],97:[function(require,module,exports){
17605
+ },{"./networkqualitysendorrecvstats":98}],98:[function(require,module,exports){
17082
17606
  'use strict';
17083
17607
  var NetworkQualityBandwidthStats = require('./networkqualitybandwidthstats');
17084
17608
  var NetworkQualityFractionLostStats = require('./networkqualityfractionloststats');
@@ -17118,7 +17642,7 @@ var NetworkQualitySendOrRecvStats = /** @class */ (function () {
17118
17642
  }());
17119
17643
  module.exports = NetworkQualitySendOrRecvStats;
17120
17644
 
17121
- },{"./networkqualitybandwidthstats":92,"./networkqualityfractionloststats":93,"./networkqualitylatencystats":94}],98:[function(require,module,exports){
17645
+ },{"./networkqualitybandwidthstats":93,"./networkqualityfractionloststats":94,"./networkqualitylatencystats":95}],99:[function(require,module,exports){
17122
17646
  'use strict';
17123
17647
  var __extends = (this && this.__extends) || (function () {
17124
17648
  var extendStatics = function (d, b) {
@@ -17153,7 +17677,7 @@ var NetworkQualitySendStats = /** @class */ (function (_super) {
17153
17677
  }(NetworkQualitySendOrRecvStats));
17154
17678
  module.exports = NetworkQualitySendStats;
17155
17679
 
17156
- },{"./networkqualitysendorrecvstats":97}],99:[function(require,module,exports){
17680
+ },{"./networkqualitysendorrecvstats":98}],100:[function(require,module,exports){
17157
17681
  'use strict';
17158
17682
  var NetworkQualityAudioStats = require('./networkqualityaudiostats');
17159
17683
  var NetworkQualityVideoStats = require('./networkqualityvideostats');
@@ -17193,7 +17717,7 @@ var NetworkQualityStats = /** @class */ (function () {
17193
17717
  }());
17194
17718
  module.exports = NetworkQualityStats;
17195
17719
 
17196
- },{"./networkqualityaudiostats":91,"./networkqualityvideostats":100}],100:[function(require,module,exports){
17720
+ },{"./networkqualityaudiostats":92,"./networkqualityvideostats":101}],101:[function(require,module,exports){
17197
17721
  'use strict';
17198
17722
  var __extends = (this && this.__extends) || (function () {
17199
17723
  var extendStatics = function (d, b) {
@@ -17227,7 +17751,7 @@ var NetworkQualityVideoStats = /** @class */ (function (_super) {
17227
17751
  }(NetworkQualityMediaStats));
17228
17752
  module.exports = NetworkQualityVideoStats;
17229
17753
 
17230
- },{"./networkqualitymediastats":95}],101:[function(require,module,exports){
17754
+ },{"./networkqualitymediastats":96}],102:[function(require,module,exports){
17231
17755
  'use strict';
17232
17756
  var ReceiverReport = require('./receiverreport');
17233
17757
  var SenderReport = require('./senderreport');
@@ -17305,7 +17829,7 @@ var PeerConnectionReport = /** @class */ (function () {
17305
17829
  }());
17306
17830
  module.exports = PeerConnectionReport;
17307
17831
 
17308
- },{"./receiverreport":103,"./senderreport":110}],102:[function(require,module,exports){
17832
+ },{"./receiverreport":104,"./senderreport":111}],103:[function(require,module,exports){
17309
17833
  'use strict';
17310
17834
  var __read = (this && this.__read) || function (o, n) {
17311
17835
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -17735,7 +18259,7 @@ function updateChrome(factory) {
17735
18259
  }
17736
18260
  module.exports = PeerConnectionReportFactory;
17737
18261
 
17738
- },{"./icereportfactory":87,"./peerconnectionreport":101,"./receiverreportfactory":104,"./senderreportfactory":111,"@twilio/webrtc/lib/util":164}],103:[function(require,module,exports){
18262
+ },{"./icereportfactory":88,"./peerconnectionreport":102,"./receiverreportfactory":105,"./senderreportfactory":112,"@twilio/webrtc/lib/util":166}],104:[function(require,module,exports){
17739
18263
  'use strict';
17740
18264
  var __extends = (this && this.__extends) || (function () {
17741
18265
  var extendStatics = function (d, b) {
@@ -17861,7 +18385,7 @@ var ReceiverReport = /** @class */ (function (_super) {
17861
18385
  }(SenderOrReceiverReport));
17862
18386
  module.exports = ReceiverReport;
17863
18387
 
17864
- },{"./average":85,"./senderorreceiverreport":108,"./sum":113}],104:[function(require,module,exports){
18388
+ },{"./average":86,"./senderorreceiverreport":109,"./sum":114}],105:[function(require,module,exports){
17865
18389
  'use strict';
17866
18390
  var __extends = (this && this.__extends) || (function () {
17867
18391
  var extendStatics = function (d, b) {
@@ -17920,7 +18444,7 @@ var ReceiverReportFactory = /** @class */ (function (_super) {
17920
18444
  }(SenderOrReceiverReportFactory));
17921
18445
  module.exports = ReceiverReportFactory;
17922
18446
 
17923
- },{"./receiverreport":103,"./senderorreceiverreportfactory":109}],105:[function(require,module,exports){
18447
+ },{"./receiverreport":104,"./senderorreceiverreportfactory":110}],106:[function(require,module,exports){
17924
18448
  'use strict';
17925
18449
  var __extends = (this && this.__extends) || (function () {
17926
18450
  var extendStatics = function (d, b) {
@@ -17972,7 +18496,7 @@ var RemoteAudioTrackStats = /** @class */ (function (_super) {
17972
18496
  }(RemoteTrackStats));
17973
18497
  module.exports = RemoteAudioTrackStats;
17974
18498
 
17975
- },{"./remotetrackstats":106}],106:[function(require,module,exports){
18499
+ },{"./remotetrackstats":107}],107:[function(require,module,exports){
17976
18500
  'use strict';
17977
18501
  var __extends = (this && this.__extends) || (function () {
17978
18502
  var extendStatics = function (d, b) {
@@ -18024,7 +18548,7 @@ var RemoteTrackStats = /** @class */ (function (_super) {
18024
18548
  }(TrackStats));
18025
18549
  module.exports = RemoteTrackStats;
18026
18550
 
18027
- },{"./trackstats":114}],107:[function(require,module,exports){
18551
+ },{"./trackstats":115}],108:[function(require,module,exports){
18028
18552
  'use strict';
18029
18553
  var __extends = (this && this.__extends) || (function () {
18030
18554
  var extendStatics = function (d, b) {
@@ -18089,7 +18613,7 @@ var RemoteVideoTrackStats = /** @class */ (function (_super) {
18089
18613
  }(RemoteTrackStats));
18090
18614
  module.exports = RemoteVideoTrackStats;
18091
18615
 
18092
- },{"./remotetrackstats":106}],108:[function(require,module,exports){
18616
+ },{"./remotetrackstats":107}],109:[function(require,module,exports){
18093
18617
  'use strict';
18094
18618
  /**
18095
18619
  * @property {StatsId} id
@@ -18123,7 +18647,7 @@ var SenderOrReceiverReport = /** @class */ (function () {
18123
18647
  }());
18124
18648
  module.exports = SenderOrReceiverReport;
18125
18649
 
18126
- },{}],109:[function(require,module,exports){
18650
+ },{}],110:[function(require,module,exports){
18127
18651
  'use strict';
18128
18652
  /**
18129
18653
  * @property {StatsId} id
@@ -18159,7 +18683,7 @@ var SenderOrReceiverReportFactory = /** @class */ (function () {
18159
18683
  }());
18160
18684
  module.exports = SenderOrReceiverReportFactory;
18161
18685
 
18162
- },{}],110:[function(require,module,exports){
18686
+ },{}],111:[function(require,module,exports){
18163
18687
  /* eslint no-undefined:0 */
18164
18688
  'use strict';
18165
18689
  var __extends = (this && this.__extends) || (function () {
@@ -18247,7 +18771,7 @@ var SenderReport = /** @class */ (function (_super) {
18247
18771
  }(SenderOrReceiverReport));
18248
18772
  module.exports = SenderReport;
18249
18773
 
18250
- },{"./average":85,"./senderorreceiverreport":108,"./sum":113}],111:[function(require,module,exports){
18774
+ },{"./average":86,"./senderorreceiverreport":109,"./sum":114}],112:[function(require,module,exports){
18251
18775
  'use strict';
18252
18776
  var __extends = (this && this.__extends) || (function () {
18253
18777
  var extendStatics = function (d, b) {
@@ -18306,7 +18830,7 @@ var SenderReportFactory = /** @class */ (function (_super) {
18306
18830
  }(SenderOrReceiverReportFactory));
18307
18831
  module.exports = SenderReportFactory;
18308
18832
 
18309
- },{"./senderorreceiverreportfactory":109,"./senderreport":110}],112:[function(require,module,exports){
18833
+ },{"./senderorreceiverreportfactory":110,"./senderreport":111}],113:[function(require,module,exports){
18310
18834
  'use strict';
18311
18835
  var LocalAudioTrackStats = require('./localaudiotrackstats');
18312
18836
  var LocalVideoTrackStats = require('./localvideotrackstats');
@@ -18357,7 +18881,7 @@ var StatsReport = /** @class */ (function () {
18357
18881
  }());
18358
18882
  module.exports = StatsReport;
18359
18883
 
18360
- },{"./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){
18361
18885
  'use strict';
18362
18886
  /**
18363
18887
  * @param {Array<number|undefined>} xs
@@ -18368,7 +18892,7 @@ function sum(xs) {
18368
18892
  }
18369
18893
  module.exports = sum;
18370
18894
 
18371
- },{}],114:[function(require,module,exports){
18895
+ },{}],115:[function(require,module,exports){
18372
18896
  'use strict';
18373
18897
  /**
18374
18898
  * Statistics for a {@link Track}.
@@ -18427,7 +18951,7 @@ var TrackStats = /** @class */ (function () {
18427
18951
  }());
18428
18952
  module.exports = TrackStats;
18429
18953
 
18430
- },{}],115:[function(require,module,exports){
18954
+ },{}],116:[function(require,module,exports){
18431
18955
  'use strict';
18432
18956
  var __extends = (this && this.__extends) || (function () {
18433
18957
  var extendStatics = function (d, b) {
@@ -18489,7 +19013,7 @@ var TrackTransceiver = /** @class */ (function (_super) {
18489
19013
  */
18490
19014
  module.exports = TrackTransceiver;
18491
19015
 
18492
- },{"events":178}],116:[function(require,module,exports){
19016
+ },{"events":180}],117:[function(require,module,exports){
18493
19017
  (function (global){(function (){
18494
19018
  'use strict';
18495
19019
  var __extends = (this && this.__extends) || (function () {
@@ -19144,7 +19668,7 @@ TwilioConnection.CloseReason = CloseReason;
19144
19668
  module.exports = TwilioConnection;
19145
19669
 
19146
19670
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
19147
- },{"./statemachine":84,"./util":126,"./util/log":130,"./util/networkmonitor":132,"./util/timeout":141,"ws":200}],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){
19148
19672
  'use strict';
19149
19673
  var defer = require('./').defer;
19150
19674
  /**
@@ -19209,7 +19733,7 @@ var AsyncVar = /** @class */ (function () {
19209
19733
  }());
19210
19734
  module.exports = AsyncVar;
19211
19735
 
19212
- },{"./":126}],118:[function(require,module,exports){
19736
+ },{"./":127}],119:[function(require,module,exports){
19213
19737
  /* globals chrome, navigator */
19214
19738
  'use strict';
19215
19739
  var __read = (this && this.__read) || function (o, n) {
@@ -19340,7 +19864,7 @@ module.exports = {
19340
19864
  rebrandedChromeBrowser: rebrandedChromeBrowser
19341
19865
  };
19342
19866
 
19343
- },{}],119:[function(require,module,exports){
19867
+ },{}],120:[function(require,module,exports){
19344
19868
  'use strict';
19345
19869
  var __read = (this && this.__read) || function (o, n) {
19346
19870
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -19468,12 +19992,26 @@ var CancelablePromise = /** @class */ (function () {
19468
19992
  promise.then.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);
19469
19993
  }, this._onCancel);
19470
19994
  };
19995
+ /**
19996
+ * @param {?function} onFinally
19997
+ * @returns {CancelablePromise}
19998
+ */
19999
+ CancelablePromise.prototype.finally = function () {
20000
+ var args = [].slice.call(arguments);
20001
+ var promise = this._promise;
20002
+ return new CancelablePromise(function onCreate(resolve, reject) {
20003
+ promise.finally.apply(promise, __spreadArray([], __read(args))).then(resolve, reject);
20004
+ }, this._onCancel);
20005
+ };
19471
20006
  return CancelablePromise;
19472
20007
  }());
19473
20008
  module.exports = CancelablePromise;
19474
20009
 
19475
- },{}],120:[function(require,module,exports){
20010
+ },{}],121:[function(require,module,exports){
19476
20011
  'use strict';
20012
+ var packageInfo = require('../../package.json');
20013
+ module.exports.SDK_NAME = packageInfo.name + ".js";
20014
+ module.exports.SDK_VERSION = packageInfo.version;
19477
20015
  module.exports.DEFAULT_ENVIRONMENT = 'prod';
19478
20016
  module.exports.DEFAULT_REALM = 'us1';
19479
20017
  module.exports.DEFAULT_REGION = 'gll';
@@ -19557,7 +20095,7 @@ module.exports.videoContentPreferencesMode = {
19557
20095
  MODE_MANUAL: 'manual'
19558
20096
  };
19559
20097
 
19560
- },{}],121:[function(require,module,exports){
20098
+ },{"../../package.json":201}],122:[function(require,module,exports){
19561
20099
  'use strict';
19562
20100
  var detectSilence = require('../webaudio/detectsilence');
19563
20101
  var N_ATTEMPTS = 3;
@@ -19598,7 +20136,7 @@ function detectSilentAudio(el) {
19598
20136
  }
19599
20137
  module.exports = detectSilentAudio;
19600
20138
 
19601
- },{"../webaudio/audiocontext":146,"../webaudio/detectsilence":147}],122:[function(require,module,exports){
20139
+ },{"../webaudio/audiocontext":148,"../webaudio/detectsilence":149}],123:[function(require,module,exports){
19602
20140
  'use strict';
19603
20141
  // Cached copy of the <canvas> used to check silent video frames.
19604
20142
  var canvas = null;
@@ -19657,7 +20195,7 @@ function detectSilentVideo(el) {
19657
20195
  }
19658
20196
  module.exports = detectSilentVideo;
19659
20197
 
19660
- },{}],123:[function(require,module,exports){
20198
+ },{}],124:[function(require,module,exports){
19661
20199
  'use strict';
19662
20200
  /**
19663
20201
  * The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM
@@ -19779,7 +20317,7 @@ var DocumentVisibilityMonitor = /** @class */ (function () {
19779
20317
  }());
19780
20318
  module.exports = new DocumentVisibilityMonitor(2);
19781
20319
 
19782
- },{}],124:[function(require,module,exports){
20320
+ },{}],125:[function(require,module,exports){
19783
20321
  /* eslint-disable no-console */
19784
20322
  'use strict';
19785
20323
  var __extends = (this && this.__extends) || (function () {
@@ -19803,7 +20341,8 @@ var VALID_GROUPS = [
19803
20341
  'room',
19804
20342
  'media',
19805
20343
  'quality',
19806
- 'video-processor'
20344
+ 'video-processor',
20345
+ 'preflight'
19807
20346
  ];
19808
20347
  var VALID_LEVELS = [
19809
20348
  'debug',
@@ -19821,36 +20360,32 @@ var EventObserver = /** @class */ (function (_super) {
19821
20360
  __extends(EventObserver, _super);
19822
20361
  /**
19823
20362
  * Constructor.
20363
+ * @param {InsightsPublisher} publisher
19824
20364
  * @param {number} connectTimestamp
19825
20365
  * @param {Log} log
19826
20366
  * @param {EventListener} [eventListener]
19827
20367
  */
19828
- function EventObserver(connectTimestamp, log, eventListener) {
20368
+ function EventObserver(publisher, connectTimestamp, log, eventListener) {
19829
20369
  if (eventListener === void 0) { eventListener = null; }
19830
20370
  var _this = _super.call(this) || this;
19831
- Object.defineProperties(_this, {
19832
- _publisher: {
19833
- value: null,
19834
- writable: true
19835
- }
19836
- });
19837
20371
  _this.on('event', function (_a) {
19838
20372
  var name = _a.name, group = _a.group, level = _a.level, payload = _a.payload;
19839
20373
  if (typeof name !== 'string') {
20374
+ log.error('Unexpected name: ', name);
19840
20375
  throw new Error('Unexpected name: ', name);
19841
20376
  }
19842
20377
  if (!VALID_GROUPS.includes(group)) {
20378
+ log.error('Unexpected group: ', group);
19843
20379
  throw new Error('Unexpected group: ', group);
19844
20380
  }
19845
20381
  if (!VALID_LEVELS.includes(level)) {
20382
+ log.error('Unexpected level: ', level);
19846
20383
  throw new Error('Unexpected level: ', level);
19847
20384
  }
19848
20385
  var timestamp = Date.now();
19849
20386
  var elapsedTime = timestamp - connectTimestamp;
19850
- if (_this._publisher) {
19851
- var publisherPayload = Object.assign({ elapsedTime: elapsedTime, level: level }, payload ? payload : {});
19852
- _this._publisher.publish(group, name, publisherPayload);
19853
- }
20387
+ var publisherPayload = Object.assign({ elapsedTime: elapsedTime, level: level }, payload ? payload : {});
20388
+ publisher.publish(group, name, publisherPayload);
19854
20389
  var event = Object.assign({
19855
20390
  elapsedTime: elapsedTime,
19856
20391
  group: group,
@@ -19871,13 +20406,6 @@ var EventObserver = /** @class */ (function (_super) {
19871
20406
  });
19872
20407
  return _this;
19873
20408
  }
19874
- /**
19875
- * sets the publisher object. Once set events will be sent to publisher.
19876
- * @param {InsightsPublisher} publisher
19877
- */
19878
- EventObserver.prototype.setPublisher = function (publisher) {
19879
- this._publisher = publisher;
19880
- };
19881
20409
  return EventObserver;
19882
20410
  }(EventEmitter));
19883
20411
  /**
@@ -19887,7 +20415,7 @@ var EventObserver = /** @class */ (function (_super) {
19887
20415
  */
19888
20416
  module.exports = EventObserver;
19889
20417
 
19890
- },{"events":178}],125:[function(require,module,exports){
20418
+ },{"events":180}],126:[function(require,module,exports){
19891
20419
  'use strict';
19892
20420
  var Filter = /** @class */ (function () {
19893
20421
  function Filter(options) {
@@ -19931,7 +20459,7 @@ var Filter = /** @class */ (function () {
19931
20459
  }());
19932
20460
  module.exports = Filter;
19933
20461
 
19934
- },{}],126:[function(require,module,exports){
20462
+ },{}],127:[function(require,module,exports){
19935
20463
  'use strict';
19936
20464
  var __extends = (this && this.__extends) || (function () {
19937
20465
  var extendStatics = function (d, b) {
@@ -19972,6 +20500,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19972
20500
  var constants = require('./constants');
19973
20501
  var E = constants.typeErrors, trackPriority = constants.trackPriority;
19974
20502
  var util = require('@twilio/webrtc/lib/util');
20503
+ var sessionSID = require('./sid').sessionSID;
19975
20504
  /**
19976
20505
  * Return the given {@link LocalTrack} or a new {@link LocalTrack} for the
19977
20506
  * given MediaStreamTrack.
@@ -20522,6 +21051,7 @@ function createRoomConnectEventPayload(connectOptions) {
20522
21051
  return val ? 'true' : 'false';
20523
21052
  }
20524
21053
  var payload = {
21054
+ sessionSID: sessionSID,
20525
21055
  // arrays props converted to lengths.
20526
21056
  iceServers: (connectOptions.iceServers || []).length,
20527
21057
  audioTracks: (connectOptions.tracks || []).filter(function (track) { return track.kind === 'audio'; }).length,
@@ -20534,13 +21064,27 @@ function createRoomConnectEventPayload(connectOptions) {
20534
21064
  eventProp = eventProp || prop;
20535
21065
  payload[eventProp] = boolToString(!!connectOptions[prop]);
20536
21066
  });
20537
- // numbers and string properties.
20538
- [['maxVideoBitrate'], ['maxAudioBitrate'], ['iceTransportPolicy'], ['region'], ['name', 'roomName']].forEach(function (_a) {
21067
+ // numbers properties.
21068
+ [['maxVideoBitrate'], ['maxAudioBitrate']].forEach(function (_a) {
21069
+ var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
21070
+ eventProp = eventProp || prop;
21071
+ if (typeof connectOptions[prop] === 'number') {
21072
+ payload[eventProp] = connectOptions[prop];
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) {
20539
21080
  var _b = __read(_a, 2), prop = _b[0], eventProp = _b[1];
20540
21081
  eventProp = eventProp || prop;
20541
- if (typeof connectOptions[prop] === 'number' || typeof connectOptions[prop] === 'string') {
21082
+ if (typeof connectOptions[prop] === 'string') {
20542
21083
  payload[eventProp] = connectOptions[prop];
20543
21084
  }
21085
+ else if (typeof connectOptions[prop] === 'number' && prop === 'name') {
21086
+ payload[eventProp] = connectOptions[prop].toString();
21087
+ }
20544
21088
  });
20545
21089
  // array props stringified.
20546
21090
  ['preferredAudioCodecs', 'preferredVideoCodecs'].forEach(function (prop) {
@@ -20623,7 +21167,7 @@ function createBandwidthProfileVideoPayload(bandwidthProfileVideo) {
20623
21167
  * protocol or not.
20624
21168
  * @returns {object}
20625
21169
  */
20626
- function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, renderHints) {
21170
+ function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPriority, trackSwitchOff, adaptiveSimulcast, renderHints) {
20627
21171
  var transports = { transports: [{ type: 'data-channel' }] };
20628
21172
  return Object.assign(dominantSpeaker
20629
21173
  // eslint-disable-next-line
@@ -20634,6 +21178,9 @@ function createMediaSignalingPayload(dominantSpeaker, networkQuality, trackPrior
20634
21178
  : {}, renderHints
20635
21179
  // eslint-disable-next-line
20636
21180
  ? { render_hints: transports }
21181
+ : {}, adaptiveSimulcast
21182
+ // eslint-disable-next-line
21183
+ ? { publisher_hints: transports }
20637
21184
  : {}, trackPriority
20638
21185
  // eslint-disable-next-line
20639
21186
  ? { track_priority: transports }
@@ -20728,8 +21275,7 @@ function inRange(num, min, max) {
20728
21275
  function isChromeScreenShareTrack(track) {
20729
21276
  // NOTE(mpatwardhan): Chrome creates screen share tracks with label like: "screen:69734272*"
20730
21277
  // we will check for label that starts with "screen:D" where D being a digit.
20731
- var isChrome = util.guessBrowser() === 'chrome';
20732
- 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();
20733
21279
  }
20734
21280
  /**
20735
21281
  * returns true if given MediaStreamTrack is a user media track
@@ -20799,7 +21345,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
20799
21345
  exports.waitForSometime = waitForSometime;
20800
21346
  exports.waitForEvent = waitForEvent;
20801
21347
 
20802
- },{"./constants":120,"@twilio/webrtc/lib/util":164}],127:[function(require,module,exports){
21348
+ },{"./constants":121,"./sid":141,"@twilio/webrtc/lib/util":166}],128:[function(require,module,exports){
20803
21349
  (function (global){(function (){
20804
21350
  'use strict';
20805
21351
  var __extends = (this && this.__extends) || (function () {
@@ -21076,7 +21622,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
21076
21622
  module.exports = InsightsPublisher;
21077
21623
 
21078
21624
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21079
- },{"..":126,"../../util":126,"events":178,"ws":200}],128:[function(require,module,exports){
21625
+ },{"..":127,"../../util":127,"events":180,"ws":202}],129:[function(require,module,exports){
21080
21626
  // eslint-disable-next-line no-warning-comments
21081
21627
  // TODO(mroberts): This should be described as implementing some
21082
21628
  // InsightsPublisher interface.
@@ -21121,7 +21667,7 @@ var InsightsPublisher = /** @class */ (function () {
21121
21667
  }());
21122
21668
  module.exports = InsightsPublisher;
21123
21669
 
21124
- },{}],129:[function(require,module,exports){
21670
+ },{}],130:[function(require,module,exports){
21125
21671
  'use strict';
21126
21672
  var defer = require('./').defer;
21127
21673
  /**
@@ -21183,7 +21729,7 @@ var LocalMediaRestartDeferreds = /** @class */ (function () {
21183
21729
  }());
21184
21730
  module.exports = new LocalMediaRestartDeferreds();
21185
21731
 
21186
- },{"./":126}],130:[function(require,module,exports){
21732
+ },{"./":127}],131:[function(require,module,exports){
21187
21733
  /* eslint new-cap:0 */
21188
21734
  'use strict';
21189
21735
  var __read = (this && this.__read) || function (o, n) {
@@ -21470,7 +22016,7 @@ function validateLogLevels(levels) {
21470
22016
  }
21471
22017
  module.exports = Log;
21472
22018
 
21473
- },{"../vendor/loglevel":145,"./constants":120}],131:[function(require,module,exports){
22019
+ },{"../vendor/loglevel":147,"./constants":121}],132:[function(require,module,exports){
21474
22020
  'use strict';
21475
22021
  /**
21476
22022
  * Calculates the moving average delta for the given pair ofsamples. A sample (S)
@@ -21517,7 +22063,7 @@ var MovingAverageDelta = /** @class */ (function () {
21517
22063
  }());
21518
22064
  module.exports = MovingAverageDelta;
21519
22065
 
21520
- },{}],132:[function(require,module,exports){
22066
+ },{}],133:[function(require,module,exports){
21521
22067
  'use strict';
21522
22068
  /**
21523
22069
  * Monitor the network connection status to detect interruptions and handoffs.
@@ -21606,7 +22152,7 @@ var NetworkMonitor = /** @class */ (function () {
21606
22152
  }());
21607
22153
  module.exports = NetworkMonitor;
21608
22154
 
21609
- },{}],133:[function(require,module,exports){
22155
+ },{}],134:[function(require,module,exports){
21610
22156
  /* eslint-disable no-console */
21611
22157
  'use strict';
21612
22158
  var __extends = (this && this.__extends) || (function () {
@@ -21669,7 +22215,7 @@ var NullResizeObserver = /** @class */ (function (_super) {
21669
22215
  }(NullObserver));
21670
22216
  module.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };
21671
22217
 
21672
- },{}],134:[function(require,module,exports){
22218
+ },{}],135:[function(require,module,exports){
21673
22219
  'use strict';
21674
22220
  var __read = (this && this.__read) || function (o, n) {
21675
22221
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -22057,9 +22603,12 @@ function unifiedPlanFilterLocalCodecs(localSdp, remoteSdp) {
22057
22603
  * @param localSdp - simulcast enabled local sdp
22058
22604
  * @param localSdpWithoutSimulcast - local sdp before simulcast was set
22059
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.
22060
22608
  * @return {string} Updated SDP string
22061
22609
  */
22062
- function revertSimulcastForNonVP8MediaSections(localSdp, localSdpWithoutSimulcast, remoteSdp) {
22610
+ function revertSimulcast(localSdp, localSdpWithoutSimulcast, remoteSdp, revertForAll) {
22611
+ if (revertForAll === void 0) { revertForAll = false; }
22063
22612
  var remoteMidToMediaSections = createMidToMediaSectionMap(remoteSdp);
22064
22613
  var localMidToMediaSectionsWithoutSimulcast = createMidToMediaSectionMap(localSdpWithoutSimulcast);
22065
22614
  var mediaSections = getMediaSections(localSdp);
@@ -22078,7 +22627,8 @@ function revertSimulcastForNonVP8MediaSections(localSdp, localSdpWithoutSimulcas
22078
22627
  var remotePtToCodecs = createPtToCodecName(remoteSection);
22079
22628
  var remotePayloadTypes = getPayloadTypesInMediaSection(remoteSection);
22080
22629
  var isVP8ThePreferredCodec = remotePayloadTypes.length && remotePtToCodecs.get(remotePayloadTypes[0]) === 'vp8';
22081
- return isVP8ThePreferredCodec ? section : localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\r\n$/, '');
22630
+ var shouldRevertSimulcast = revertForAll || !isVP8ThePreferredCodec;
22631
+ return shouldRevertSimulcast ? localMidToMediaSectionsWithoutSimulcast.get(mid).replace(/\r\n$/, '') : section;
22082
22632
  })).concat('').join('\r\n');
22083
22633
  }
22084
22634
  /**
@@ -22263,7 +22813,7 @@ exports.disableRtx = disableRtx;
22263
22813
  exports.enableDtxForOpus = enableDtxForOpus;
22264
22814
  exports.getMediaSections = getMediaSections;
22265
22815
  exports.removeSSRCAttributes = removeSSRCAttributes;
22266
- exports.revertSimulcastForNonVP8MediaSections = revertSimulcastForNonVP8MediaSections;
22816
+ exports.revertSimulcast = revertSimulcast;
22267
22817
  exports.setBitrateParameters = setBitrateParameters;
22268
22818
  exports.setCodecPreferences = setCodecPreferences;
22269
22819
  exports.setSimulcast = setSimulcast;
@@ -22271,7 +22821,7 @@ exports.unifiedPlanFilterLocalCodecs = unifiedPlanFilterLocalCodecs;
22271
22821
  exports.unifiedPlanAddOrRewriteNewTrackIds = unifiedPlanAddOrRewriteNewTrackIds;
22272
22822
  exports.unifiedPlanAddOrRewriteTrackIds = unifiedPlanAddOrRewriteTrackIds;
22273
22823
 
22274
- },{"../":126,"./simulcast":136}],135:[function(require,module,exports){
22824
+ },{"../":127,"./simulcast":137}],136:[function(require,module,exports){
22275
22825
  'use strict';
22276
22826
  var RTCSessionDescription = require('@twilio/webrtc').RTCSessionDescription;
22277
22827
  var createPtToCodecName = require('./').createPtToCodecName;
@@ -22465,7 +23015,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
22465
23015
  }
22466
23016
  module.exports = workaround;
22467
23017
 
22468
- },{"./":134,"@twilio/webrtc":151}],136:[function(require,module,exports){
23018
+ },{"./":135,"@twilio/webrtc":153}],137:[function(require,module,exports){
22469
23019
  'use strict';
22470
23020
  var __read = (this && this.__read) || function (o, n) {
22471
23021
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -22751,7 +23301,7 @@ function setSimulcastInMediaSection(section, sdpFormat, trackIdsToAttributes) {
22751
23301
  */
22752
23302
  module.exports = setSimulcastInMediaSection;
22753
23303
 
22754
- },{"../":126}],137:[function(require,module,exports){
23304
+ },{"../":127}],138:[function(require,module,exports){
22755
23305
  'use strict';
22756
23306
  /**
22757
23307
  * An {@link IdentityTrackMatcher} matches RTCTrackEvents with their respective
@@ -22777,7 +23327,7 @@ var IdentityTrackMatcher = /** @class */ (function () {
22777
23327
  }());
22778
23328
  module.exports = IdentityTrackMatcher;
22779
23329
 
22780
- },{}],138:[function(require,module,exports){
23330
+ },{}],139:[function(require,module,exports){
22781
23331
  'use strict';
22782
23332
  var getMediaSections = require('../').getMediaSections;
22783
23333
  /**
@@ -22822,7 +23372,7 @@ var MIDTrackMatcher = /** @class */ (function () {
22822
23372
  }());
22823
23373
  module.exports = MIDTrackMatcher;
22824
23374
 
22825
- },{"../":134}],139:[function(require,module,exports){
23375
+ },{"../":135}],140:[function(require,module,exports){
22826
23376
  'use strict';
22827
23377
  var util = require('../../');
22828
23378
  var getMediaSections = require('../').getMediaSections;
@@ -22934,7 +23484,26 @@ var OrderedTrackMatcher = /** @class */ (function () {
22934
23484
  }());
22935
23485
  module.exports = OrderedTrackMatcher;
22936
23486
 
22937
- },{"../":134,"../../":126}],140:[function(require,module,exports){
23487
+ },{"../":135,"../../":127}],141:[function(require,module,exports){
23488
+ var SID_CHARS = '1234567890abcdef';
23489
+ var SID_CHAR_LENGTH = 32;
23490
+ // copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
23491
+ /**
23492
+ * Generates a random sid using given prefix.
23493
+ * @param {string} prefix
23494
+ * @returns string
23495
+ */
23496
+ function createSID(prefix) {
23497
+ var result = '';
23498
+ for (var i = 0; i < SID_CHAR_LENGTH; i++) {
23499
+ result += SID_CHARS.charAt(Math.floor(Math.random() * SID_CHARS.length));
23500
+ }
23501
+ return "" + prefix + result;
23502
+ }
23503
+ exports.sessionSID = createSID('SS');
23504
+ exports.createSID = createSID;
23505
+
23506
+ },{}],142:[function(require,module,exports){
22938
23507
  'use strict';
22939
23508
  var _a = require('@twilio/webrtc/lib/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
22940
23509
  var _b = require('./browserdetection'), isAndroid = _b.isAndroid, isMobile = _b.isMobile, isNonChromiumEdge = _b.isNonChromiumEdge, rebrandedChromeBrowser = _b.rebrandedChromeBrowser, mobileWebKitBrowser = _b.mobileWebKitBrowser;
@@ -22979,7 +23548,7 @@ function isSupported() {
22979
23548
  }
22980
23549
  module.exports = isSupported;
22981
23550
 
22982
- },{"./browserdetection":118,"@twilio/webrtc/lib/util":164}],141:[function(require,module,exports){
23551
+ },{"./browserdetection":119,"@twilio/webrtc/lib/util":166}],143:[function(require,module,exports){
22983
23552
  'use strict';
22984
23553
  /**
22985
23554
  * A {@link Timeout} represents a resettable and clearable timeout.
@@ -23074,7 +23643,7 @@ var Timeout = /** @class */ (function () {
23074
23643
  }());
23075
23644
  module.exports = Timeout;
23076
23645
 
23077
- },{}],142:[function(require,module,exports){
23646
+ },{}],144:[function(require,module,exports){
23078
23647
  // NOTE: Do not edit this file. This code is auto-generated. Contact the
23079
23648
  // Twilio SDK Team for more information.
23080
23649
  'use strict';
@@ -24098,7 +24667,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
24098
24667
  exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
24099
24668
  Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
24100
24669
 
24101
- },{"./twilioerror":143}],143:[function(require,module,exports){
24670
+ },{"./twilioerror":145}],145:[function(require,module,exports){
24102
24671
  'use strict';
24103
24672
  var __extends = (this && this.__extends) || (function () {
24104
24673
  var extendStatics = function (d, b) {
@@ -24180,7 +24749,7 @@ var TwilioError = /** @class */ (function (_super) {
24180
24749
  }(Error));
24181
24750
  module.exports = TwilioError;
24182
24751
 
24183
- },{}],144:[function(require,module,exports){
24752
+ },{}],146:[function(require,module,exports){
24184
24753
  'use strict';
24185
24754
  var isNonArrayObject = require('./').isNonArrayObject;
24186
24755
  var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
@@ -24297,7 +24866,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
24297
24866
  exports.validateLocalTrack = validateLocalTrack;
24298
24867
  exports.validateObject = validateObject;
24299
24868
 
24300
- },{"./":126,"./constants":120}],145:[function(require,module,exports){
24869
+ },{"./":127,"./constants":121}],147:[function(require,module,exports){
24301
24870
  /**
24302
24871
  * Copyright (c) 2013 Tim Perry
24303
24872
  * Licensed under the MIT license.
@@ -24537,7 +25106,7 @@ defaultLogger.getLoggers = function getLoggers() {
24537
25106
  defaultLogger['default'] = defaultLogger;
24538
25107
  module.exports = defaultLogger;
24539
25108
 
24540
- },{}],146:[function(require,module,exports){
25109
+ },{}],148:[function(require,module,exports){
24541
25110
  /* globals webkitAudioContext, AudioContext */
24542
25111
  'use strict';
24543
25112
  var NativeAudioContext = typeof AudioContext !== 'undefined'
@@ -24620,7 +25189,7 @@ var AudioContextFactory = /** @class */ (function () {
24620
25189
  }());
24621
25190
  module.exports = new AudioContextFactory();
24622
25191
 
24623
- },{}],147:[function(require,module,exports){
25192
+ },{}],149:[function(require,module,exports){
24624
25193
  'use strict';
24625
25194
  /**
24626
25195
  * Return a Promise that resolves after `timeout` milliseconds.
@@ -24673,7 +25242,7 @@ function detectSilence(audioContext, stream, timeout) {
24673
25242
  }
24674
25243
  module.exports = detectSilence;
24675
25244
 
24676
- },{}],148:[function(require,module,exports){
25245
+ },{}],150:[function(require,module,exports){
24677
25246
  'use strict';
24678
25247
  var detectSilence = require('./detectsilence');
24679
25248
  /**
@@ -24743,7 +25312,7 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
24743
25312
  }
24744
25313
  module.exports = workaround;
24745
25314
 
24746
- },{"./audiocontext":146,"./detectsilence":147}],149:[function(require,module,exports){
25315
+ },{"./audiocontext":148,"./detectsilence":149}],151:[function(require,module,exports){
24747
25316
  'use strict';
24748
25317
 
24749
25318
  var flatMap = require('./util').flatMap;
@@ -25204,6 +25773,7 @@ function standardizeChromeOrSafariStats(response) {
25204
25773
  var remoteOutbound = null;
25205
25774
  var track = null;
25206
25775
  var codec = null;
25776
+ var localMedia = null;
25207
25777
 
25208
25778
  response.forEach(function(stat) {
25209
25779
  switch (stat.type) {
@@ -25213,6 +25783,9 @@ function standardizeChromeOrSafariStats(response) {
25213
25783
  case 'outbound-rtp':
25214
25784
  outbound.push(stat);
25215
25785
  break;
25786
+ case 'media-source':
25787
+ localMedia = stat;
25788
+ break;
25216
25789
  case 'track':
25217
25790
  track = stat;
25218
25791
  break;
@@ -25237,6 +25810,7 @@ function standardizeChromeOrSafariStats(response) {
25237
25810
  var standardizedStats = {};
25238
25811
  var statSources = [
25239
25812
  source, // local rtp stats
25813
+ localMedia,
25240
25814
  track,
25241
25815
  codec,
25242
25816
  remoteSource && remoteSource.ssrc === source.ssrc ? remoteSource : null, // remote rtp stats
@@ -25280,6 +25854,7 @@ function standardizeChromeOrSafariStats(response) {
25280
25854
  standardizedStats.frameWidthReceived = frameWidth;
25281
25855
  } else {
25282
25856
  standardizedStats.frameWidthSent = frameWidth;
25857
+ standardizedStats.frameWidthInput = track.frameWidth;
25283
25858
  }
25284
25859
  }
25285
25860
 
@@ -25289,12 +25864,13 @@ function standardizeChromeOrSafariStats(response) {
25289
25864
  standardizedStats.frameHeightReceived = frameHeight;
25290
25865
  } else {
25291
25866
  standardizedStats.frameHeightSent = frameHeight;
25867
+ standardizedStats.frameHeightInput = track.frameHeight;
25292
25868
  }
25293
25869
  }
25294
25870
 
25295
25871
  var framesPerSecond = getStatValue('framesPerSecond');
25296
25872
  if (typeof framesPerSecond === 'number') {
25297
- standardizedStats.frameRateSent = framesPerSecond;
25873
+ standardizedStats[isRemote ? 'frameRateReceived' : 'frameRateSent'] = framesPerSecond;
25298
25874
  }
25299
25875
 
25300
25876
  var bytesReceived = getStatValue('bytesReceived');
@@ -25629,7 +26205,7 @@ function standardizeFirefoxStats(response, isRemote) {
25629
26205
 
25630
26206
  module.exports = getStats;
25631
26207
 
25632
- },{"./util":164,"./util/sdp":166}],150:[function(require,module,exports){
26208
+ },{"./util":166,"./util/sdp":168}],152:[function(require,module,exports){
25633
26209
  /* globals navigator */
25634
26210
  'use strict';
25635
26211
 
@@ -25655,7 +26231,7 @@ function getUserMedia(constraints) {
25655
26231
 
25656
26232
  module.exports = getUserMedia;
25657
26233
 
25658
- },{}],151:[function(require,module,exports){
26234
+ },{}],153:[function(require,module,exports){
25659
26235
  'use strict';
25660
26236
 
25661
26237
  var WebRTC = {};
@@ -25697,7 +26273,7 @@ Object.defineProperties(WebRTC, {
25697
26273
 
25698
26274
  module.exports = WebRTC;
25699
26275
 
25700
- },{"../package.json":167,"./getstats":149,"./getusermedia":150,"./mediastream":152,"./mediastreamtrack":153,"./rtcicecandidate":154,"./rtcpeerconnection":157,"./rtcsessiondescription":162}],152:[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){
25701
26277
  /* globals MediaStream */
25702
26278
  'use strict';
25703
26279
 
@@ -25709,7 +26285,7 @@ if (typeof MediaStream === 'function') {
25709
26285
  };
25710
26286
  }
25711
26287
 
25712
- },{}],153:[function(require,module,exports){
26288
+ },{}],155:[function(require,module,exports){
25713
26289
  /* global MediaStreamTrack */
25714
26290
  'use strict';
25715
26291
 
@@ -25721,7 +26297,7 @@ if (typeof MediaStreamTrack === 'function') {
25721
26297
  };
25722
26298
  }
25723
26299
 
25724
- },{}],154:[function(require,module,exports){
26300
+ },{}],156:[function(require,module,exports){
25725
26301
  /* global RTCIceCandidate */
25726
26302
  'use strict';
25727
26303
 
@@ -25733,7 +26309,7 @@ if (typeof RTCIceCandidate === 'function') {
25733
26309
  };
25734
26310
  }
25735
26311
 
25736
- },{}],155:[function(require,module,exports){
26312
+ },{}],157:[function(require,module,exports){
25737
26313
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
25738
26314
  'use strict';
25739
26315
 
@@ -26297,7 +26873,7 @@ function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
26297
26873
 
26298
26874
  module.exports = ChromeRTCPeerConnection;
26299
26875
 
26300
- },{"../mediastream":152,"../rtcrtpsender":159,"../rtcsessiondescription/chrome":160,"../util":164,"../util/eventtarget":163,"../util/latch":165,"../util/sdp":166,"util":197}],156:[function(require,module,exports){
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){
26301
26877
  /* globals RTCPeerConnection */
26302
26878
  'use strict';
26303
26879
 
@@ -26630,7 +27206,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
26630
27206
 
26631
27207
  module.exports = FirefoxRTCPeerConnection;
26632
27208
 
26633
- },{"../rtcsessiondescription/firefox":161,"../util":164,"../util/eventtarget":163,"../util/sdp":166,"util":197}],157:[function(require,module,exports){
27209
+ },{"../rtcsessiondescription/firefox":163,"../util":166,"../util/eventtarget":165,"../util/sdp":168,"util":199}],159:[function(require,module,exports){
26634
27210
  'use strict';
26635
27211
 
26636
27212
  if (typeof RTCPeerConnection === 'function') {
@@ -26655,7 +27231,7 @@ if (typeof RTCPeerConnection === 'function') {
26655
27231
  };
26656
27232
  }
26657
27233
 
26658
- },{"../util":164,"./chrome":155,"./firefox":156,"./safari":158}],158:[function(require,module,exports){
27234
+ },{"../util":166,"./chrome":157,"./firefox":158,"./safari":160}],160:[function(require,module,exports){
26659
27235
  /* globals RTCPeerConnection, RTCSessionDescription */
26660
27236
  'use strict';
26661
27237
 
@@ -27046,7 +27622,7 @@ function shimDataChannel(dataChannel) {
27046
27622
 
27047
27623
  module.exports = SafariRTCPeerConnection;
27048
27624
 
27049
- },{"../util":164,"../util/eventtarget":163,"../util/latch":165,"../util/sdp":166,"util":197}],159:[function(require,module,exports){
27625
+ },{"../util":166,"../util/eventtarget":165,"../util/latch":167,"../util/sdp":168,"util":199}],161:[function(require,module,exports){
27050
27626
  'use strict';
27051
27627
 
27052
27628
  /**
@@ -27087,7 +27663,7 @@ function RTCRtpSenderShim(track) {
27087
27663
 
27088
27664
  module.exports = RTCRtpSenderShim;
27089
27665
 
27090
- },{}],160:[function(require,module,exports){
27666
+ },{}],162:[function(require,module,exports){
27091
27667
  /* globals RTCSessionDescription */
27092
27668
  'use strict';
27093
27669
 
@@ -27128,13 +27704,13 @@ function ChromeRTCSessionDescription(descriptionInitDict) {
27128
27704
 
27129
27705
  module.exports = ChromeRTCSessionDescription;
27130
27706
 
27131
- },{}],161:[function(require,module,exports){
27707
+ },{}],163:[function(require,module,exports){
27132
27708
  /* globals RTCSessionDescription */
27133
27709
  'use strict';
27134
27710
 
27135
27711
  module.exports = RTCSessionDescription;
27136
27712
 
27137
- },{}],162:[function(require,module,exports){
27713
+ },{}],164:[function(require,module,exports){
27138
27714
  /* globals RTCSessionDescription */
27139
27715
  'use strict';
27140
27716
 
@@ -27157,7 +27733,7 @@ if (typeof RTCSessionDescription === 'function') {
27157
27733
  };
27158
27734
  }
27159
27735
 
27160
- },{"../util":164,"./chrome":160,"./firefox":161}],163:[function(require,module,exports){
27736
+ },{"../util":166,"./chrome":162,"./firefox":163}],165:[function(require,module,exports){
27161
27737
  'use strict';
27162
27738
 
27163
27739
  var EventEmitter = require('events').EventEmitter;
@@ -27198,7 +27774,7 @@ EventTarget.prototype.removeEventListener = function removeEventListener() {
27198
27774
 
27199
27775
  module.exports = EventTarget;
27200
27776
 
27201
- },{"events":178}],164:[function(require,module,exports){
27777
+ },{"events":180}],166:[function(require,module,exports){
27202
27778
  'use strict';
27203
27779
 
27204
27780
  /**
@@ -27535,7 +28111,7 @@ exports.makeUUID = makeUUID;
27535
28111
  exports.proxyProperties = proxyProperties;
27536
28112
  exports.support = support;
27537
28113
 
27538
- },{}],165:[function(require,module,exports){
28114
+ },{}],167:[function(require,module,exports){
27539
28115
  'use strict';
27540
28116
 
27541
28117
  var defer = require('./').defer;
@@ -27650,7 +28226,7 @@ function createUnreachableStateError(from, to) {
27650
28226
 
27651
28227
  module.exports = Latch;
27652
28228
 
27653
- },{"./":164}],166:[function(require,module,exports){
28229
+ },{"./":166}],168:[function(require,module,exports){
27654
28230
  /* globals RTCPeerConnection, RTCRtpTransceiver */
27655
28231
 
27656
28232
  'use strict';
@@ -27960,56 +28536,43 @@ exports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;
27960
28536
  exports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;
27961
28537
  exports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;
27962
28538
 
27963
- },{"./":164}],167:[function(require,module,exports){
28539
+ },{"./":166}],169:[function(require,module,exports){
27964
28540
  module.exports={
27965
- "_from": "@twilio/webrtc@4.5.1",
27966
- "_id": "@twilio/webrtc@4.5.1",
27967
- "_inBundle": false,
27968
- "_integrity": "sha512-0GwnffxJ71jm/7sYD8MYHzZRCR59p7KYqiMO8/Fmny7S4L0s8Ms36ghUUfCE7x/XuWjAC4FU6L/DkFN1Ewuu8Q==",
27969
- "_location": "/@twilio/webrtc",
27970
- "_phantomChildren": {},
27971
- "_requested": {
27972
- "type": "version",
27973
- "registry": true,
27974
- "raw": "@twilio/webrtc@4.5.1",
27975
- "name": "@twilio/webrtc",
27976
- "escapedName": "@twilio%2fwebrtc",
27977
- "scope": "@twilio",
27978
- "rawSpec": "4.5.1",
27979
- "saveSpec": null,
27980
- "fetchSpec": "4.5.1"
28541
+ "name": "@twilio/webrtc",
28542
+ "version": "4.5.2",
28543
+ "description": "WebRTC-related APIs and shims used by twilio-video.js",
28544
+ "scripts": {
28545
+ "build": "npm-run-all clean lint test",
28546
+ "clean": "rimraf coverage",
28547
+ "lint": "eslint ./lib",
28548
+ "test:unit": "istanbul cover node_modules/mocha/bin/_mocha -- ./test/unit/index.js",
28549
+ "test:integration:native": "karma start karma/integration.conf.js",
28550
+ "test:integration:adapter": "karma start karma/integration.adapter.conf.js",
28551
+ "test:integration": "npm-run-all test:integration:*",
28552
+ "test": "npm-run-all test:*"
27981
28553
  },
27982
- "_requiredBy": [
27983
- "/"
27984
- ],
27985
- "_resolved": "https://registry.npmjs.org/@twilio/webrtc/-/webrtc-4.5.1.tgz",
27986
- "_shasum": "9a69b8f3709624b215e9481097626b1d3ae879ba",
27987
- "_spec": "@twilio/webrtc@4.5.1",
27988
- "_where": "/home/circleci/project",
27989
- "author": {
27990
- "name": "Manjesh Malavalli",
27991
- "email": "mmalavalli@twilio.com"
28554
+ "repository": {
28555
+ "type": "git",
28556
+ "url": "git+https://github.com/twilio/twilio-webrtc.js.git"
27992
28557
  },
28558
+ "keywords": [
28559
+ "shim",
28560
+ "twilio",
28561
+ "video",
28562
+ "webrtc"
28563
+ ],
28564
+ "author": "Manjesh Malavalli <mmalavalli@twilio.com>",
28565
+ "contributors": [
28566
+ "Mark Roberts <mroberts@twilio.com>",
28567
+ "Ryan Rowland <rrowland@twilio.com>",
28568
+ "Makarand Patwardhan <mpatwardhan@twilio.com>"
28569
+ ],
28570
+ "license": "BSD-3-Clause",
28571
+ "main": "./lib/index.js",
27993
28572
  "bugs": {
27994
28573
  "url": "https://github.com/twilio/twilio-webrtc.js/issues"
27995
28574
  },
27996
- "bundleDependencies": false,
27997
- "contributors": [
27998
- {
27999
- "name": "Mark Roberts",
28000
- "email": "mroberts@twilio.com"
28001
- },
28002
- {
28003
- "name": "Ryan Rowland",
28004
- "email": "rrowland@twilio.com"
28005
- },
28006
- {
28007
- "name": "Makarand Patwardhan",
28008
- "email": "mpatwardhan@twilio.com"
28009
- }
28010
- ],
28011
- "deprecated": false,
28012
- "description": "WebRTC-related APIs and shims used by twilio-video.js",
28575
+ "homepage": "https://github.com/twilio/twilio-webrtc.js#readme",
28013
28576
  "devDependencies": {
28014
28577
  "browserify": "^14.4.0",
28015
28578
  "electron": "9.4.0",
@@ -28035,35 +28598,10 @@ module.exports={
28035
28598
  "twilio-release-tool": "^1.0.0",
28036
28599
  "watchify": "^4.0.0",
28037
28600
  "webrtc-adapter": "^6.4.8"
28038
- },
28039
- "homepage": "https://github.com/twilio/twilio-webrtc.js#readme",
28040
- "keywords": [
28041
- "shim",
28042
- "twilio",
28043
- "video",
28044
- "webrtc"
28045
- ],
28046
- "license": "BSD-3-Clause",
28047
- "main": "./lib/index.js",
28048
- "name": "@twilio/webrtc",
28049
- "repository": {
28050
- "type": "git",
28051
- "url": "git+https://github.com/twilio/twilio-webrtc.js.git"
28052
- },
28053
- "scripts": {
28054
- "build": "npm-run-all clean lint test",
28055
- "clean": "rimraf coverage",
28056
- "lint": "eslint ./lib",
28057
- "test": "npm-run-all test:*",
28058
- "test:integration": "npm-run-all test:integration:*",
28059
- "test:integration:adapter": "karma start karma/integration.adapter.conf.js",
28060
- "test:integration:native": "karma start karma/integration.conf.js",
28061
- "test:unit": "istanbul cover node_modules/mocha/bin/_mocha -- ./test/unit/index.js"
28062
- },
28063
- "version": "4.5.1"
28601
+ }
28064
28602
  }
28065
28603
 
28066
- },{}],168:[function(require,module,exports){
28604
+ },{}],170:[function(require,module,exports){
28067
28605
  (function (global){(function (){
28068
28606
  'use strict';
28069
28607
 
@@ -28094,7 +28632,7 @@ module.exports = function availableTypedArrays() {
28094
28632
  };
28095
28633
 
28096
28634
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28097
- },{}],169:[function(require,module,exports){
28635
+ },{}],171:[function(require,module,exports){
28098
28636
  // Copyright (c) 2012 Mathieu Turcotte
28099
28637
  // Licensed under the MIT license.
28100
28638
 
@@ -28127,7 +28665,7 @@ module.exports.call = function(fn, vargs, callback) {
28127
28665
  return new FunctionCall(fn, vargs, callback);
28128
28666
  };
28129
28667
 
28130
- },{"./lib/backoff":170,"./lib/function_call.js":171,"./lib/strategy/exponential":172,"./lib/strategy/fibonacci":173}],170:[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){
28131
28669
  // Copyright (c) 2012 Mathieu Turcotte
28132
28670
  // Licensed under the MIT license.
28133
28671
 
@@ -28194,7 +28732,7 @@ Backoff.prototype.reset = function() {
28194
28732
 
28195
28733
  module.exports = Backoff;
28196
28734
 
28197
- },{"events":178,"precond":191,"util":197}],171:[function(require,module,exports){
28735
+ },{"events":180,"precond":193,"util":199}],173:[function(require,module,exports){
28198
28736
  // Copyright (c) 2012 Mathieu Turcotte
28199
28737
  // Licensed under the MIT license.
28200
28738
 
@@ -28386,7 +28924,7 @@ FunctionCall.prototype.handleBackoff_ = function(number, delay, err) {
28386
28924
 
28387
28925
  module.exports = FunctionCall;
28388
28926
 
28389
- },{"./backoff":170,"./strategy/fibonacci":173,"events":178,"precond":191,"util":197}],172:[function(require,module,exports){
28927
+ },{"./backoff":172,"./strategy/fibonacci":175,"events":180,"precond":193,"util":199}],174:[function(require,module,exports){
28390
28928
  // Copyright (c) 2012 Mathieu Turcotte
28391
28929
  // Licensed under the MIT license.
28392
28930
 
@@ -28429,7 +28967,7 @@ ExponentialBackoffStrategy.prototype.reset_ = function() {
28429
28967
 
28430
28968
  module.exports = ExponentialBackoffStrategy;
28431
28969
 
28432
- },{"./strategy":174,"precond":191,"util":197}],173:[function(require,module,exports){
28970
+ },{"./strategy":176,"precond":193,"util":199}],175:[function(require,module,exports){
28433
28971
  // Copyright (c) 2012 Mathieu Turcotte
28434
28972
  // Licensed under the MIT license.
28435
28973
 
@@ -28459,7 +28997,7 @@ FibonacciBackoffStrategy.prototype.reset_ = function() {
28459
28997
 
28460
28998
  module.exports = FibonacciBackoffStrategy;
28461
28999
 
28462
- },{"./strategy":174,"util":197}],174:[function(require,module,exports){
29000
+ },{"./strategy":176,"util":199}],176:[function(require,module,exports){
28463
29001
  // Copyright (c) 2012 Mathieu Turcotte
28464
29002
  // Licensed under the MIT license.
28465
29003
 
@@ -28541,7 +29079,7 @@ BackoffStrategy.prototype.reset_ = function() {
28541
29079
 
28542
29080
  module.exports = BackoffStrategy;
28543
29081
 
28544
- },{"events":178,"util":197}],175:[function(require,module,exports){
29082
+ },{"events":180,"util":199}],177:[function(require,module,exports){
28545
29083
  'use strict';
28546
29084
 
28547
29085
  var GetIntrinsic = require('get-intrinsic');
@@ -28558,7 +29096,7 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
28558
29096
  return intrinsic;
28559
29097
  };
28560
29098
 
28561
- },{"./":176,"get-intrinsic":182}],176:[function(require,module,exports){
29099
+ },{"./":178,"get-intrinsic":184}],178:[function(require,module,exports){
28562
29100
  'use strict';
28563
29101
 
28564
29102
  var bind = require('function-bind');
@@ -28607,7 +29145,7 @@ if ($defineProperty) {
28607
29145
  module.exports.apply = applyBind;
28608
29146
  }
28609
29147
 
28610
- },{"function-bind":181,"get-intrinsic":182}],177:[function(require,module,exports){
29148
+ },{"function-bind":183,"get-intrinsic":184}],179:[function(require,module,exports){
28611
29149
  'use strict';
28612
29150
 
28613
29151
  var GetIntrinsic = require('get-intrinsic');
@@ -28624,7 +29162,7 @@ if ($gOPD) {
28624
29162
 
28625
29163
  module.exports = $gOPD;
28626
29164
 
28627
- },{"get-intrinsic":182}],178:[function(require,module,exports){
29165
+ },{"get-intrinsic":184}],180:[function(require,module,exports){
28628
29166
  // Copyright Joyent, Inc. and other Node contributors.
28629
29167
  //
28630
29168
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -29123,7 +29661,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
29123
29661
  }
29124
29662
  }
29125
29663
 
29126
- },{}],179:[function(require,module,exports){
29664
+ },{}],181:[function(require,module,exports){
29127
29665
 
29128
29666
  var hasOwn = Object.prototype.hasOwnProperty;
29129
29667
  var toString = Object.prototype.toString;
@@ -29147,7 +29685,7 @@ module.exports = function forEach (obj, fn, ctx) {
29147
29685
  };
29148
29686
 
29149
29687
 
29150
- },{}],180:[function(require,module,exports){
29688
+ },{}],182:[function(require,module,exports){
29151
29689
  'use strict';
29152
29690
 
29153
29691
  /* eslint no-invalid-this: 1 */
@@ -29201,14 +29739,14 @@ module.exports = function bind(that) {
29201
29739
  return bound;
29202
29740
  };
29203
29741
 
29204
- },{}],181:[function(require,module,exports){
29742
+ },{}],183:[function(require,module,exports){
29205
29743
  'use strict';
29206
29744
 
29207
29745
  var implementation = require('./implementation');
29208
29746
 
29209
29747
  module.exports = Function.prototype.bind || implementation;
29210
29748
 
29211
- },{"./implementation":180}],182:[function(require,module,exports){
29749
+ },{"./implementation":182}],184:[function(require,module,exports){
29212
29750
  'use strict';
29213
29751
 
29214
29752
  var undefined;
@@ -29540,7 +30078,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
29540
30078
  return value;
29541
30079
  };
29542
30080
 
29543
- },{"function-bind":181,"has":186,"has-symbols":183}],183:[function(require,module,exports){
30081
+ },{"function-bind":183,"has":188,"has-symbols":185}],185:[function(require,module,exports){
29544
30082
  'use strict';
29545
30083
 
29546
30084
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
@@ -29555,7 +30093,7 @@ module.exports = function hasNativeSymbols() {
29555
30093
  return hasSymbolSham();
29556
30094
  };
29557
30095
 
29558
- },{"./shams":184}],184:[function(require,module,exports){
30096
+ },{"./shams":186}],186:[function(require,module,exports){
29559
30097
  'use strict';
29560
30098
 
29561
30099
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -29599,7 +30137,7 @@ module.exports = function hasSymbols() {
29599
30137
  return true;
29600
30138
  };
29601
30139
 
29602
- },{}],185:[function(require,module,exports){
30140
+ },{}],187:[function(require,module,exports){
29603
30141
  'use strict';
29604
30142
 
29605
30143
  var hasSymbols = require('has-symbols/shams');
@@ -29608,14 +30146,14 @@ module.exports = function hasToStringTagShams() {
29608
30146
  return hasSymbols() && !!Symbol.toStringTag;
29609
30147
  };
29610
30148
 
29611
- },{"has-symbols/shams":184}],186:[function(require,module,exports){
30149
+ },{"has-symbols/shams":186}],188:[function(require,module,exports){
29612
30150
  'use strict';
29613
30151
 
29614
30152
  var bind = require('function-bind');
29615
30153
 
29616
30154
  module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
29617
30155
 
29618
- },{"function-bind":181}],187:[function(require,module,exports){
30156
+ },{"function-bind":183}],189:[function(require,module,exports){
29619
30157
  if (typeof Object.create === 'function') {
29620
30158
  // implementation from standard node.js 'util' module
29621
30159
  module.exports = function inherits(ctor, superCtor) {
@@ -29644,7 +30182,7 @@ if (typeof Object.create === 'function') {
29644
30182
  }
29645
30183
  }
29646
30184
 
29647
- },{}],188:[function(require,module,exports){
30185
+ },{}],190:[function(require,module,exports){
29648
30186
  'use strict';
29649
30187
 
29650
30188
  var hasToStringTag = require('has-tostringtag/shams')();
@@ -29679,7 +30217,7 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
29679
30217
 
29680
30218
  module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
29681
30219
 
29682
- },{"call-bind/callBound":175,"has-tostringtag/shams":185}],189:[function(require,module,exports){
30220
+ },{"call-bind/callBound":177,"has-tostringtag/shams":187}],191:[function(require,module,exports){
29683
30221
  'use strict';
29684
30222
 
29685
30223
  var toStr = Object.prototype.toString;
@@ -29719,7 +30257,7 @@ module.exports = function isGeneratorFunction(fn) {
29719
30257
  return getProto(fn) === GeneratorFunction;
29720
30258
  };
29721
30259
 
29722
- },{"has-tostringtag/shams":185}],190:[function(require,module,exports){
30260
+ },{"has-tostringtag/shams":187}],192:[function(require,module,exports){
29723
30261
  (function (global){(function (){
29724
30262
  'use strict';
29725
30263
 
@@ -29783,14 +30321,14 @@ module.exports = function isTypedArray(value) {
29783
30321
  };
29784
30322
 
29785
30323
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
29786
- },{"available-typed-arrays":168,"call-bind/callBound":175,"es-abstract/helpers/getOwnPropertyDescriptor":177,"foreach":179,"has-tostringtag/shams":185}],191:[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){
29787
30325
  /*
29788
30326
  * Copyright (c) 2012 Mathieu Turcotte
29789
30327
  * Licensed under the MIT license.
29790
30328
  */
29791
30329
 
29792
30330
  module.exports = require('./lib/checks');
29793
- },{"./lib/checks":192}],192:[function(require,module,exports){
30331
+ },{"./lib/checks":194}],194:[function(require,module,exports){
29794
30332
  /*
29795
30333
  * Copyright (c) 2012 Mathieu Turcotte
29796
30334
  * Licensed under the MIT license.
@@ -29886,7 +30424,7 @@ module.exports.checkIsBoolean = typeCheck('boolean');
29886
30424
  module.exports.checkIsFunction = typeCheck('function');
29887
30425
  module.exports.checkIsObject = typeCheck('object');
29888
30426
 
29889
- },{"./errors":193,"util":197}],193:[function(require,module,exports){
30427
+ },{"./errors":195,"util":199}],195:[function(require,module,exports){
29890
30428
  /*
29891
30429
  * Copyright (c) 2012 Mathieu Turcotte
29892
30430
  * Licensed under the MIT license.
@@ -29912,7 +30450,7 @@ IllegalStateError.prototype.name = 'IllegalStateError';
29912
30450
 
29913
30451
  module.exports.IllegalStateError = IllegalStateError;
29914
30452
  module.exports.IllegalArgumentError = IllegalArgumentError;
29915
- },{"util":197}],194:[function(require,module,exports){
30453
+ },{"util":199}],196:[function(require,module,exports){
29916
30454
  // shim for using process in browser
29917
30455
  var process = module.exports = {};
29918
30456
 
@@ -30098,14 +30636,14 @@ process.chdir = function (dir) {
30098
30636
  };
30099
30637
  process.umask = function() { return 0; };
30100
30638
 
30101
- },{}],195:[function(require,module,exports){
30639
+ },{}],197:[function(require,module,exports){
30102
30640
  module.exports = function isBuffer(arg) {
30103
30641
  return arg && typeof arg === 'object'
30104
30642
  && typeof arg.copy === 'function'
30105
30643
  && typeof arg.fill === 'function'
30106
30644
  && typeof arg.readUInt8 === 'function';
30107
30645
  }
30108
- },{}],196:[function(require,module,exports){
30646
+ },{}],198:[function(require,module,exports){
30109
30647
  // Currently in sync with Node.js lib/internal/util/types.js
30110
30648
  // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
30111
30649
 
@@ -30441,7 +30979,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer;
30441
30979
  });
30442
30980
  });
30443
30981
 
30444
- },{"is-arguments":188,"is-generator-function":189,"is-typed-array":190,"which-typed-array":198}],197:[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){
30445
30983
  (function (process){(function (){
30446
30984
  // Copyright Joyent, Inc. and other Node contributors.
30447
30985
  //
@@ -31160,7 +31698,7 @@ function callbackify(original) {
31160
31698
  exports.callbackify = callbackify;
31161
31699
 
31162
31700
  }).call(this)}).call(this,require('_process'))
31163
- },{"./support/isBuffer":195,"./support/types":196,"_process":194,"inherits":187}],198:[function(require,module,exports){
31701
+ },{"./support/isBuffer":197,"./support/types":198,"_process":196,"inherits":189}],200:[function(require,module,exports){
31164
31702
  (function (global){(function (){
31165
31703
  'use strict';
31166
31704
 
@@ -31219,12 +31757,12 @@ module.exports = function whichTypedArray(value) {
31219
31757
  };
31220
31758
 
31221
31759
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
31222
- },{"available-typed-arrays":168,"call-bind/callBound":175,"es-abstract/helpers/getOwnPropertyDescriptor":177,"foreach":179,"has-tostringtag/shams":185,"is-typed-array":190}],199:[function(require,module,exports){
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){
31223
31761
  module.exports={
31224
31762
  "name": "twilio-video",
31225
31763
  "title": "Twilio Video",
31226
31764
  "description": "Twilio Video JavaScript Library",
31227
- "version": "2.18.0",
31765
+ "version": "2.19.0",
31228
31766
  "homepage": "https://twilio.com",
31229
31767
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
31230
31768
  "contributors": [
@@ -31319,7 +31857,8 @@ module.exports={
31319
31857
  "lint:js": "eslint ./lib ./test/*.js ./docker/**/*.js ./test/framework/*.js ./test/lib/*.js ./test/integration/** ./test/unit/** ",
31320
31858
  "lint:ts": "eslint ./tsdef/*.ts ./lib/**/*.ts",
31321
31859
  "lint": "npm-run-all lint:js lint:ts",
31322
- "test:unit": "npm-run-all build:es5 test:unit:js test:unit:ts",
31860
+ "printVersion": "node --version && npm --version",
31861
+ "test:unit": "npm-run-all printVersion build:es5 test:unit:js test:unit:ts",
31323
31862
  "test:unit:js": "nyc --report-dir=./coverage/js --extension=.js --include=lib/**/* --reporter=html --reporter=lcov --reporter=text mocha ./test/unit/index.js",
31324
31863
  "test:unit:ts": "nyc --report-dir=./coverage/ts --extension=.ts --include=lib/**/* --reporter=html --reporter=lcov --reporter=text mocha -r ts-node/register ./test/unit/index.ts",
31325
31864
  "test:serversiderender": "mocha ./test/serversiderender/index.js",
@@ -31357,7 +31896,7 @@ module.exports={
31357
31896
  "test:framework:install": "npm install chromedriver && npm install selenium-webdriver && npm install geckodriver && npm install puppeteer",
31358
31897
  "test:framework": "npm-run-all test:framework:install test:framework:no-framework test:framework:react",
31359
31898
  "test": "npm-run-all test:unit test:integration",
31360
- "build:es5": "rimraf ./es5 && tsc tsdef/twilio-video-tests.ts --noEmit && tsc",
31899
+ "build:es5": "rimraf ./es5 && tsc tsdef/twilio-video-tests.ts --noEmit --lib es2018,dom && tsc ",
31361
31900
  "build:js": "node ./scripts/build.js ./src/twilio-video.js ./LICENSE.md ./dist/twilio-video.js",
31362
31901
  "build:min.js": "uglifyjs ./dist/twilio-video.js -o ./dist/twilio-video.min.js --comments \"/^! twilio-video.js/\" -b beautify=false,ascii_only=true",
31363
31902
  "build": "npm-run-all clean lint docs test:unit test:integration build:es5 build:js build:min.js test:umd",
@@ -31367,7 +31906,7 @@ module.exports={
31367
31906
  "clean": "rimraf ./coverage ./es5 ./dist"
31368
31907
  },
31369
31908
  "dependencies": {
31370
- "@twilio/webrtc": "4.5.1",
31909
+ "@twilio/webrtc": "4.5.2",
31371
31910
  "backoff": "^2.5.0",
31372
31911
  "ws": "^7.4.6",
31373
31912
  "xmlhttprequest": "^1.8.0"
@@ -31378,7 +31917,7 @@ module.exports={
31378
31917
  }
31379
31918
  }
31380
31919
 
31381
- },{}],200:[function(require,module,exports){
31920
+ },{}],202:[function(require,module,exports){
31382
31921
  module.exports = WebSocket;
31383
31922
 
31384
31923
  },{}]},{},[11]);