twilio-video 2.17.0 → 2.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/COMMON_ISSUES.md +130 -0
  3. package/README.md +24 -15
  4. package/dist/twilio-video.js +361 -220
  5. package/dist/twilio-video.min.js +22 -21
  6. package/es5/connect.js +13 -2
  7. package/es5/connect.js.map +1 -1
  8. package/es5/media/track/localmediatrack.js +2 -0
  9. package/es5/media/track/localmediatrack.js.map +1 -1
  10. package/es5/media/track/remotevideotrack.js +68 -14
  11. package/es5/media/track/remotevideotrack.js.map +1 -1
  12. package/es5/preflight/getCombinedConnectionStats.js +0 -1
  13. package/es5/preflight/getCombinedConnectionStats.js.map +1 -1
  14. package/es5/preflight/getturncredentials.js +2 -16
  15. package/es5/preflight/getturncredentials.js.map +1 -1
  16. package/es5/preflight/makestat.js +1 -1
  17. package/es5/preflight/makestat.js.map +1 -1
  18. package/es5/preflight/preflighttest.js +83 -11
  19. package/es5/preflight/preflighttest.js.map +1 -1
  20. package/es5/signaling/v2/cancelableroomsignalingpromise.js +2 -9
  21. package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
  22. package/es5/signaling/v2/mediasignaling.js +2 -4
  23. package/es5/signaling/v2/mediasignaling.js.map +1 -1
  24. package/es5/signaling/v2/peerconnection.js +4 -2
  25. package/es5/signaling/v2/peerconnection.js.map +1 -1
  26. package/es5/signaling/v2/twilioconnectiontransport.js +3 -27
  27. package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
  28. package/es5/util/constants.js +3 -0
  29. package/es5/util/constants.js.map +1 -1
  30. package/es5/util/eventobserver.js +9 -19
  31. package/es5/util/eventobserver.js.map +1 -1
  32. package/es5/util/index.js +2 -0
  33. package/es5/util/index.js.map +1 -1
  34. package/es5/util/sid.js +18 -0
  35. package/es5/util/sid.js.map +1 -0
  36. package/es5/util/twilio-video-errors.js +38 -5
  37. package/es5/util/twilio-video-errors.js.map +1 -1
  38. package/lib/connect.js +21 -2
  39. package/lib/media/track/localmediatrack.js +2 -0
  40. package/lib/media/track/remotevideotrack.js +74 -14
  41. package/lib/preflight/getCombinedConnectionStats.ts +0 -1
  42. package/lib/preflight/getturncredentials.ts +2 -12
  43. package/lib/preflight/makestat.ts +2 -2
  44. package/lib/preflight/preflighttest.ts +107 -13
  45. package/lib/signaling/v2/cancelableroomsignalingpromise.js +1 -12
  46. package/lib/signaling/v2/mediasignaling.js +2 -5
  47. package/lib/signaling/v2/peerconnection.js +4 -2
  48. package/lib/signaling/v2/twilioconnectiontransport.js +1 -31
  49. package/lib/util/constants.js +3 -0
  50. package/lib/util/eventobserver.js +10 -22
  51. package/lib/util/index.js +3 -0
  52. package/lib/util/sid.js +20 -0
  53. package/lib/util/twilio-video-errors.js +37 -5
  54. package/package.json +4 -3
  55. package/tsconfig.json +1 -1
  56. package/tsdef/PreflightTypes.d.ts +1 -2
@@ -1,4 +1,4 @@
1
- /*! twilio-video.js 2.17.0
1
+ /*! twilio-video.js 2.18.2
2
2
 
3
3
  The following license applies to all parts of this software except as
4
4
  documented below.
@@ -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');
@@ -298,8 +300,14 @@ function connect(token, options) {
298
300
  signaling: SignalingV2
299
301
  }, filterObject(options));
300
302
  /* eslint new-cap:0 */
303
+ var eventPublisherOptions = {};
304
+ if (typeof options.wsServerInsights === 'string') {
305
+ eventPublisherOptions.gateway = options.wsServerInsights;
306
+ }
307
+ var EventPublisher = options.insights ? InsightsPublisher : NullInsightsPublisher;
308
+ var eventPublisher = new EventPublisher(token, SDK_NAME, SDK_VERSION, options.environment, options.realm, eventPublisherOptions);
301
309
  var wsServer = WS_SERVER(options.environment, options.region);
302
- var eventObserver = new EventObserver(Date.now(), log, options.eventListener);
310
+ var eventObserver = new EventObserver(eventPublisher, Date.now(), log, options.eventListener);
303
311
  options = Object.assign({ eventObserver: eventObserver, wsServer: wsServer }, options);
304
312
  options.log = log;
305
313
  // NOTE(mroberts): Print the Safari warning once if the log-level is at least
@@ -399,11 +407,14 @@ function connect(token, options) {
399
407
  // 4 - Create the Room and then resolve the CancelablePromise.
400
408
  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
409
  cancelableRoomPromise.then(function (room) {
410
+ eventPublisher.connect(room.sid, room.localParticipant.sid);
402
411
  log.info('Connected to Room:', room.toString());
403
412
  log.info('Room name:', room.name);
404
413
  log.debug('Room:', room);
414
+ room.once('disconnected', function () { return eventPublisher.disconnect(); });
405
415
  return room;
406
416
  }, function (error) {
417
+ eventPublisher.disconnect();
407
418
  if (cancelableRoomPromise._isCanceled) {
408
419
  log.info('Attempt to connect to a Room was canceled');
409
420
  }
@@ -960,7 +971,7 @@ function normalizeCodecSettings(nameOrSettings) {
960
971
  }
961
972
  module.exports = connect;
962
973
 
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){
974
+ },{"./cancelableroompromise":1,"./createlocaltracks":4,"./encodingparameters":9,"./localparticipant":12,"./media/track/es5":14,"./networkqualityconfiguration":42,"./room":54,"./signaling/v2":68,"./util":126,"./util/cancelablepromise":119,"./util/constants":120,"./util/eventobserver":124,"./util/insightspublisher":127,"./util/insightspublisher/null":128,"./util/log":130,"./util/validate":145,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],3:[function(require,module,exports){
964
975
  'use strict';
965
976
  var defaultCreateLocalTracks = require('./createlocaltracks');
966
977
  var _a = require('./util/constants'), DEFAULT_LOG_LEVEL = _a.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _a.DEFAULT_LOGGER_NAME;
@@ -1234,7 +1245,7 @@ function createLocalTracks(options) {
1234
1245
  */
1235
1246
  module.exports = createLocalTracks;
1236
1247
 
1237
- },{"./media/track/es5":14,"./util":126,"./util/constants":120,"./util/log":130,"./webaudio/workaround180748":148,"@twilio/webrtc":151}],5:[function(require,module,exports){
1248
+ },{"./media/track/es5":14,"./util":126,"./util/constants":120,"./util/log":130,"./webaudio/workaround180748":149,"@twilio/webrtc":152}],5:[function(require,module,exports){
1238
1249
  'use strict';
1239
1250
  var __extends = (this && this.__extends) || (function () {
1240
1251
  var extendStatics = function (d, b) {
@@ -1590,7 +1601,7 @@ var DataTransport = /** @class */ (function (_super) {
1590
1601
  */
1591
1602
  module.exports = DataTransport;
1592
1603
 
1593
- },{"events":178}],9:[function(require,module,exports){
1604
+ },{"events":179}],9:[function(require,module,exports){
1594
1605
  'use strict';
1595
1606
  var __extends = (this && this.__extends) || (function () {
1596
1607
  var extendStatics = function (d, b) {
@@ -1684,13 +1695,13 @@ var EncodingParametersImpl = /** @class */ (function (_super) {
1684
1695
  */
1685
1696
  module.exports = EncodingParametersImpl;
1686
1697
 
1687
- },{"events":178}],10:[function(require,module,exports){
1698
+ },{"events":179}],10:[function(require,module,exports){
1688
1699
  'use strict';
1689
1700
  var EventEmitter = require('events').EventEmitter;
1690
1701
  var hidePrivateAndCertainPublicPropertiesInClass = require('./util').hidePrivateAndCertainPublicPropertiesInClass;
1691
1702
  module.exports = hidePrivateAndCertainPublicPropertiesInClass(EventEmitter, ['domain']);
1692
1703
 
1693
- },{"./util":126,"events":178}],11:[function(require,module,exports){
1704
+ },{"./util":126,"events":179}],11:[function(require,module,exports){
1694
1705
  'use strict';
1695
1706
  Object.defineProperty(exports, "__esModule", { value: true });
1696
1707
  var preflighttest_1 = require("./preflight/preflighttest");
@@ -1753,7 +1764,7 @@ module.exports = {
1753
1764
  LocalDataTrack: LocalDataTrack
1754
1765
  };
1755
1766
 
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){
1767
+ },{"../package.json":200,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":48,"./util/support":141,"./vendor/loglevel":146}],12:[function(require,module,exports){
1757
1768
  'use strict';
1758
1769
  var __extends = (this && this.__extends) || (function () {
1759
1770
  var extendStatics = function (d, b) {
@@ -2428,7 +2439,7 @@ function getTrackPublication(trackPublications, track) {
2428
2439
  }
2429
2440
  module.exports = LocalParticipant;
2430
2441
 
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){
2442
+ },{"./media/track/es5":14,"./media/track/localaudiotrackpublication":20,"./media/track/localdatatrackpublication":22,"./media/track/localvideotrackpublication":26,"./participant":43,"./util":126,"./util/constants":120,"./util/validate":145,"@twilio/webrtc":152}],13:[function(require,module,exports){
2432
2443
  'use strict';
2433
2444
  var __extends = (this && this.__extends) || (function () {
2434
2445
  var extendStatics = function (d, b) {
@@ -2617,7 +2628,7 @@ function LocalAudioTrack(mediaStreamTrack, options) {
2617
2628
  inherits(LocalAudioTrack, LocalAudioTrackClass);
2618
2629
  module.exports = LocalAudioTrack;
2619
2630
 
2620
- },{"../localaudiotrack":19,"util":197}],16:[function(require,module,exports){
2631
+ },{"../localaudiotrack":19,"util":198}],16:[function(require,module,exports){
2621
2632
  // eslint-disable-next-line no-warning-comments
2622
2633
  // TODO(mroberts): Remove this when we go to the next major version. This is
2623
2634
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2632,7 +2643,7 @@ function LocalDataTrack(options) {
2632
2643
  inherits(LocalDataTrack, LocalDataTrackClass);
2633
2644
  module.exports = LocalDataTrack;
2634
2645
 
2635
- },{"../localdatatrack":21,"util":197}],17:[function(require,module,exports){
2646
+ },{"../localdatatrack":21,"util":198}],17:[function(require,module,exports){
2636
2647
  // eslint-disable-next-line no-warning-comments
2637
2648
  // TODO(mroberts): Remove this when we go to the next major version. This is
2638
2649
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2647,7 +2658,7 @@ function LocalVideoTrack(mediaStreamTrack, options) {
2647
2658
  inherits(LocalVideoTrack, LocalVideoTrackClass);
2648
2659
  module.exports = LocalVideoTrack;
2649
2660
 
2650
- },{"../localvideotrack":25,"util":197}],18:[function(require,module,exports){
2661
+ },{"../localvideotrack":25,"util":198}],18:[function(require,module,exports){
2651
2662
  'use strict';
2652
2663
  var __extends = (this && this.__extends) || (function () {
2653
2664
  var extendStatics = function (d, b) {
@@ -3458,6 +3469,8 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3458
3469
  // after the MediaStreamTrack is re-acquired.
3459
3470
  var promise = (trackChangeInProgress && trackChangeInProgress.promise) || Promise.resolve();
3460
3471
  return promise.finally(function () { return localMediaRestartDeferreds.resolveDeferred(kind); });
3472
+ }).catch(function (ex) {
3473
+ log.error("error in maybeRestart: " + ex.message);
3461
3474
  });
3462
3475
  }
3463
3476
  function onMute() {
@@ -3500,7 +3513,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3500
3513
  }
3501
3514
  module.exports = mixinLocalMediaTrack;
3502
3515
 
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){
3516
+ },{"../../util":126,"../../util/constants":120,"../../util/detectsilentaudio":121,"../../util/detectsilentvideo":122,"../../util/documentvisibilitymonitor.js":123,"../../util/localmediarestartdeferreds":129,"../../webaudio/workaround180748":149,"./sender":37,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],24:[function(require,module,exports){
3504
3517
  /* eslint new-cap:0 */
3505
3518
  'use strict';
3506
3519
  var __extends = (this && this.__extends) || (function () {
@@ -3961,7 +3974,7 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
3961
3974
  */
3962
3975
  module.exports = LocalVideoTrack;
3963
3976
 
3964
- },{"../../util":126,"../../util/detectsilentvideo":122,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":164}],26:[function(require,module,exports){
3977
+ },{"../../util":126,"../../util/detectsilentvideo":122,"./localmediatrack":23,"./videotrack":41,"@twilio/webrtc/lib/util":165}],26:[function(require,module,exports){
3965
3978
  'use strict';
3966
3979
  var __extends = (this && this.__extends) || (function () {
3967
3980
  var extendStatics = function (d, b) {
@@ -4371,7 +4384,7 @@ function shimMediaElement(el, onUnintentionallyPaused) {
4371
4384
  }
4372
4385
  module.exports = MediaTrack;
4373
4386
 
4374
- },{"../../util":126,"../../util/localmediarestartdeferreds":129,"./":18,"@twilio/webrtc":151,"@twilio/webrtc/lib/util":164}],28:[function(require,module,exports){
4387
+ },{"../../util":126,"../../util/localmediarestartdeferreds":129,"./":18,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165}],28:[function(require,module,exports){
4375
4388
  'use strict';
4376
4389
  var __extends = (this && this.__extends) || (function () {
4377
4390
  var extendStatics = function (d, b) {
@@ -5111,7 +5124,7 @@ function playIfPausedWhileInBackground(remoteMediaTrack) {
5111
5124
  */
5112
5125
  module.exports = mixinRemoteMediaTrack;
5113
5126
 
5114
- },{"../../util/constants":120,"../../util/documentvisibilitymonitor.js":123,"@twilio/webrtc/lib/util":164}],34:[function(require,module,exports){
5127
+ },{"../../util/constants":120,"../../util/documentvisibilitymonitor.js":123,"@twilio/webrtc/lib/util":165}],34:[function(require,module,exports){
5115
5128
  'use strict';
5116
5129
  var __extends = (this && this.__extends) || (function () {
5117
5130
  var extendStatics = function (d, b) {
@@ -5403,6 +5416,12 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5403
5416
  _invisibleElements: {
5404
5417
  value: new WeakSet(),
5405
5418
  },
5419
+ _elToPipCallbacks: {
5420
+ value: new WeakMap(),
5421
+ },
5422
+ _elToPipWindows: {
5423
+ value: new WeakMap(),
5424
+ },
5406
5425
  _turnOffTimer: {
5407
5426
  value: new Timeout(function () {
5408
5427
  _this._setRenderHint({ enabled: false });
@@ -5496,6 +5515,45 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5496
5515
  }
5497
5516
  return this;
5498
5517
  };
5518
+ RemoteVideoTrack.prototype._unObservePip = function (el) {
5519
+ var pipCallbacks = this._elToPipCallbacks.get(el);
5520
+ if (pipCallbacks) {
5521
+ el.removeEventListener('enterpictureinpicture', pipCallbacks.onEnterPip);
5522
+ el.removeEventListener('leavepictureinpicture', pipCallbacks.onLeavePip);
5523
+ this._elToPipCallbacks.delete(el);
5524
+ }
5525
+ };
5526
+ RemoteVideoTrack.prototype._observePip = function (el) {
5527
+ var _this = this;
5528
+ var pipCallbacks = this._elToPipCallbacks.get(el);
5529
+ if (!pipCallbacks) {
5530
+ var onEnterPip = function (event) { return _this._onEnterPip(event, el); };
5531
+ var onLeavePip = function (event) { return _this._onLeavePip(event, el); };
5532
+ var onResizePip = function (event) { return _this._onResizePip(event, el); };
5533
+ el.addEventListener('enterpictureinpicture', onEnterPip);
5534
+ el.addEventListener('leavepictureinpicture', onLeavePip);
5535
+ this._elToPipCallbacks.set(el, { onEnterPip: onEnterPip, onLeavePip: onLeavePip, onResizePip: onResizePip });
5536
+ }
5537
+ };
5538
+ RemoteVideoTrack.prototype._onEnterPip = function (event, videoEl) {
5539
+ this._log.debug('onEnterPip');
5540
+ var pipWindow = event.pictureInPictureWindow;
5541
+ this._elToPipWindows.set(videoEl, pipWindow);
5542
+ var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;
5543
+ pipWindow.addEventListener('resize', onResizePip);
5544
+ maybeUpdateEnabledHint(this);
5545
+ };
5546
+ RemoteVideoTrack.prototype._onLeavePip = function (event, videoEl) {
5547
+ this._log.debug('onLeavePip');
5548
+ this._elToPipWindows.delete(videoEl);
5549
+ var onResizePip = this._elToPipCallbacks.get(videoEl).onResizePip;
5550
+ var pipWindow = event.pictureInPictureWindow;
5551
+ pipWindow.removeEventListener('resize', onResizePip);
5552
+ maybeUpdateEnabledHint(this);
5553
+ };
5554
+ RemoteVideoTrack.prototype._onResizePip = function () {
5555
+ maybeUpdateDimensionHint(this);
5556
+ };
5499
5557
  RemoteVideoTrack.prototype.attach = function (el) {
5500
5558
  var result = _super.prototype.attach.call(this, el);
5501
5559
  if (this._clientTrackSwitchOffControl === 'auto') {
@@ -5508,6 +5566,7 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5508
5566
  if (this._enableDocumentVisibilityTurnOff) {
5509
5567
  this._documentVisibilityTurnOffCleanup = this._documentVisibilityTurnOffCleanup || setupDocumentVisibilityTurnOff(this);
5510
5568
  }
5569
+ this._observePip(result);
5511
5570
  return result;
5512
5571
  };
5513
5572
  RemoteVideoTrack.prototype.detach = function (el) {
@@ -5518,6 +5577,7 @@ var RemoteVideoTrack = /** @class */ (function (_super) {
5518
5577
  _this._intersectionObserver.unobserve(element);
5519
5578
  _this._resizeObserver.unobserve(element);
5520
5579
  _this._invisibleElements.delete(element);
5580
+ _this._unObservePip(element);
5521
5581
  });
5522
5582
  if (this._attachments.size === 0) {
5523
5583
  if (this._documentVisibilityTurnOffCleanup) {
@@ -5616,32 +5676,39 @@ function setupDocumentVisibilityTurnOff(removeVideoTrack) {
5616
5676
  documentVisibilityMonitor.offVisibilityChange(1, onVisibilityChanged);
5617
5677
  };
5618
5678
  }
5619
- function maybeUpdateEnabledHint(removeVideoTrack) {
5620
- if (removeVideoTrack._clientTrackSwitchOffControl !== 'auto') {
5679
+ function maybeUpdateEnabledHint(remoteVideoTrack) {
5680
+ if (remoteVideoTrack._clientTrackSwitchOffControl !== 'auto') {
5621
5681
  return;
5622
5682
  }
5623
- var visibleElements = removeVideoTrack._getAllAttachedElements().filter(function (el) { return !removeVideoTrack._invisibleElements.has(el); });
5624
- var enabled = document.visibilityState === 'visible' && visibleElements.length > 0;
5683
+ var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });
5684
+ var pipWindows = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return remoteVideoTrack._elToPipWindows.has(el); });
5685
+ // even when document is invisible we may have track playing in pip window.
5686
+ var enabled = pipWindows.length > 0 || (document.visibilityState === 'visible' && visibleElements.length > 0);
5625
5687
  if (enabled === true) {
5626
- removeVideoTrack._turnOffTimer.clear();
5627
- removeVideoTrack._setRenderHint({ enabled: true });
5688
+ remoteVideoTrack._turnOffTimer.clear();
5689
+ remoteVideoTrack._setRenderHint({ enabled: true });
5628
5690
  }
5629
- else if (!removeVideoTrack._turnOffTimer.isSet) {
5691
+ else if (!remoteVideoTrack._turnOffTimer.isSet) {
5630
5692
  // set the track to be turned off after some delay.
5631
- removeVideoTrack._turnOffTimer.start();
5693
+ remoteVideoTrack._turnOffTimer.start();
5632
5694
  }
5633
5695
  }
5634
- function maybeUpdateDimensionHint(removeVideoTrack) {
5635
- if (removeVideoTrack._contentPreferencesMode !== 'auto') {
5696
+ function maybeUpdateDimensionHint(remoteVideoTrack) {
5697
+ if (remoteVideoTrack._contentPreferencesMode !== 'auto') {
5636
5698
  return;
5637
5699
  }
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) {
5700
+ var visibleElements = remoteVideoTrack._getAllAttachedElements().filter(function (el) { return !remoteVideoTrack._invisibleElements.has(el); });
5701
+ var pipElements = remoteVideoTrack._getAllAttachedElements().map(function (el) {
5702
+ var pipWindow = remoteVideoTrack._elToPipWindows.get(el);
5703
+ return pipWindow ? { clientHeight: pipWindow.height, clientWidth: pipWindow.width } : { clientHeight: 0, clientWidth: 0 };
5704
+ });
5705
+ var totalElements = visibleElements.concat(pipElements);
5706
+ if (totalElements.length > 0) {
5707
+ var _a = __read(totalElements.sort(function (el1, el2) {
5641
5708
  return el2.clientHeight + el2.clientWidth - el1.clientHeight - el1.clientWidth - 1;
5642
5709
  }), 1), _b = _a[0], clientHeight = _b.clientHeight, clientWidth = _b.clientWidth;
5643
5710
  var renderDimensions = { height: clientHeight, width: clientWidth };
5644
- removeVideoTrack._setRenderHint({ renderDimensions: renderDimensions });
5711
+ remoteVideoTrack._setRenderHint({ renderDimensions: renderDimensions });
5645
5712
  }
5646
5713
  }
5647
5714
  /**
@@ -5686,7 +5753,7 @@ function maybeUpdateDimensionHint(removeVideoTrack) {
5686
5753
  */
5687
5754
  module.exports = RemoteVideoTrack;
5688
5755
 
5689
- },{"../../util/documentvisibilitymonitor.js":123,"../../util/nullobserver.js":133,"../../util/timeout":141,"./remotemediatrack":33,"./videotrack":41}],36:[function(require,module,exports){
5756
+ },{"../../util/documentvisibilitymonitor.js":123,"../../util/nullobserver.js":133,"../../util/timeout":142,"./remotemediatrack":33,"./videotrack":41}],36:[function(require,module,exports){
5690
5757
  'use strict';
5691
5758
  var __extends = (this && this.__extends) || (function () {
5692
5759
  var extendStatics = function (d, b) {
@@ -6178,7 +6245,7 @@ var VideoProcessorEventObserver = /** @class */ (function (_super) {
6178
6245
  }(EventEmitter));
6179
6246
  module.exports = VideoProcessorEventObserver;
6180
6247
 
6181
- },{"../../util/constants":120,"events":178}],41:[function(require,module,exports){
6248
+ },{"../../util/constants":120,"events":179}],41:[function(require,module,exports){
6182
6249
  'use strict';
6183
6250
  var __extends = (this && this.__extends) || (function () {
6184
6251
  var extendStatics = function (d, b) {
@@ -6791,7 +6858,7 @@ var NetworkQualityConfigurationImpl = /** @class */ (function (_super) {
6791
6858
  }(EventEmitter));
6792
6859
  module.exports = NetworkQualityConfigurationImpl;
6793
6860
 
6794
- },{"./util":126,"./util/constants":120,"events":178}],43:[function(require,module,exports){
6861
+ },{"./util":126,"./util/constants":120,"events":179}],43:[function(require,module,exports){
6795
6862
  'use strict';
6796
6863
  var __extends = (this && this.__extends) || (function () {
6797
6864
  var extendStatics = function (d, b) {
@@ -7516,7 +7583,6 @@ function makeStandardCandidateStats(input) {
7516
7583
  { key: 'priority', type: 'number' },
7517
7584
  { key: 'protocol', altKeys: ['transport'], type: 'string' },
7518
7585
  { key: 'url', type: 'string' },
7519
- { key: 'deleted', type: 'boolean' },
7520
7586
  { key: 'relayProtocol', type: 'string' },
7521
7587
  ];
7522
7588
  return standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {
@@ -7565,27 +7631,13 @@ function extractSelectedActiveCandidatePair(stats) {
7565
7631
 
7566
7632
  },{}],45:[function(require,module,exports){
7567
7633
  "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
7634
  Object.defineProperty(exports, "__esModule", { value: true });
7580
7635
  exports.getTurnCredentials = void 0;
7581
7636
  var TwilioConnection = require('../twilioconnection.js');
7582
- var _a = require('../util/constants'), WS_SERVER = _a.WS_SERVER, ICE_VERSION = _a.ICE_VERSION;
7637
+ var ICE_VERSION = require('../util/constants').ICE_VERSION;
7583
7638
  var events_1 = require("events");
7584
- function getTurnCredentials(token, options) {
7639
+ function getTurnCredentials(token, wsServer) {
7585
7640
  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
7641
  var eventObserver = new events_1.EventEmitter();
7590
7642
  var connectionOptions = {
7591
7643
  networkMonitor: null,
@@ -7620,7 +7672,7 @@ function getTurnCredentials(token, options) {
7620
7672
  }
7621
7673
  exports.getTurnCredentials = getTurnCredentials;
7622
7674
 
7623
- },{"../twilioconnection.js":116,"../util/constants":120,"events":178}],46:[function(require,module,exports){
7675
+ },{"../twilioconnection.js":116,"../util/constants":120,"events":179}],46:[function(require,module,exports){
7624
7676
  "use strict";
7625
7677
  var __read = (this && this.__read) || function (o, n) {
7626
7678
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -7651,7 +7703,7 @@ exports.makeStat = void 0;
7651
7703
  * @returns {{min: number, max: number: average: number}|null}
7652
7704
  */
7653
7705
  function makeStat(values) {
7654
- if (values.length) {
7706
+ if (values && values.length) {
7655
7707
  var min = Math.min.apply(Math, __spreadArray([], __read(values)));
7656
7708
  var max = Math.max.apply(Math, __spreadArray([], __read(values)));
7657
7709
  var average = values.reduce(function (total, value) { return total + value; }, 0) / values.length;
@@ -7786,9 +7838,13 @@ var makestat_1 = require("./makestat");
7786
7838
  var syntheticaudio_1 = require("./syntheticaudio");
7787
7839
  var syntheticvideo_1 = require("./syntheticvideo");
7788
7840
  var util_1 = require("../util");
7841
+ var WS_SERVER = require('../util/constants').WS_SERVER;
7789
7842
  var Log = require('../util/log');
7790
7843
  var EventEmitter = require('../eventemitter');
7791
7844
  var MovingAverageDelta = require('../util/movingaveragedelta');
7845
+ var EventObserver = require('../util/eventobserver');
7846
+ var InsightsPublisher = require('../util/insightspublisher');
7847
+ var _a = require('../util/sid'), createSID = _a.createSID, sessionSID = _a.sessionSID;
7792
7848
  var SECOND = 1000;
7793
7849
  var DEFAULT_TEST_DURATION = 10 * SECOND;
7794
7850
  /**
@@ -7858,11 +7914,15 @@ var PreflightTest = /** @class */ (function (_super) {
7858
7914
  _this._sentBytesMovingAverage = new MovingAverageDelta();
7859
7915
  _this._packetLossMovingAverage = new MovingAverageDelta();
7860
7916
  _this._receivedBytesMovingAverage = new MovingAverageDelta();
7917
+ var internalOptions = options;
7918
+ 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;
7919
+ // eslint-disable-next-line new-cap
7920
+ var wsServer = internalOptions.wsServer || WS_SERVER(environment, region);
7861
7921
  _this._log = new Log('default', _this, constants_1.DEFAULT_LOG_LEVEL, constants_1.DEFAULT_LOGGER_NAME);
7862
- _this._testDuration = options.duration || DEFAULT_TEST_DURATION;
7922
+ _this._testDuration = duration;
7863
7923
  _this._instanceId = nInstances++;
7864
7924
  _this._testTiming.start();
7865
- _this._runPreflightTest(token, options);
7925
+ _this._runPreflightTest(token, environment, wsServer);
7866
7926
  return _this;
7867
7927
  }
7868
7928
  PreflightTest.prototype.toString = function () {
@@ -7874,7 +7934,7 @@ var PreflightTest = /** @class */ (function (_super) {
7874
7934
  PreflightTest.prototype.stop = function () {
7875
7935
  this._stopped = true;
7876
7936
  };
7877
- PreflightTest.prototype._generatePreflightReport = function (collectedStats) {
7937
+ PreflightTest.prototype._generatePreflightReport = function (collectedStats, error) {
7878
7938
  this._testTiming.stop();
7879
7939
  return {
7880
7940
  testTiming: this._testTiming.getTimeMeasurement(),
@@ -7886,12 +7946,15 @@ var PreflightTest = /** @class */ (function (_super) {
7886
7946
  media: this._mediaTiming.getTimeMeasurement()
7887
7947
  },
7888
7948
  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
7949
+ jitter: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.jitter),
7950
+ rtt: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.rtt),
7951
+ packetLoss: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.packetLoss),
7952
+ },
7953
+ selectedIceCandidatePairStats: collectedStats ? collectedStats.selectedIceCandidatePairStats : null,
7954
+ iceCandidateStats: collectedStats ? collectedStats.iceCandidateStats : [],
7955
+ // NOTE(mpatwardhan): internal properties.
7956
+ error: error === null || error === void 0 ? void 0 : error.toString(),
7957
+ mos: makestat_1.makeStat(collectedStats === null || collectedStats === void 0 ? void 0 : collectedStats.mos),
7895
7958
  };
7896
7959
  };
7897
7960
  PreflightTest.prototype._executePreflightStep = function (stepName, step) {
@@ -7966,15 +8029,73 @@ var PreflightTest = /** @class */ (function (_super) {
7966
8029
  });
7967
8030
  }
7968
8031
  };
7969
- PreflightTest.prototype._runPreflightTest = function (token, options) {
8032
+ PreflightTest.prototype._setupInsights = function (_a) {
8033
+ 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;
8034
+ var eventPublisherOptions = {};
8035
+ var eventPublisher = new InsightsPublisher(token, constants_1.SDK_NAME, constants_1.SDK_VERSION, environment, realm, eventPublisherOptions);
8036
+ // event publisher requires room sid/participant sid. supply fake ones.
8037
+ eventPublisher.connect('PREFLIGHT_ROOM_SID', 'PREFLIGHT_PARTICIPANT');
8038
+ var eventObserver = new EventObserver(eventPublisher, Date.now(), this._log);
8039
+ // eslint-disable-next-line no-undefined
8040
+ var undefinedValue = undefined;
8041
+ return {
8042
+ reportToInsights: function (_a) {
8043
+ var _b, _c;
8044
+ var report = _a.report;
8045
+ var jitterStats = report.stats.jitter || undefinedValue;
8046
+ var rttStats = report.stats.rtt || undefinedValue;
8047
+ var packetLossStats = report.stats.packetLoss || undefinedValue;
8048
+ var mosStats = report.mos || undefinedValue;
8049
+ // stringify important info from ice candidates.
8050
+ var candidateTypeToProtocols = new Map();
8051
+ report.iceCandidateStats.forEach(function (candidateStats) {
8052
+ if (candidateStats.candidateType && candidateStats.protocol) {
8053
+ var protocols = candidateTypeToProtocols.get(candidateStats.candidateType) || [];
8054
+ if (protocols.indexOf(candidateStats.protocol) < 0) {
8055
+ protocols.push(candidateStats.protocol);
8056
+ }
8057
+ candidateTypeToProtocols.set(candidateStats.candidateType, protocols);
8058
+ }
8059
+ });
8060
+ var iceCandidateStats = JSON.stringify(Object.fromEntries(candidateTypeToProtocols));
8061
+ var insightsReport = {
8062
+ name: 'report',
8063
+ group: 'preflight',
8064
+ level: report.error ? 'error' : 'info',
8065
+ payload: {
8066
+ sessionSID: sessionSID,
8067
+ preflightSID: createSID('PF'),
8068
+ testTiming: report.testTiming,
8069
+ dtlsTiming: report.networkTiming.dtls,
8070
+ iceTiming: report.networkTiming.ice,
8071
+ peerConnectionTiming: report.networkTiming.peerConnection,
8072
+ connectTiming: report.networkTiming.connect,
8073
+ mediaTiming: report.networkTiming.media,
8074
+ selectedLocalCandidate: (_b = report.selectedIceCandidatePairStats) === null || _b === void 0 ? void 0 : _b.localCandidate,
8075
+ selectedRemoteCandidate: (_c = report.selectedIceCandidatePairStats) === null || _c === void 0 ? void 0 : _c.remoteCandidate,
8076
+ iceCandidateStats: iceCandidateStats,
8077
+ jitterStats: jitterStats,
8078
+ rttStats: rttStats,
8079
+ packetLossStats: packetLossStats,
8080
+ mosStats: mosStats,
8081
+ error: report.error
8082
+ }
8083
+ };
8084
+ eventObserver.emit('event', insightsReport);
8085
+ setTimeout(function () { return eventPublisher.disconnect(); }, 2000);
8086
+ }
8087
+ };
8088
+ };
8089
+ PreflightTest.prototype._runPreflightTest = function (token, environment, wsServer) {
7970
8090
  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;
8091
+ var localTracks, pcs, reportToInsights, elements_1, iceServers, senderPC_1, receiverPC_1, remoteTracks_1, collectedStats_1, report, error_1;
7972
8092
  var _this = this;
7973
8093
  return __generator(this, function (_a) {
7974
8094
  switch (_a.label) {
7975
8095
  case 0:
7976
8096
  localTracks = [];
7977
8097
  pcs = [];
8098
+ reportToInsights = this._setupInsights({ token: token, environment: environment }).reportToInsights;
7978
8099
  _a.label = 1;
7979
8100
  case 1:
7980
8101
  _a.trys.push([1, 8, 9, 10]);
@@ -7985,7 +8106,7 @@ var PreflightTest = /** @class */ (function (_super) {
7985
8106
  this.emit('progress', PreflightProgress.mediaAcquired);
7986
8107
  this.emit('debug', { localTracks: localTracks });
7987
8108
  this._connectTiming.start();
7988
- return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, options); })];
8109
+ return [4 /*yield*/, this._executePreflightStep('Get turn credentials', function () { return getturncredentials_1.getTurnCredentials(token, wsServer); })];
7989
8110
  case 3:
7990
8111
  iceServers = _a.sent();
7991
8112
  this._connectTiming.stop();
@@ -8068,10 +8189,13 @@ var PreflightTest = /** @class */ (function (_super) {
8068
8189
  return [4 /*yield*/, this._executePreflightStep('generate report', function () { return _this._generatePreflightReport(collectedStats_1); })];
8069
8190
  case 7:
8070
8191
  report = _a.sent();
8192
+ reportToInsights({ report: report });
8071
8193
  this.emit('completed', report);
8072
8194
  return [3 /*break*/, 10];
8073
8195
  case 8:
8074
8196
  error_1 = _a.sent();
8197
+ // eslint-disable-next-line no-undefined
8198
+ reportToInsights({ report: this._generatePreflightReport(undefined, error_1) });
8075
8199
  this.emit('failed', error_1);
8076
8200
  return [3 /*break*/, 10];
8077
8201
  case 9:
@@ -8254,7 +8378,7 @@ function runPreflight(token, options) {
8254
8378
  }
8255
8379
  exports.runPreflight = runPreflight;
8256
8380
 
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){
8381
+ },{"../eventemitter":10,"../util":126,"../util/constants":120,"../util/eventobserver":124,"../util/insightspublisher":127,"../util/log":130,"../util/movingaveragedelta":131,"../util/sid":140,"./getCombinedConnectionStats":44,"./getturncredentials":45,"./makestat":46,"./mos":47,"./syntheticaudio":49,"./syntheticvideo":50,"./timer":51}],49:[function(require,module,exports){
8258
8382
  "use strict";
8259
8383
  Object.defineProperty(exports, "__esModule", { value: true });
8260
8384
  exports.syntheticAudio = void 0;
@@ -8277,7 +8401,7 @@ function syntheticAudio() {
8277
8401
  }
8278
8402
  exports.syntheticAudio = syntheticAudio;
8279
8403
 
8280
- },{"../webaudio/audiocontext":146}],50:[function(require,module,exports){
8404
+ },{"../webaudio/audiocontext":147}],50:[function(require,module,exports){
8281
8405
  "use strict";
8282
8406
  Object.defineProperty(exports, "__esModule", { value: true });
8283
8407
  exports.syntheticVideo = void 0;
@@ -8442,7 +8566,7 @@ var QueueingEventEmitter = /** @class */ (function (_super) {
8442
8566
  }(EventEmitter));
8443
8567
  module.exports = QueueingEventEmitter;
8444
8568
 
8445
- },{"events":178}],53:[function(require,module,exports){
8569
+ },{"events":179}],53:[function(require,module,exports){
8446
8570
  'use strict';
8447
8571
  var __extends = (this && this.__extends) || (function () {
8448
8572
  var extendStatics = function (d, b) {
@@ -9958,7 +10082,7 @@ var RecordingSignaling = /** @class */ (function (_super) {
9958
10082
  */
9959
10083
  module.exports = RecordingSignaling;
9960
10084
 
9961
- },{"events":178}],60:[function(require,module,exports){
10085
+ },{"events":179}],60:[function(require,module,exports){
9962
10086
  'use strict';
9963
10087
  var __extends = (this && this.__extends) || (function () {
9964
10088
  var extendStatics = function (d, b) {
@@ -10384,7 +10508,7 @@ function maybeUpdateState(roomSignaling) {
10384
10508
  }
10385
10509
  module.exports = RoomSignaling;
10386
10510
 
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){
10511
+ },{"../statemachine":84,"../util":126,"../util/constants":120,"../util/log":130,"../util/timeout":142,"../util/twilio-video-errors":143,"./recording":59}],63:[function(require,module,exports){
10388
10512
  'use strict';
10389
10513
  var __extends = (this && this.__extends) || (function () {
10390
10514
  var extendStatics = function (d, b) {
@@ -10567,7 +10691,7 @@ var TrackSignaling = /** @class */ (function (_super) {
10567
10691
  */
10568
10692
  module.exports = TrackSignaling;
10569
10693
 
10570
- },{"events":178}],64:[function(require,module,exports){
10694
+ },{"events":179}],64:[function(require,module,exports){
10571
10695
  'use strict';
10572
10696
  var CancelablePromise = require('../../util/cancelablepromise');
10573
10697
  var DefaultPeerConnectionManager = require('./peerconnectionmanager');
@@ -10613,7 +10737,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10613
10737
  throw error;
10614
10738
  });
10615
10739
  };
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;
10740
+ 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
10741
  // decide which msp channels to request
10618
10742
  // dominantSpeaker, networkQuality
10619
10743
  var trackPriority = !!bandwidthProfile;
@@ -10630,20 +10754,13 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10630
10754
  networkMonitor: networkMonitor,
10631
10755
  networkQuality: networkQuality,
10632
10756
  iceServers: iceServers,
10633
- insights: insights,
10634
10757
  onIced: onIced,
10635
10758
  realm: realm,
10636
10759
  renderHints: renderHints,
10637
10760
  sdpSemantics: sdpSemantics,
10638
10761
  trackPriority: trackPriority,
10639
10762
  trackSwitchOff: trackSwitchOff
10640
- }, typeof wsServerInsights === 'string' ? {
10641
- wsServerInsights: wsServerInsights
10642
- } : {}, InsightsPublisher ? {
10643
- InsightsPublisher: InsightsPublisher
10644
- } : {}, NullInsightsPublisher ? {
10645
- NullInsightsPublisher: NullInsightsPublisher
10646
- } : {}, bandwidthProfile ? {
10763
+ }, bandwidthProfile ? {
10647
10764
  bandwidthProfile: bandwidthProfile
10648
10765
  } : {});
10649
10766
  transport = new Transport(name, token, localParticipant, peerConnectionManager, wsServer, transportOptions);
@@ -10690,7 +10807,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
10690
10807
  }
10691
10808
  module.exports = createCancelableRoomSignalingPromise;
10692
10809
 
10693
- },{"../../util":126,"../../util/cancelablepromise":119,"../../util/twilio-video-errors":142,"./peerconnectionmanager":75,"./room":80,"./twilioconnectiontransport":83}],65:[function(require,module,exports){
10810
+ },{"../../util":126,"../../util/cancelablepromise":119,"../../util/twilio-video-errors":143,"./peerconnectionmanager":75,"./room":80,"./twilioconnectiontransport":83}],65:[function(require,module,exports){
10694
10811
  'use strict';
10695
10812
  var __extends = (this && this.__extends) || (function () {
10696
10813
  var extendStatics = function (d, b) {
@@ -11402,7 +11519,7 @@ var LocalTrackPublicationV2 = /** @class */ (function (_super) {
11402
11519
  */
11403
11520
  module.exports = LocalTrackPublicationV2;
11404
11521
 
11405
- },{"../../util/twilio-video-errors":142,"../localtrackpublication":57}],71:[function(require,module,exports){
11522
+ },{"../../util/twilio-video-errors":143,"../localtrackpublication":57}],71:[function(require,module,exports){
11406
11523
  /* eslint callback-return:0 */
11407
11524
  'use strict';
11408
11525
  var __extends = (this && this.__extends) || (function () {
@@ -11472,19 +11589,17 @@ var MediaSignaling = /** @class */ (function (_super) {
11472
11589
  var receiverPromise = this._getReceiver(id).then(function (receiver) {
11473
11590
  if (receiver.kind !== 'data') {
11474
11591
  _this._log.error('Expected a DataTrackReceiver');
11475
- throw new Error('Expected a DataTrackReceiver');
11476
11592
  }
11477
11593
  if (_this._receiverPromise !== receiverPromise) {
11478
11594
  return;
11479
11595
  }
11480
11596
  try {
11481
11597
  _this._transport = receiver.toDataTransport();
11598
+ _this.emit('ready', _this._transport);
11482
11599
  }
11483
11600
  catch (ex) {
11484
- _this._log.error('Failed to toDataTransport');
11485
- throw new Error('Failed to toDataTransport');
11601
+ _this._log.error("Failed to toDataTransport: " + ex.message);
11486
11602
  }
11487
- _this.emit('ready', _this._transport);
11488
11603
  receiver.once('close', function () { return _this._teardown(); });
11489
11604
  });
11490
11605
  this._receiverPromise = receiverPromise;
@@ -11501,7 +11616,7 @@ var MediaSignaling = /** @class */ (function (_super) {
11501
11616
  }(EventEmitter));
11502
11617
  module.exports = MediaSignaling;
11503
11618
 
11504
- },{"events":178}],72:[function(require,module,exports){
11619
+ },{"events":179}],72:[function(require,module,exports){
11505
11620
  /* eslint callback-return:0 */
11506
11621
  'use strict';
11507
11622
  var __extends = (this && this.__extends) || (function () {
@@ -11660,7 +11775,7 @@ function next(monitor) {
11660
11775
  */
11661
11776
  module.exports = NetworkQualityMonitor;
11662
11777
 
11663
- },{"../../stats/peerconnectionreportfactory":102,"events":178}],73:[function(require,module,exports){
11778
+ },{"../../stats/peerconnectionreportfactory":102,"events":179}],73:[function(require,module,exports){
11664
11779
  'use strict';
11665
11780
  var __extends = (this && this.__extends) || (function () {
11666
11781
  var extendStatics = function (d, b) {
@@ -12782,7 +12897,9 @@ var PeerConnectionV2 = /** @class */ (function (_super) {
12782
12897
  log.debug("Starting ICE reconnect timeout: " + delay);
12783
12898
  this._iceReconnectTimeout.start();
12784
12899
  }
12785
- this.offer();
12900
+ this.offer().catch(function (ex) {
12901
+ log.error("offer failed in _initiateIceRestart with: " + ex.message);
12902
+ });
12786
12903
  };
12787
12904
  /**
12788
12905
  * Schedule an ICE Restart.
@@ -13580,7 +13697,7 @@ function updateEncodingParameters(pcv2) {
13580
13697
  // by RTCRtpSender.setParameters() being rejected.
13581
13698
  params.encodings[0].networkPriority = 'high';
13582
13699
  }
13583
- if (!isFirefox && sender.track.kind === 'video') {
13700
+ if (isSafari && sender.track.kind === 'video') {
13584
13701
  var _a = sender.track.getSettings(), width = _a.width, height = _a.height;
13585
13702
  pcv2._updateEncodings(width, height, params.encodings);
13586
13703
  }
@@ -13617,7 +13734,7 @@ function setMaxBitrate(params, maxBitrate) {
13617
13734
  }
13618
13735
  module.exports = PeerConnectionV2;
13619
13736
 
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){
13737
+ },{"../../data/receiver":5,"../../media/track/receiver":28,"../../statemachine":84,"../../util":126,"../../util/constants":120,"../../util/log":130,"../../util/sdp":134,"../../util/sdp/issue8329":135,"../../util/sdp/trackmatcher/identity":137,"../../util/sdp/trackmatcher/mid":138,"../../util/sdp/trackmatcher/ordered":139,"../../util/timeout":142,"../../util/twilio-video-errors":143,"./icebox":66,"./iceconnectionmonitor.js":67,"@twilio/webrtc":152,"@twilio/webrtc/lib/util":165,"@twilio/webrtc/lib/util/sdp":167,"backoff":170}],75:[function(require,module,exports){
13621
13738
  'use strict';
13622
13739
  var __extends = (this && this.__extends) || (function () {
13623
13740
  var extendStatics = function (d, b) {
@@ -14177,7 +14294,7 @@ function updateConnectionState(pcm) {
14177
14294
  }
14178
14295
  module.exports = PeerConnectionManager;
14179
14296
 
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){
14297
+ },{"../../media/track/sender":37,"../../queueingeventemitter":52,"../../util":126,"../../util/twilio-video-errors":143,"../../webaudio/audiocontext":147,"./peerconnection":74,"@twilio/webrtc/lib/util":165}],76:[function(require,module,exports){
14181
14298
  'use strict';
14182
14299
  var __extends = (this && this.__extends) || (function () {
14183
14300
  var extendStatics = function (d, b) {
@@ -15361,7 +15478,7 @@ function replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {
15361
15478
  }
15362
15479
  module.exports = RoomV2;
15363
15480
 
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){
15481
+ },{"../../stats/statsreport":112,"../../util":126,"../../util/movingaveragedelta":131,"../../util/twilio-video-errors":143,"../room":62,"./dominantspeakersignaling":65,"./networkqualitymonitor":72,"./networkqualitysignaling":73,"./recording":76,"./remoteparticipant":77,"./renderhintssignaling":79,"./trackprioritysignaling":81,"./trackswitchoffsignaling":82}],81:[function(require,module,exports){
15365
15482
  'use strict';
15366
15483
  var __extends = (this && this.__extends) || (function () {
15367
15484
  var extendStatics = function (d, b) {
@@ -15503,20 +15620,16 @@ var __extends = (this && this.__extends) || (function () {
15503
15620
  };
15504
15621
  })();
15505
15622
  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
15623
  var StateMachine = require('../../statemachine');
15510
15624
  var TwilioConnection = require('../../twilioconnection');
15511
15625
  var DefaultBackoff = require('backoff');
15512
15626
  var reconnectBackoffConfig = require('../../util/constants').reconnectBackoffConfig;
15513
15627
  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;
15628
+ var _a = require('../../util/constants'), SDK_NAME = _a.SDK_NAME, SDK_VERSION = _a.SDK_VERSION;
15629
+ var _b = require('../../util'), createBandwidthProfilePayload = _b.createBandwidthProfilePayload, createMediaSignalingPayload = _b.createMediaSignalingPayload, createSubscribePayload = _b.createSubscribePayload, getUserAgent = _b.getUserAgent, isNonArrayObject = _b.isNonArrayObject;
15630
+ var _c = require('../../util/twilio-video-errors'), createTwilioError = _c.createTwilioError, RoomCompletedError = _c.RoomCompletedError, SignalingConnectionError = _c.SignalingConnectionError, SignalingServerBusyError = _c.SignalingServerBusyError;
15516
15631
  var ICE_VERSION = 1;
15517
15632
  var RSP_VERSION = 2;
15518
- var SDK_NAME = packageInfo.name + ".js";
15519
- var SDK_VERSION = packageInfo.version;
15520
15633
  /*
15521
15634
  TwilioConnectionTransport States
15522
15635
  ----------------
@@ -15577,8 +15690,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15577
15690
  var _this = this;
15578
15691
  options = Object.assign({
15579
15692
  Backoff: DefaultBackoff,
15580
- InsightsPublisher: InsightsPublisher,
15581
- NullInsightsPublisher: NullInsightsPublisher,
15582
15693
  TwilioConnection: TwilioConnection,
15583
15694
  iceServers: null,
15584
15695
  sdpFormat: getSdpFormat(options.sdpSemantics),
@@ -15588,12 +15699,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15588
15699
  userAgent: getUserAgent()
15589
15700
  }, options);
15590
15701
  _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
15702
  Object.defineProperties(_this, {
15598
15703
  _accessToken: {
15599
15704
  value: accessToken
@@ -15604,9 +15709,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15604
15709
  _bandwidthProfile: {
15605
15710
  value: options.bandwidthProfile
15606
15711
  },
15607
- _disconnectEventPublisher: {
15608
- value: function () { return eventPublisher.disconnect(); }
15609
- },
15610
15712
  _dominantSpeaker: {
15611
15713
  value: options.dominantSpeaker
15612
15714
  },
@@ -15675,15 +15777,7 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15675
15777
  value: wsServer
15676
15778
  }
15677
15779
  });
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
15780
  setupTransport(_this);
15683
- _this.once('connected', function (_a) {
15684
- var sid = _a.sid, participant = _a.participant;
15685
- eventPublisher.connect(sid, participant.sid);
15686
- });
15687
15781
  return _this;
15688
15782
  }
15689
15783
  /**
@@ -15773,7 +15867,6 @@ var TwilioConnectionTransport = /** @class */ (function (_super) {
15773
15867
  this.preempt('disconnected', null, [error]);
15774
15868
  this._sendConnectOrSyncOrDisconnectMessage();
15775
15869
  this._twilioConnection.close();
15776
- this._disconnectEventPublisher();
15777
15870
  return true;
15778
15871
  }
15779
15872
  return false;
@@ -16092,7 +16185,7 @@ function setupTransport(transport) {
16092
16185
  }
16093
16186
  module.exports = TwilioConnectionTransport;
16094
16187
 
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){
16188
+ },{"../../statemachine":84,"../../twilioconnection":116,"../../util":126,"../../util/constants":120,"../../util/timeout":142,"../../util/twilio-video-errors":143,"@twilio/webrtc/lib/util/sdp":167,"backoff":170}],84:[function(require,module,exports){
16096
16189
  'use strict';
16097
16190
  var __extends = (this && this.__extends) || (function () {
16098
16191
  var extendStatics = function (d, b) {
@@ -16538,7 +16631,7 @@ function createUnreachableError(here, there) {
16538
16631
  }
16539
16632
  module.exports = StateMachine;
16540
16633
 
16541
- },{"./util":126,"events":178}],85:[function(require,module,exports){
16634
+ },{"./util":126,"events":179}],85:[function(require,module,exports){
16542
16635
  /* eslint no-undefined:0 */
16543
16636
  'use strict';
16544
16637
  /**
@@ -17735,7 +17828,7 @@ function updateChrome(factory) {
17735
17828
  }
17736
17829
  module.exports = PeerConnectionReportFactory;
17737
17830
 
17738
- },{"./icereportfactory":87,"./peerconnectionreport":101,"./receiverreportfactory":104,"./senderreportfactory":111,"@twilio/webrtc/lib/util":164}],103:[function(require,module,exports){
17831
+ },{"./icereportfactory":87,"./peerconnectionreport":101,"./receiverreportfactory":104,"./senderreportfactory":111,"@twilio/webrtc/lib/util":165}],103:[function(require,module,exports){
17739
17832
  'use strict';
17740
17833
  var __extends = (this && this.__extends) || (function () {
17741
17834
  var extendStatics = function (d, b) {
@@ -18489,7 +18582,7 @@ var TrackTransceiver = /** @class */ (function (_super) {
18489
18582
  */
18490
18583
  module.exports = TrackTransceiver;
18491
18584
 
18492
- },{"events":178}],116:[function(require,module,exports){
18585
+ },{"events":179}],116:[function(require,module,exports){
18493
18586
  (function (global){(function (){
18494
18587
  'use strict';
18495
18588
  var __extends = (this && this.__extends) || (function () {
@@ -19144,7 +19237,7 @@ TwilioConnection.CloseReason = CloseReason;
19144
19237
  module.exports = TwilioConnection;
19145
19238
 
19146
19239
  }).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){
19240
+ },{"./statemachine":84,"./util":126,"./util/log":130,"./util/networkmonitor":132,"./util/timeout":142,"ws":201}],117:[function(require,module,exports){
19148
19241
  'use strict';
19149
19242
  var defer = require('./').defer;
19150
19243
  /**
@@ -19474,6 +19567,9 @@ module.exports = CancelablePromise;
19474
19567
 
19475
19568
  },{}],120:[function(require,module,exports){
19476
19569
  'use strict';
19570
+ var packageInfo = require('../../package.json');
19571
+ module.exports.SDK_NAME = packageInfo.name + ".js";
19572
+ module.exports.SDK_VERSION = packageInfo.version;
19477
19573
  module.exports.DEFAULT_ENVIRONMENT = 'prod';
19478
19574
  module.exports.DEFAULT_REALM = 'us1';
19479
19575
  module.exports.DEFAULT_REGION = 'gll';
@@ -19557,7 +19653,7 @@ module.exports.videoContentPreferencesMode = {
19557
19653
  MODE_MANUAL: 'manual'
19558
19654
  };
19559
19655
 
19560
- },{}],121:[function(require,module,exports){
19656
+ },{"../../package.json":200}],121:[function(require,module,exports){
19561
19657
  'use strict';
19562
19658
  var detectSilence = require('../webaudio/detectsilence');
19563
19659
  var N_ATTEMPTS = 3;
@@ -19598,7 +19694,7 @@ function detectSilentAudio(el) {
19598
19694
  }
19599
19695
  module.exports = detectSilentAudio;
19600
19696
 
19601
- },{"../webaudio/audiocontext":146,"../webaudio/detectsilence":147}],122:[function(require,module,exports){
19697
+ },{"../webaudio/audiocontext":147,"../webaudio/detectsilence":148}],122:[function(require,module,exports){
19602
19698
  'use strict';
19603
19699
  // Cached copy of the <canvas> used to check silent video frames.
19604
19700
  var canvas = null;
@@ -19803,7 +19899,8 @@ var VALID_GROUPS = [
19803
19899
  'room',
19804
19900
  'media',
19805
19901
  'quality',
19806
- 'video-processor'
19902
+ 'video-processor',
19903
+ 'preflight'
19807
19904
  ];
19808
19905
  var VALID_LEVELS = [
19809
19906
  'debug',
@@ -19821,36 +19918,32 @@ var EventObserver = /** @class */ (function (_super) {
19821
19918
  __extends(EventObserver, _super);
19822
19919
  /**
19823
19920
  * Constructor.
19921
+ * @param {InsightsPublisher} publisher
19824
19922
  * @param {number} connectTimestamp
19825
19923
  * @param {Log} log
19826
19924
  * @param {EventListener} [eventListener]
19827
19925
  */
19828
- function EventObserver(connectTimestamp, log, eventListener) {
19926
+ function EventObserver(publisher, connectTimestamp, log, eventListener) {
19829
19927
  if (eventListener === void 0) { eventListener = null; }
19830
19928
  var _this = _super.call(this) || this;
19831
- Object.defineProperties(_this, {
19832
- _publisher: {
19833
- value: null,
19834
- writable: true
19835
- }
19836
- });
19837
19929
  _this.on('event', function (_a) {
19838
19930
  var name = _a.name, group = _a.group, level = _a.level, payload = _a.payload;
19839
19931
  if (typeof name !== 'string') {
19932
+ log.error('Unexpected name: ', name);
19840
19933
  throw new Error('Unexpected name: ', name);
19841
19934
  }
19842
19935
  if (!VALID_GROUPS.includes(group)) {
19936
+ log.error('Unexpected group: ', group);
19843
19937
  throw new Error('Unexpected group: ', group);
19844
19938
  }
19845
19939
  if (!VALID_LEVELS.includes(level)) {
19940
+ log.error('Unexpected level: ', level);
19846
19941
  throw new Error('Unexpected level: ', level);
19847
19942
  }
19848
19943
  var timestamp = Date.now();
19849
19944
  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
- }
19945
+ var publisherPayload = Object.assign({ elapsedTime: elapsedTime, level: level }, payload ? payload : {});
19946
+ publisher.publish(group, name, publisherPayload);
19854
19947
  var event = Object.assign({
19855
19948
  elapsedTime: elapsedTime,
19856
19949
  group: group,
@@ -19871,13 +19964,6 @@ var EventObserver = /** @class */ (function (_super) {
19871
19964
  });
19872
19965
  return _this;
19873
19966
  }
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
19967
  return EventObserver;
19882
19968
  }(EventEmitter));
19883
19969
  /**
@@ -19887,7 +19973,7 @@ var EventObserver = /** @class */ (function (_super) {
19887
19973
  */
19888
19974
  module.exports = EventObserver;
19889
19975
 
19890
- },{"events":178}],125:[function(require,module,exports){
19976
+ },{"events":179}],125:[function(require,module,exports){
19891
19977
  'use strict';
19892
19978
  var Filter = /** @class */ (function () {
19893
19979
  function Filter(options) {
@@ -19972,6 +20058,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19972
20058
  var constants = require('./constants');
19973
20059
  var E = constants.typeErrors, trackPriority = constants.trackPriority;
19974
20060
  var util = require('@twilio/webrtc/lib/util');
20061
+ var sessionSID = require('./sid').sessionSID;
19975
20062
  /**
19976
20063
  * Return the given {@link LocalTrack} or a new {@link LocalTrack} for the
19977
20064
  * given MediaStreamTrack.
@@ -20522,6 +20609,7 @@ function createRoomConnectEventPayload(connectOptions) {
20522
20609
  return val ? 'true' : 'false';
20523
20610
  }
20524
20611
  var payload = {
20612
+ sessionSID: sessionSID,
20525
20613
  // arrays props converted to lengths.
20526
20614
  iceServers: (connectOptions.iceServers || []).length,
20527
20615
  audioTracks: (connectOptions.tracks || []).filter(function (track) { return track.kind === 'audio'; }).length,
@@ -20799,7 +20887,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
20799
20887
  exports.waitForSometime = waitForSometime;
20800
20888
  exports.waitForEvent = waitForEvent;
20801
20889
 
20802
- },{"./constants":120,"@twilio/webrtc/lib/util":164}],127:[function(require,module,exports){
20890
+ },{"./constants":120,"./sid":140,"@twilio/webrtc/lib/util":165}],127:[function(require,module,exports){
20803
20891
  (function (global){(function (){
20804
20892
  'use strict';
20805
20893
  var __extends = (this && this.__extends) || (function () {
@@ -21076,7 +21164,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
21076
21164
  module.exports = InsightsPublisher;
21077
21165
 
21078
21166
  }).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){
21167
+ },{"..":126,"../../util":126,"events":179,"ws":201}],128:[function(require,module,exports){
21080
21168
  // eslint-disable-next-line no-warning-comments
21081
21169
  // TODO(mroberts): This should be described as implementing some
21082
21170
  // InsightsPublisher interface.
@@ -21470,7 +21558,7 @@ function validateLogLevels(levels) {
21470
21558
  }
21471
21559
  module.exports = Log;
21472
21560
 
21473
- },{"../vendor/loglevel":145,"./constants":120}],131:[function(require,module,exports){
21561
+ },{"../vendor/loglevel":146,"./constants":120}],131:[function(require,module,exports){
21474
21562
  'use strict';
21475
21563
  /**
21476
21564
  * Calculates the moving average delta for the given pair ofsamples. A sample (S)
@@ -22465,7 +22553,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
22465
22553
  }
22466
22554
  module.exports = workaround;
22467
22555
 
22468
- },{"./":134,"@twilio/webrtc":151}],136:[function(require,module,exports){
22556
+ },{"./":134,"@twilio/webrtc":152}],136:[function(require,module,exports){
22469
22557
  'use strict';
22470
22558
  var __read = (this && this.__read) || function (o, n) {
22471
22559
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -22935,6 +23023,25 @@ var OrderedTrackMatcher = /** @class */ (function () {
22935
23023
  module.exports = OrderedTrackMatcher;
22936
23024
 
22937
23025
  },{"../":134,"../../":126}],140:[function(require,module,exports){
23026
+ var SID_CHARS = '1234567890abcdef';
23027
+ var SID_CHAR_LENGTH = 32;
23028
+ // copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
23029
+ /**
23030
+ * Generates a random sid using given prefix.
23031
+ * @param {string} prefix
23032
+ * @returns string
23033
+ */
23034
+ function createSID(prefix) {
23035
+ var result = '';
23036
+ for (var i = 0; i < SID_CHAR_LENGTH; i++) {
23037
+ result += SID_CHARS.charAt(Math.floor(Math.random() * SID_CHARS.length));
23038
+ }
23039
+ return "" + prefix + result;
23040
+ }
23041
+ exports.sessionSID = createSID('SS');
23042
+ exports.createSID = createSID;
23043
+
23044
+ },{}],141:[function(require,module,exports){
22938
23045
  'use strict';
22939
23046
  var _a = require('@twilio/webrtc/lib/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
22940
23047
  var _b = require('./browserdetection'), isAndroid = _b.isAndroid, isMobile = _b.isMobile, isNonChromiumEdge = _b.isNonChromiumEdge, rebrandedChromeBrowser = _b.rebrandedChromeBrowser, mobileWebKitBrowser = _b.mobileWebKitBrowser;
@@ -22979,7 +23086,7 @@ function isSupported() {
22979
23086
  }
22980
23087
  module.exports = isSupported;
22981
23088
 
22982
- },{"./browserdetection":118,"@twilio/webrtc/lib/util":164}],141:[function(require,module,exports){
23089
+ },{"./browserdetection":118,"@twilio/webrtc/lib/util":165}],142:[function(require,module,exports){
22983
23090
  'use strict';
22984
23091
  /**
22985
23092
  * A {@link Timeout} represents a resettable and clearable timeout.
@@ -23074,7 +23181,7 @@ var Timeout = /** @class */ (function () {
23074
23181
  }());
23075
23182
  module.exports = Timeout;
23076
23183
 
23077
- },{}],142:[function(require,module,exports){
23184
+ },{}],143:[function(require,module,exports){
23078
23185
  // NOTE: Do not edit this file. This code is auto-generated. Contact the
23079
23186
  // Twilio SDK Team for more information.
23080
23187
  'use strict';
@@ -23107,9 +23214,6 @@ exports.createTwilioError = function createTwilioError(code, message) {
23107
23214
  message = typeof message === 'string' && message ? message : 'Unknown error';
23108
23215
  return TwilioErrorByCode[code] ? new TwilioErrorByCode[code]() : new TwilioError(code, message);
23109
23216
  };
23110
- // Note(mpatwardhan): We derive twilio specific errors here. After typescript compiles to es5 `instanceof` does not work
23111
- // on objects that derive from Error/Array types. To workaround we call setPrototypeOf after calling super()
23112
- // more on this at: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
23113
23217
  /**
23114
23218
  * @class AccessTokenInvalidError
23115
23219
  * @classdesc Raised whenever the AccessToken used for connecting to a Room is invalid.
@@ -23499,7 +23603,7 @@ var RoomTypeInvalidError = /** @class */ (function (_super) {
23499
23603
  __extends(RoomTypeInvalidError, _super);
23500
23604
  function RoomTypeInvalidError() {
23501
23605
  var _this = _super.call(this, 53108, 'RoomType is not valid') || this;
23502
- Object.setPrototypeOf(_this, RoomMaxParticipantsOutOfRangeError.prototype);
23606
+ Object.setPrototypeOf(_this, RoomTypeInvalidError.prototype);
23503
23607
  return _this;
23504
23608
  }
23505
23609
  return RoomTypeInvalidError;
@@ -23686,6 +23790,42 @@ var RoomCompletedError = /** @class */ (function (_super) {
23686
23790
  }(TwilioError));
23687
23791
  exports.RoomCompletedError = RoomCompletedError;
23688
23792
  Object.defineProperty(TwilioErrorByCode, 53118, { value: RoomCompletedError });
23793
+ /**
23794
+ * @class RoomAudioOnlyFlagNotSupportedError
23795
+ * @classdesc Raised whenever a participant tries to set the AudioOnly flag for a Room type other than Group Rooms.
23796
+ * @extends TwilioError
23797
+ * @property {number} code - 53124
23798
+ * @property {string} message - 'The AudioOnly flag is not supported for the Room type'
23799
+ */
23800
+ var RoomAudioOnlyFlagNotSupportedError = /** @class */ (function (_super) {
23801
+ __extends(RoomAudioOnlyFlagNotSupportedError, _super);
23802
+ function RoomAudioOnlyFlagNotSupportedError() {
23803
+ var _this = _super.call(this, 53124, 'The AudioOnly flag is not supported for the Room type') || this;
23804
+ Object.setPrototypeOf(_this, RoomAudioOnlyFlagNotSupportedError.prototype);
23805
+ return _this;
23806
+ }
23807
+ return RoomAudioOnlyFlagNotSupportedError;
23808
+ }(TwilioError));
23809
+ exports.RoomAudioOnlyFlagNotSupportedError = RoomAudioOnlyFlagNotSupportedError;
23810
+ Object.defineProperty(TwilioErrorByCode, 53124, { value: RoomAudioOnlyFlagNotSupportedError });
23811
+ /**
23812
+ * @class RoomTrackKindNotSupportedError
23813
+ * @classdesc Raised whenever a participant tries to publish a track or connects with a track that is not supported by the group room.
23814
+ * @extends TwilioError
23815
+ * @property {number} code - 53125
23816
+ * @property {string} message - 'The track kind is not supported by the Room'
23817
+ */
23818
+ var RoomTrackKindNotSupportedError = /** @class */ (function (_super) {
23819
+ __extends(RoomTrackKindNotSupportedError, _super);
23820
+ function RoomTrackKindNotSupportedError() {
23821
+ var _this = _super.call(this, 53125, 'The track kind is not supported by the Room') || this;
23822
+ Object.setPrototypeOf(_this, RoomTrackKindNotSupportedError.prototype);
23823
+ return _this;
23824
+ }
23825
+ return RoomTrackKindNotSupportedError;
23826
+ }(TwilioError));
23827
+ exports.RoomTrackKindNotSupportedError = RoomTrackKindNotSupportedError;
23828
+ Object.defineProperty(TwilioErrorByCode, 53125, { value: RoomTrackKindNotSupportedError });
23689
23829
  /**
23690
23830
  * @class ParticipantIdentityInvalidError
23691
23831
  * @classdesc Raised whenever a Participant identity is invalid, and the scenario is not covered by a more specific error code.
@@ -23742,7 +23882,7 @@ exports.ParticipantIdentityCharsInvalidError = ParticipantIdentityCharsInvalidEr
23742
23882
  Object.defineProperty(TwilioErrorByCode, 53202, { value: ParticipantIdentityCharsInvalidError });
23743
23883
  /**
23744
23884
  * @class ParticipantMaxTracksExceededError
23745
- * @classdesc Raised when the Room limit for published tracks has been reached and a Participant tries to publish a track to the Room.
23885
+ * @classdesc Raised whenever a Participant tries to publish a Track and the maximum number of published tracks allowed in the Room at the same time has been reached
23746
23886
  * @extends TwilioError
23747
23887
  * @property {number} code - 53203
23748
23888
  * @property {string} message - 'The maximum number of published tracks allowed in the Room at the same time has been reached'
@@ -24065,7 +24205,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
24065
24205
  exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
24066
24206
  Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
24067
24207
 
24068
- },{"./twilioerror":143}],143:[function(require,module,exports){
24208
+ },{"./twilioerror":144}],144:[function(require,module,exports){
24069
24209
  'use strict';
24070
24210
  var __extends = (this && this.__extends) || (function () {
24071
24211
  var extendStatics = function (d, b) {
@@ -24147,7 +24287,7 @@ var TwilioError = /** @class */ (function (_super) {
24147
24287
  }(Error));
24148
24288
  module.exports = TwilioError;
24149
24289
 
24150
- },{}],144:[function(require,module,exports){
24290
+ },{}],145:[function(require,module,exports){
24151
24291
  'use strict';
24152
24292
  var isNonArrayObject = require('./').isNonArrayObject;
24153
24293
  var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
@@ -24264,7 +24404,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
24264
24404
  exports.validateLocalTrack = validateLocalTrack;
24265
24405
  exports.validateObject = validateObject;
24266
24406
 
24267
- },{"./":126,"./constants":120}],145:[function(require,module,exports){
24407
+ },{"./":126,"./constants":120}],146:[function(require,module,exports){
24268
24408
  /**
24269
24409
  * Copyright (c) 2013 Tim Perry
24270
24410
  * Licensed under the MIT license.
@@ -24504,7 +24644,7 @@ defaultLogger.getLoggers = function getLoggers() {
24504
24644
  defaultLogger['default'] = defaultLogger;
24505
24645
  module.exports = defaultLogger;
24506
24646
 
24507
- },{}],146:[function(require,module,exports){
24647
+ },{}],147:[function(require,module,exports){
24508
24648
  /* globals webkitAudioContext, AudioContext */
24509
24649
  'use strict';
24510
24650
  var NativeAudioContext = typeof AudioContext !== 'undefined'
@@ -24587,7 +24727,7 @@ var AudioContextFactory = /** @class */ (function () {
24587
24727
  }());
24588
24728
  module.exports = new AudioContextFactory();
24589
24729
 
24590
- },{}],147:[function(require,module,exports){
24730
+ },{}],148:[function(require,module,exports){
24591
24731
  'use strict';
24592
24732
  /**
24593
24733
  * Return a Promise that resolves after `timeout` milliseconds.
@@ -24640,7 +24780,7 @@ function detectSilence(audioContext, stream, timeout) {
24640
24780
  }
24641
24781
  module.exports = detectSilence;
24642
24782
 
24643
- },{}],148:[function(require,module,exports){
24783
+ },{}],149:[function(require,module,exports){
24644
24784
  'use strict';
24645
24785
  var detectSilence = require('./detectsilence');
24646
24786
  /**
@@ -24710,7 +24850,7 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
24710
24850
  }
24711
24851
  module.exports = workaround;
24712
24852
 
24713
- },{"./audiocontext":146,"./detectsilence":147}],149:[function(require,module,exports){
24853
+ },{"./audiocontext":147,"./detectsilence":148}],150:[function(require,module,exports){
24714
24854
  'use strict';
24715
24855
 
24716
24856
  var flatMap = require('./util').flatMap;
@@ -25596,7 +25736,7 @@ function standardizeFirefoxStats(response, isRemote) {
25596
25736
 
25597
25737
  module.exports = getStats;
25598
25738
 
25599
- },{"./util":164,"./util/sdp":166}],150:[function(require,module,exports){
25739
+ },{"./util":165,"./util/sdp":167}],151:[function(require,module,exports){
25600
25740
  /* globals navigator */
25601
25741
  'use strict';
25602
25742
 
@@ -25622,7 +25762,7 @@ function getUserMedia(constraints) {
25622
25762
 
25623
25763
  module.exports = getUserMedia;
25624
25764
 
25625
- },{}],151:[function(require,module,exports){
25765
+ },{}],152:[function(require,module,exports){
25626
25766
  'use strict';
25627
25767
 
25628
25768
  var WebRTC = {};
@@ -25664,7 +25804,7 @@ Object.defineProperties(WebRTC, {
25664
25804
 
25665
25805
  module.exports = WebRTC;
25666
25806
 
25667
- },{"../package.json":167,"./getstats":149,"./getusermedia":150,"./mediastream":152,"./mediastreamtrack":153,"./rtcicecandidate":154,"./rtcpeerconnection":157,"./rtcsessiondescription":162}],152:[function(require,module,exports){
25807
+ },{"../package.json":168,"./getstats":150,"./getusermedia":151,"./mediastream":153,"./mediastreamtrack":154,"./rtcicecandidate":155,"./rtcpeerconnection":158,"./rtcsessiondescription":163}],153:[function(require,module,exports){
25668
25808
  /* globals MediaStream */
25669
25809
  'use strict';
25670
25810
 
@@ -25676,7 +25816,7 @@ if (typeof MediaStream === 'function') {
25676
25816
  };
25677
25817
  }
25678
25818
 
25679
- },{}],153:[function(require,module,exports){
25819
+ },{}],154:[function(require,module,exports){
25680
25820
  /* global MediaStreamTrack */
25681
25821
  'use strict';
25682
25822
 
@@ -25688,7 +25828,7 @@ if (typeof MediaStreamTrack === 'function') {
25688
25828
  };
25689
25829
  }
25690
25830
 
25691
- },{}],154:[function(require,module,exports){
25831
+ },{}],155:[function(require,module,exports){
25692
25832
  /* global RTCIceCandidate */
25693
25833
  'use strict';
25694
25834
 
@@ -25700,7 +25840,7 @@ if (typeof RTCIceCandidate === 'function') {
25700
25840
  };
25701
25841
  }
25702
25842
 
25703
- },{}],155:[function(require,module,exports){
25843
+ },{}],156:[function(require,module,exports){
25704
25844
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
25705
25845
  'use strict';
25706
25846
 
@@ -26264,7 +26404,7 @@ function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
26264
26404
 
26265
26405
  module.exports = ChromeRTCPeerConnection;
26266
26406
 
26267
- },{"../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){
26407
+ },{"../mediastream":153,"../rtcrtpsender":160,"../rtcsessiondescription/chrome":161,"../util":165,"../util/eventtarget":164,"../util/latch":166,"../util/sdp":167,"util":198}],157:[function(require,module,exports){
26268
26408
  /* globals RTCPeerConnection */
26269
26409
  'use strict';
26270
26410
 
@@ -26597,7 +26737,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
26597
26737
 
26598
26738
  module.exports = FirefoxRTCPeerConnection;
26599
26739
 
26600
- },{"../rtcsessiondescription/firefox":161,"../util":164,"../util/eventtarget":163,"../util/sdp":166,"util":197}],157:[function(require,module,exports){
26740
+ },{"../rtcsessiondescription/firefox":162,"../util":165,"../util/eventtarget":164,"../util/sdp":167,"util":198}],158:[function(require,module,exports){
26601
26741
  'use strict';
26602
26742
 
26603
26743
  if (typeof RTCPeerConnection === 'function') {
@@ -26622,7 +26762,7 @@ if (typeof RTCPeerConnection === 'function') {
26622
26762
  };
26623
26763
  }
26624
26764
 
26625
- },{"../util":164,"./chrome":155,"./firefox":156,"./safari":158}],158:[function(require,module,exports){
26765
+ },{"../util":165,"./chrome":156,"./firefox":157,"./safari":159}],159:[function(require,module,exports){
26626
26766
  /* globals RTCPeerConnection, RTCSessionDescription */
26627
26767
  'use strict';
26628
26768
 
@@ -27013,7 +27153,7 @@ function shimDataChannel(dataChannel) {
27013
27153
 
27014
27154
  module.exports = SafariRTCPeerConnection;
27015
27155
 
27016
- },{"../util":164,"../util/eventtarget":163,"../util/latch":165,"../util/sdp":166,"util":197}],159:[function(require,module,exports){
27156
+ },{"../util":165,"../util/eventtarget":164,"../util/latch":166,"../util/sdp":167,"util":198}],160:[function(require,module,exports){
27017
27157
  'use strict';
27018
27158
 
27019
27159
  /**
@@ -27054,7 +27194,7 @@ function RTCRtpSenderShim(track) {
27054
27194
 
27055
27195
  module.exports = RTCRtpSenderShim;
27056
27196
 
27057
- },{}],160:[function(require,module,exports){
27197
+ },{}],161:[function(require,module,exports){
27058
27198
  /* globals RTCSessionDescription */
27059
27199
  'use strict';
27060
27200
 
@@ -27095,13 +27235,13 @@ function ChromeRTCSessionDescription(descriptionInitDict) {
27095
27235
 
27096
27236
  module.exports = ChromeRTCSessionDescription;
27097
27237
 
27098
- },{}],161:[function(require,module,exports){
27238
+ },{}],162:[function(require,module,exports){
27099
27239
  /* globals RTCSessionDescription */
27100
27240
  'use strict';
27101
27241
 
27102
27242
  module.exports = RTCSessionDescription;
27103
27243
 
27104
- },{}],162:[function(require,module,exports){
27244
+ },{}],163:[function(require,module,exports){
27105
27245
  /* globals RTCSessionDescription */
27106
27246
  'use strict';
27107
27247
 
@@ -27124,7 +27264,7 @@ if (typeof RTCSessionDescription === 'function') {
27124
27264
  };
27125
27265
  }
27126
27266
 
27127
- },{"../util":164,"./chrome":160,"./firefox":161}],163:[function(require,module,exports){
27267
+ },{"../util":165,"./chrome":161,"./firefox":162}],164:[function(require,module,exports){
27128
27268
  'use strict';
27129
27269
 
27130
27270
  var EventEmitter = require('events').EventEmitter;
@@ -27165,7 +27305,7 @@ EventTarget.prototype.removeEventListener = function removeEventListener() {
27165
27305
 
27166
27306
  module.exports = EventTarget;
27167
27307
 
27168
- },{"events":178}],164:[function(require,module,exports){
27308
+ },{"events":179}],165:[function(require,module,exports){
27169
27309
  'use strict';
27170
27310
 
27171
27311
  /**
@@ -27502,7 +27642,7 @@ exports.makeUUID = makeUUID;
27502
27642
  exports.proxyProperties = proxyProperties;
27503
27643
  exports.support = support;
27504
27644
 
27505
- },{}],165:[function(require,module,exports){
27645
+ },{}],166:[function(require,module,exports){
27506
27646
  'use strict';
27507
27647
 
27508
27648
  var defer = require('./').defer;
@@ -27617,7 +27757,7 @@ function createUnreachableStateError(from, to) {
27617
27757
 
27618
27758
  module.exports = Latch;
27619
27759
 
27620
- },{"./":164}],166:[function(require,module,exports){
27760
+ },{"./":165}],167:[function(require,module,exports){
27621
27761
  /* globals RTCPeerConnection, RTCRtpTransceiver */
27622
27762
 
27623
27763
  'use strict';
@@ -27927,7 +28067,7 @@ exports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;
27927
28067
  exports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;
27928
28068
  exports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;
27929
28069
 
27930
- },{"./":164}],167:[function(require,module,exports){
28070
+ },{"./":165}],168:[function(require,module,exports){
27931
28071
  module.exports={
27932
28072
  "_from": "@twilio/webrtc@4.5.1",
27933
28073
  "_id": "@twilio/webrtc@4.5.1",
@@ -28030,7 +28170,7 @@ module.exports={
28030
28170
  "version": "4.5.1"
28031
28171
  }
28032
28172
 
28033
- },{}],168:[function(require,module,exports){
28173
+ },{}],169:[function(require,module,exports){
28034
28174
  (function (global){(function (){
28035
28175
  'use strict';
28036
28176
 
@@ -28061,7 +28201,7 @@ module.exports = function availableTypedArrays() {
28061
28201
  };
28062
28202
 
28063
28203
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28064
- },{}],169:[function(require,module,exports){
28204
+ },{}],170:[function(require,module,exports){
28065
28205
  // Copyright (c) 2012 Mathieu Turcotte
28066
28206
  // Licensed under the MIT license.
28067
28207
 
@@ -28094,7 +28234,7 @@ module.exports.call = function(fn, vargs, callback) {
28094
28234
  return new FunctionCall(fn, vargs, callback);
28095
28235
  };
28096
28236
 
28097
- },{"./lib/backoff":170,"./lib/function_call.js":171,"./lib/strategy/exponential":172,"./lib/strategy/fibonacci":173}],170:[function(require,module,exports){
28237
+ },{"./lib/backoff":171,"./lib/function_call.js":172,"./lib/strategy/exponential":173,"./lib/strategy/fibonacci":174}],171:[function(require,module,exports){
28098
28238
  // Copyright (c) 2012 Mathieu Turcotte
28099
28239
  // Licensed under the MIT license.
28100
28240
 
@@ -28161,7 +28301,7 @@ Backoff.prototype.reset = function() {
28161
28301
 
28162
28302
  module.exports = Backoff;
28163
28303
 
28164
- },{"events":178,"precond":191,"util":197}],171:[function(require,module,exports){
28304
+ },{"events":179,"precond":192,"util":198}],172:[function(require,module,exports){
28165
28305
  // Copyright (c) 2012 Mathieu Turcotte
28166
28306
  // Licensed under the MIT license.
28167
28307
 
@@ -28353,7 +28493,7 @@ FunctionCall.prototype.handleBackoff_ = function(number, delay, err) {
28353
28493
 
28354
28494
  module.exports = FunctionCall;
28355
28495
 
28356
- },{"./backoff":170,"./strategy/fibonacci":173,"events":178,"precond":191,"util":197}],172:[function(require,module,exports){
28496
+ },{"./backoff":171,"./strategy/fibonacci":174,"events":179,"precond":192,"util":198}],173:[function(require,module,exports){
28357
28497
  // Copyright (c) 2012 Mathieu Turcotte
28358
28498
  // Licensed under the MIT license.
28359
28499
 
@@ -28396,7 +28536,7 @@ ExponentialBackoffStrategy.prototype.reset_ = function() {
28396
28536
 
28397
28537
  module.exports = ExponentialBackoffStrategy;
28398
28538
 
28399
- },{"./strategy":174,"precond":191,"util":197}],173:[function(require,module,exports){
28539
+ },{"./strategy":175,"precond":192,"util":198}],174:[function(require,module,exports){
28400
28540
  // Copyright (c) 2012 Mathieu Turcotte
28401
28541
  // Licensed under the MIT license.
28402
28542
 
@@ -28426,7 +28566,7 @@ FibonacciBackoffStrategy.prototype.reset_ = function() {
28426
28566
 
28427
28567
  module.exports = FibonacciBackoffStrategy;
28428
28568
 
28429
- },{"./strategy":174,"util":197}],174:[function(require,module,exports){
28569
+ },{"./strategy":175,"util":198}],175:[function(require,module,exports){
28430
28570
  // Copyright (c) 2012 Mathieu Turcotte
28431
28571
  // Licensed under the MIT license.
28432
28572
 
@@ -28508,7 +28648,7 @@ BackoffStrategy.prototype.reset_ = function() {
28508
28648
 
28509
28649
  module.exports = BackoffStrategy;
28510
28650
 
28511
- },{"events":178,"util":197}],175:[function(require,module,exports){
28651
+ },{"events":179,"util":198}],176:[function(require,module,exports){
28512
28652
  'use strict';
28513
28653
 
28514
28654
  var GetIntrinsic = require('get-intrinsic');
@@ -28525,7 +28665,7 @@ module.exports = function callBoundIntrinsic(name, allowMissing) {
28525
28665
  return intrinsic;
28526
28666
  };
28527
28667
 
28528
- },{"./":176,"get-intrinsic":182}],176:[function(require,module,exports){
28668
+ },{"./":177,"get-intrinsic":183}],177:[function(require,module,exports){
28529
28669
  'use strict';
28530
28670
 
28531
28671
  var bind = require('function-bind');
@@ -28574,12 +28714,12 @@ if ($defineProperty) {
28574
28714
  module.exports.apply = applyBind;
28575
28715
  }
28576
28716
 
28577
- },{"function-bind":181,"get-intrinsic":182}],177:[function(require,module,exports){
28717
+ },{"function-bind":182,"get-intrinsic":183}],178:[function(require,module,exports){
28578
28718
  'use strict';
28579
28719
 
28580
28720
  var GetIntrinsic = require('get-intrinsic');
28581
28721
 
28582
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%');
28722
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
28583
28723
  if ($gOPD) {
28584
28724
  try {
28585
28725
  $gOPD([], 'length');
@@ -28591,7 +28731,7 @@ if ($gOPD) {
28591
28731
 
28592
28732
  module.exports = $gOPD;
28593
28733
 
28594
- },{"get-intrinsic":182}],178:[function(require,module,exports){
28734
+ },{"get-intrinsic":183}],179:[function(require,module,exports){
28595
28735
  // Copyright Joyent, Inc. and other Node contributors.
28596
28736
  //
28597
28737
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -29090,7 +29230,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
29090
29230
  }
29091
29231
  }
29092
29232
 
29093
- },{}],179:[function(require,module,exports){
29233
+ },{}],180:[function(require,module,exports){
29094
29234
 
29095
29235
  var hasOwn = Object.prototype.hasOwnProperty;
29096
29236
  var toString = Object.prototype.toString;
@@ -29114,7 +29254,7 @@ module.exports = function forEach (obj, fn, ctx) {
29114
29254
  };
29115
29255
 
29116
29256
 
29117
- },{}],180:[function(require,module,exports){
29257
+ },{}],181:[function(require,module,exports){
29118
29258
  'use strict';
29119
29259
 
29120
29260
  /* eslint no-invalid-this: 1 */
@@ -29168,14 +29308,14 @@ module.exports = function bind(that) {
29168
29308
  return bound;
29169
29309
  };
29170
29310
 
29171
- },{}],181:[function(require,module,exports){
29311
+ },{}],182:[function(require,module,exports){
29172
29312
  'use strict';
29173
29313
 
29174
29314
  var implementation = require('./implementation');
29175
29315
 
29176
29316
  module.exports = Function.prototype.bind || implementation;
29177
29317
 
29178
- },{"./implementation":180}],182:[function(require,module,exports){
29318
+ },{"./implementation":181}],183:[function(require,module,exports){
29179
29319
  'use strict';
29180
29320
 
29181
29321
  var undefined;
@@ -29507,7 +29647,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
29507
29647
  return value;
29508
29648
  };
29509
29649
 
29510
- },{"function-bind":181,"has":186,"has-symbols":183}],183:[function(require,module,exports){
29650
+ },{"function-bind":182,"has":187,"has-symbols":184}],184:[function(require,module,exports){
29511
29651
  'use strict';
29512
29652
 
29513
29653
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
@@ -29522,7 +29662,7 @@ module.exports = function hasNativeSymbols() {
29522
29662
  return hasSymbolSham();
29523
29663
  };
29524
29664
 
29525
- },{"./shams":184}],184:[function(require,module,exports){
29665
+ },{"./shams":185}],185:[function(require,module,exports){
29526
29666
  'use strict';
29527
29667
 
29528
29668
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -29566,7 +29706,7 @@ module.exports = function hasSymbols() {
29566
29706
  return true;
29567
29707
  };
29568
29708
 
29569
- },{}],185:[function(require,module,exports){
29709
+ },{}],186:[function(require,module,exports){
29570
29710
  'use strict';
29571
29711
 
29572
29712
  var hasSymbols = require('has-symbols/shams');
@@ -29575,14 +29715,14 @@ module.exports = function hasToStringTagShams() {
29575
29715
  return hasSymbols() && !!Symbol.toStringTag;
29576
29716
  };
29577
29717
 
29578
- },{"has-symbols/shams":184}],186:[function(require,module,exports){
29718
+ },{"has-symbols/shams":185}],187:[function(require,module,exports){
29579
29719
  'use strict';
29580
29720
 
29581
29721
  var bind = require('function-bind');
29582
29722
 
29583
29723
  module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
29584
29724
 
29585
- },{"function-bind":181}],187:[function(require,module,exports){
29725
+ },{"function-bind":182}],188:[function(require,module,exports){
29586
29726
  if (typeof Object.create === 'function') {
29587
29727
  // implementation from standard node.js 'util' module
29588
29728
  module.exports = function inherits(ctor, superCtor) {
@@ -29611,7 +29751,7 @@ if (typeof Object.create === 'function') {
29611
29751
  }
29612
29752
  }
29613
29753
 
29614
- },{}],188:[function(require,module,exports){
29754
+ },{}],189:[function(require,module,exports){
29615
29755
  'use strict';
29616
29756
 
29617
29757
  var hasToStringTag = require('has-tostringtag/shams')();
@@ -29646,7 +29786,7 @@ isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
29646
29786
 
29647
29787
  module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
29648
29788
 
29649
- },{"call-bind/callBound":175,"has-tostringtag/shams":185}],189:[function(require,module,exports){
29789
+ },{"call-bind/callBound":176,"has-tostringtag/shams":186}],190:[function(require,module,exports){
29650
29790
  'use strict';
29651
29791
 
29652
29792
  var toStr = Object.prototype.toString;
@@ -29686,7 +29826,7 @@ module.exports = function isGeneratorFunction(fn) {
29686
29826
  return getProto(fn) === GeneratorFunction;
29687
29827
  };
29688
29828
 
29689
- },{"has-tostringtag/shams":185}],190:[function(require,module,exports){
29829
+ },{"has-tostringtag/shams":186}],191:[function(require,module,exports){
29690
29830
  (function (global){(function (){
29691
29831
  'use strict';
29692
29832
 
@@ -29750,14 +29890,14 @@ module.exports = function isTypedArray(value) {
29750
29890
  };
29751
29891
 
29752
29892
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
29753
- },{"available-typed-arrays":168,"call-bind/callBound":175,"es-abstract/helpers/getOwnPropertyDescriptor":177,"foreach":179,"has-tostringtag/shams":185}],191:[function(require,module,exports){
29893
+ },{"available-typed-arrays":169,"call-bind/callBound":176,"es-abstract/helpers/getOwnPropertyDescriptor":178,"foreach":180,"has-tostringtag/shams":186}],192:[function(require,module,exports){
29754
29894
  /*
29755
29895
  * Copyright (c) 2012 Mathieu Turcotte
29756
29896
  * Licensed under the MIT license.
29757
29897
  */
29758
29898
 
29759
29899
  module.exports = require('./lib/checks');
29760
- },{"./lib/checks":192}],192:[function(require,module,exports){
29900
+ },{"./lib/checks":193}],193:[function(require,module,exports){
29761
29901
  /*
29762
29902
  * Copyright (c) 2012 Mathieu Turcotte
29763
29903
  * Licensed under the MIT license.
@@ -29853,7 +29993,7 @@ module.exports.checkIsBoolean = typeCheck('boolean');
29853
29993
  module.exports.checkIsFunction = typeCheck('function');
29854
29994
  module.exports.checkIsObject = typeCheck('object');
29855
29995
 
29856
- },{"./errors":193,"util":197}],193:[function(require,module,exports){
29996
+ },{"./errors":194,"util":198}],194:[function(require,module,exports){
29857
29997
  /*
29858
29998
  * Copyright (c) 2012 Mathieu Turcotte
29859
29999
  * Licensed under the MIT license.
@@ -29879,7 +30019,7 @@ IllegalStateError.prototype.name = 'IllegalStateError';
29879
30019
 
29880
30020
  module.exports.IllegalStateError = IllegalStateError;
29881
30021
  module.exports.IllegalArgumentError = IllegalArgumentError;
29882
- },{"util":197}],194:[function(require,module,exports){
30022
+ },{"util":198}],195:[function(require,module,exports){
29883
30023
  // shim for using process in browser
29884
30024
  var process = module.exports = {};
29885
30025
 
@@ -30065,14 +30205,14 @@ process.chdir = function (dir) {
30065
30205
  };
30066
30206
  process.umask = function() { return 0; };
30067
30207
 
30068
- },{}],195:[function(require,module,exports){
30208
+ },{}],196:[function(require,module,exports){
30069
30209
  module.exports = function isBuffer(arg) {
30070
30210
  return arg && typeof arg === 'object'
30071
30211
  && typeof arg.copy === 'function'
30072
30212
  && typeof arg.fill === 'function'
30073
30213
  && typeof arg.readUInt8 === 'function';
30074
30214
  }
30075
- },{}],196:[function(require,module,exports){
30215
+ },{}],197:[function(require,module,exports){
30076
30216
  // Currently in sync with Node.js lib/internal/util/types.js
30077
30217
  // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
30078
30218
 
@@ -30408,7 +30548,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer;
30408
30548
  });
30409
30549
  });
30410
30550
 
30411
- },{"is-arguments":188,"is-generator-function":189,"is-typed-array":190,"which-typed-array":198}],197:[function(require,module,exports){
30551
+ },{"is-arguments":189,"is-generator-function":190,"is-typed-array":191,"which-typed-array":199}],198:[function(require,module,exports){
30412
30552
  (function (process){(function (){
30413
30553
  // Copyright Joyent, Inc. and other Node contributors.
30414
30554
  //
@@ -31127,7 +31267,7 @@ function callbackify(original) {
31127
31267
  exports.callbackify = callbackify;
31128
31268
 
31129
31269
  }).call(this)}).call(this,require('_process'))
31130
- },{"./support/isBuffer":195,"./support/types":196,"_process":194,"inherits":187}],198:[function(require,module,exports){
31270
+ },{"./support/isBuffer":196,"./support/types":197,"_process":195,"inherits":188}],199:[function(require,module,exports){
31131
31271
  (function (global){(function (){
31132
31272
  'use strict';
31133
31273
 
@@ -31186,12 +31326,12 @@ module.exports = function whichTypedArray(value) {
31186
31326
  };
31187
31327
 
31188
31328
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
31189
- },{"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){
31329
+ },{"available-typed-arrays":169,"call-bind/callBound":176,"es-abstract/helpers/getOwnPropertyDescriptor":178,"foreach":180,"has-tostringtag/shams":186,"is-typed-array":191}],200:[function(require,module,exports){
31190
31330
  module.exports={
31191
31331
  "name": "twilio-video",
31192
31332
  "title": "Twilio Video",
31193
31333
  "description": "Twilio Video JavaScript Library",
31194
- "version": "2.17.0",
31334
+ "version": "2.18.2",
31195
31335
  "homepage": "https://twilio.com",
31196
31336
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
31197
31337
  "contributors": [
@@ -31274,7 +31414,7 @@ module.exports={
31274
31414
  "vinyl-fs": "^2.4.4",
31275
31415
  "vinyl-source-stream": "^1.1.0",
31276
31416
  "watchify": "^3.11.1",
31277
- "webrtc-adapter": "^4.1.1"
31417
+ "webrtc-adapter": "^7.7.1"
31278
31418
  },
31279
31419
  "engines": {
31280
31420
  "node": ">=0.12"
@@ -31286,7 +31426,8 @@ module.exports={
31286
31426
  "lint:js": "eslint ./lib ./test/*.js ./docker/**/*.js ./test/framework/*.js ./test/lib/*.js ./test/integration/** ./test/unit/** ",
31287
31427
  "lint:ts": "eslint ./tsdef/*.ts ./lib/**/*.ts",
31288
31428
  "lint": "npm-run-all lint:js lint:ts",
31289
- "test:unit": "npm-run-all build:es5 test:unit:js test:unit:ts",
31429
+ "printVersion": "node --version && npm --version",
31430
+ "test:unit": "npm-run-all printVersion build:es5 test:unit:js test:unit:ts",
31290
31431
  "test:unit:js": "nyc --report-dir=./coverage/js --extension=.js --include=lib/**/* --reporter=html --reporter=lcov --reporter=text mocha ./test/unit/index.js",
31291
31432
  "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",
31292
31433
  "test:serversiderender": "mocha ./test/serversiderender/index.js",
@@ -31345,7 +31486,7 @@ module.exports={
31345
31486
  }
31346
31487
  }
31347
31488
 
31348
- },{}],200:[function(require,module,exports){
31489
+ },{}],201:[function(require,module,exports){
31349
31490
  module.exports = WebSocket;
31350
31491
 
31351
31492
  },{}]},{},[11]);