@opentok/client 2.35.0-alpha.20 → 2.35.0-alpha.22

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.35.0 1fa9a2f4b
2
+ * @license OpenTok.js 2.35.0 d34b5dbad
3
3
  *
4
4
  * Copyright (c) 2010-2026 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Tue, 12 May 2026 08:10:39 GMT
8
+ * Date: Wed, 13 May 2026 07:26:42 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -41649,7 +41649,7 @@ function staticConfigFactory(_temp) {
41649
41649
  _ref$axios = _ref.axios,
41650
41650
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
41651
41651
  _ref$properties = _ref.properties,
41652
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"1fa9a2f4b","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com","vonageApiURL":""} : _ref$properties;
41652
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"d34b5dbad","minimumVersion":{"firefox":52,"chrome":49},"debug":false,"websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com","vonageApiURL":""} : _ref$properties;
41653
41653
  /** @type builtInConfig */
41654
41654
  const builtInConfig = (0, _cloneDeep.default)(properties);
41655
41655
  /**
@@ -43399,6 +43399,7 @@ function PublisherFactory(_ref) {
43399
43399
  * @property {String} remoteSubscriberId The subscriber id of the remote side
43400
43400
  * @property {String} peerId The peerId of this peer connection
43401
43401
  * @property {String} peerConnectionId Our local identifier for this peer connection
43402
+ * @property {String} sourceStreamId The source stream id for this peer connection, either 'MANTIS' or 'P2P'
43402
43403
  */
43403
43404
 
43404
43405
  /**
@@ -44399,10 +44400,14 @@ function PublisherFactory(_ref) {
44399
44400
  };
44400
44401
  const onIceRestartSuccess = peerConnection => {
44401
44402
  const _getPeerConnectionMet4 = getPeerConnectionMeta(peerConnection),
44402
- remoteConnectionId = _getPeerConnectionMet4.remoteConnectionId;
44403
+ remoteConnectionId = _getPeerConnectionMet4.remoteConnectionId,
44404
+ sourceStreamId = _getPeerConnectionMet4.sourceStreamId;
44403
44405
  logRepublish('Success', {
44404
44406
  remoteConnectionId
44405
44407
  });
44408
+ if (sourceStreamId === 'MANTIS' && activeSourceStreamId === 'P2P') {
44409
+ _keepSendingRtcpToMantis(true);
44410
+ }
44406
44411
  };
44407
44412
  const onIceRestartFailure = peerConnection => {
44408
44413
  const _getPeerConnectionMet5 = getPeerConnectionMeta(peerConnection),
@@ -45011,7 +45016,7 @@ function PublisherFactory(_ref) {
45011
45016
  case 3:
45012
45017
  mantisPC = _context13.sent;
45013
45018
  if (!mantisPC) {
45014
- _context13.next = 19;
45019
+ _context13.next = 17;
45015
45020
  break;
45016
45021
  }
45017
45022
  _this.trigger('sourceStreamIdChanged', 'P2P');
@@ -45037,13 +45042,15 @@ function PublisherFactory(_ref) {
45037
45042
  _context13.next = 16;
45038
45043
  return mantisPC.deactivateVideoEncodings();
45039
45044
  case 16:
45040
- if (!(OTHelpers.env.isFirefox && OTHelpers.env.version < 96)) {
45041
- _context13.next = 19;
45042
- break;
45045
+ // In FF < v96, when the media direction is changed to inactive, it stops sending RTCP.
45046
+ // This causes that after ~60 seconds, MANTIS considers the stream is inactive
45047
+ // and destroys it.
45048
+ // As a workaround, we are going to send RTP and RTCP every 30 seconds to keep the
45049
+ // connection alive. See: OPENTOK-44341
45050
+ if (OTHelpers.env.isFirefox && OTHelpers.env.version < 96) {
45051
+ _keepSendingRtcpToMantis();
45043
45052
  }
45044
- _context13.next = 19;
45045
- return _keepSendingRtcpToMantis();
45046
- case 19:
45053
+ case 17:
45047
45054
  case "end":
45048
45055
  return _context13.stop();
45049
45056
  }
@@ -45078,6 +45085,7 @@ function PublisherFactory(_ref) {
45078
45085
  }
45079
45086
  if (_keepSendingRtcpToMantisTimeout) {
45080
45087
  clearTimeout(_keepSendingRtcpToMantisTimeout);
45088
+ _keepSendingRtcpToMantisTimeout = null;
45081
45089
  }
45082
45090
  _this.trigger('sourceStreamIdChanged', 'MANTIS');
45083
45091
  if (!(properties.publishVideo && (properties.publisherAudioFallbackEnabled || getStatsCalled || networkConditionChangedListenersCount > 0))) {
@@ -45099,51 +45107,106 @@ function PublisherFactory(_ref) {
45099
45107
  return _ref24.apply(this, arguments);
45100
45108
  };
45101
45109
  }();
45110
+ const sendRtcpBurst = /*#__PURE__*/function () {
45111
+ var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(peerConnection) {
45112
+ return _regenerator.default.wrap(function _callee15$(_context15) {
45113
+ while (1) switch (_context15.prev = _context15.next) {
45114
+ case 0:
45115
+ _context15.prev = 0;
45116
+ _context15.next = 3;
45117
+ return peerConnection.activateVideoEncodings();
45118
+ case 3:
45119
+ _context15.next = 5;
45120
+ return (0, _promiseDelay.default)(KEEP_SENDING_MEDIA_TO_KEEP_ALIVE);
45121
+ case 5:
45122
+ if (!(activeSourceStreamId === 'P2P')) {
45123
+ _context15.next = 8;
45124
+ break;
45125
+ }
45126
+ _context15.next = 8;
45127
+ return peerConnection.deactivateVideoEncodings();
45128
+ case 8:
45129
+ _context15.next = 13;
45130
+ break;
45131
+ case 10:
45132
+ _context15.prev = 10;
45133
+ _context15.t0 = _context15["catch"](0);
45134
+ logging.error('Error while trying to keep sending RTCP to MANTIS:', _context15.t0);
45135
+ case 13:
45136
+ case "end":
45137
+ return _context15.stop();
45138
+ }
45139
+ }, _callee15, null, [[0, 10]]);
45140
+ }));
45141
+ return function sendRtcpBurst(_x10) {
45142
+ return _ref25.apply(this, arguments);
45143
+ };
45144
+ }();
45102
45145
  const _keepSendingRtcpToMantis = /*#__PURE__*/function () {
45103
- var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
45146
+ var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(onlyOnce) {
45104
45147
  var peerConnection;
45105
- return _regenerator.default.wrap(function _callee16$(_context16) {
45106
- while (1) switch (_context16.prev = _context16.next) {
45148
+ return _regenerator.default.wrap(function _callee17$(_context17) {
45149
+ while (1) switch (_context17.prev = _context17.next) {
45107
45150
  case 0:
45108
- _context16.next = 2;
45151
+ if (onlyOnce === void 0) {
45152
+ onlyOnce = false;
45153
+ }
45154
+ _context17.prev = 1;
45155
+ _context17.next = 4;
45109
45156
  return getMantisPeerConnection();
45110
- case 2:
45111
- peerConnection = _context16.sent;
45157
+ case 4:
45158
+ peerConnection = _context17.sent;
45159
+ _context17.next = 10;
45160
+ break;
45161
+ case 7:
45162
+ _context17.prev = 7;
45163
+ _context17.t0 = _context17["catch"](1);
45164
+ logging.error('Error while trying to get MANTIS peer connection to keep sending RTCP:', _context17.t0);
45165
+ case 10:
45112
45166
  if (peerConnection) {
45113
- _keepSendingRtcpToMantisTimeout = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
45114
- return _regenerator.default.wrap(function _callee15$(_context15) {
45115
- while (1) switch (_context15.prev = _context15.next) {
45167
+ _context17.next = 12;
45168
+ break;
45169
+ }
45170
+ return _context17.abrupt("return");
45171
+ case 12:
45172
+ if (onlyOnce) {
45173
+ sendRtcpBurst(peerConnection);
45174
+ } else {
45175
+ _keepSendingRtcpToMantisTimeout = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
45176
+ return _regenerator.default.wrap(function _callee16$(_context16) {
45177
+ while (1) switch (_context16.prev = _context16.next) {
45116
45178
  case 0:
45117
45179
  if (!(activeSourceStreamId === 'P2P')) {
45118
- _context15.next = 9;
45180
+ _context16.next = 6;
45119
45181
  break;
45120
45182
  }
45121
- _context15.next = 3;
45122
- return peerConnection.activateVideoEncodings();
45183
+ _context16.next = 3;
45184
+ return sendRtcpBurst(peerConnection);
45123
45185
  case 3:
45124
- _context15.next = 5;
45125
- return (0, _promiseDelay.default)(KEEP_SENDING_MEDIA_TO_KEEP_ALIVE);
45126
- case 5:
45127
- _context15.next = 7;
45128
- return peerConnection.deactivateVideoEncodings();
45186
+ if (activeSourceStreamId === 'P2P') {
45187
+ _keepSendingRtcpToMantis();
45188
+ } else {
45189
+ _keepSendingRtcpToMantisTimeout = null;
45190
+ }
45191
+ _context16.next = 7;
45192
+ break;
45193
+ case 6:
45194
+ _keepSendingRtcpToMantisTimeout = null;
45129
45195
  case 7:
45130
- _context15.next = 9;
45131
- return _keepSendingRtcpToMantis();
45132
- case 9:
45133
45196
  case "end":
45134
- return _context15.stop();
45197
+ return _context16.stop();
45135
45198
  }
45136
- }, _callee15);
45199
+ }, _callee16);
45137
45200
  })), KEEP_SENDING_RTCP_DELAY);
45138
45201
  }
45139
- case 4:
45202
+ case 13:
45140
45203
  case "end":
45141
- return _context16.stop();
45204
+ return _context17.stop();
45142
45205
  }
45143
- }, _callee16);
45206
+ }, _callee17, null, [[1, 7]]);
45144
45207
  }));
45145
- return function _keepSendingRtcpToMantis() {
45146
- return _ref25.apply(this, arguments);
45208
+ return function _keepSendingRtcpToMantis(_x11) {
45209
+ return _ref26.apply(this, arguments);
45147
45210
  };
45148
45211
  }();
45149
45212
  const _transitionRoutedToRelayed = () => {
@@ -45179,55 +45242,55 @@ function PublisherFactory(_ref) {
45179
45242
  });
45180
45243
  };
45181
45244
  const _transitionRelayedToRouted = /*#__PURE__*/function () {
45182
- var _ref27 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
45183
- return _regenerator.default.wrap(function _callee17$(_context17) {
45184
- while (1) switch (_context17.prev = _context17.next) {
45245
+ var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
45246
+ return _regenerator.default.wrap(function _callee18$(_context18) {
45247
+ while (1) switch (_context18.prev = _context18.next) {
45185
45248
  case 0:
45186
45249
  if (!(activeSourceStreamId !== 'P2P')) {
45187
- _context17.next = 2;
45250
+ _context18.next = 2;
45188
45251
  break;
45189
45252
  }
45190
- return _context17.abrupt("return");
45253
+ return _context18.abrupt("return");
45191
45254
  case 2:
45192
45255
  logRelayedToRoutedTransition('Attempt');
45193
45256
  if (_this.session) {
45194
- _context17.next = 6;
45257
+ _context18.next = 6;
45195
45258
  break;
45196
45259
  }
45197
45260
  logRelayedToRoutedTransition('Failure', {
45198
45261
  reason: 'Not connected to the session.'
45199
45262
  });
45200
- return _context17.abrupt("return");
45263
+ return _context18.abrupt("return");
45201
45264
  case 6:
45202
45265
  if (_this.streamId) {
45203
- _context17.next = 9;
45266
+ _context18.next = 9;
45204
45267
  break;
45205
45268
  }
45206
45269
  logRelayedToRoutedTransition('Failure', {
45207
45270
  reason: 'No streamId available'
45208
45271
  });
45209
- return _context17.abrupt("return");
45272
+ return _context18.abrupt("return");
45210
45273
  case 9:
45211
- _context17.next = 11;
45274
+ _context18.next = 11;
45212
45275
  return _restartSendingRtpToMantis();
45213
45276
  case 11:
45214
45277
  _this.session._.streamDestroy(_this.streamId, 'P2P');
45215
- _context17.t0 = _this;
45216
- _context17.next = 15;
45278
+ _context18.t0 = _this;
45279
+ _context18.next = 15;
45217
45280
  return getP2pPeerConnection();
45218
45281
  case 15:
45219
- _context17.t1 = _context17.sent;
45220
- _context17.t0._removePeerConnection.call(_context17.t0, _context17.t1);
45282
+ _context18.t1 = _context18.sent;
45283
+ _context18.t0._removePeerConnection.call(_context18.t0, _context18.t1);
45221
45284
  logRelayedToRoutedTransition('Success');
45222
45285
  _this.trigger('streamDestroyForP2PComplete');
45223
45286
  case 19:
45224
45287
  case "end":
45225
- return _context17.stop();
45288
+ return _context18.stop();
45226
45289
  }
45227
- }, _callee17);
45290
+ }, _callee18);
45228
45291
  }));
45229
45292
  return function _transitionRelayedToRouted() {
45230
- return _ref27.apply(this, arguments);
45293
+ return _ref28.apply(this, arguments);
45231
45294
  };
45232
45295
  }();
45233
45296
 
@@ -45359,11 +45422,11 @@ function PublisherFactory(_ref) {
45359
45422
  this.dispatchEvent(event);
45360
45423
  });
45361
45424
  getUserMedia().catch(userMediaError).then( /*#__PURE__*/function () {
45362
- var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(stream) {
45425
+ var _ref29 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(stream) {
45363
45426
  var _audioDevices, _videoDevices;
45364
45427
  var hasVideoFilter, addAudioInputDevicesChangeListener, hasAudioVideoDevices;
45365
- return _regenerator.default.wrap(function _callee18$(_context18) {
45366
- while (1) switch (_context18.prev = _context18.next) {
45428
+ return _regenerator.default.wrap(function _callee19$(_context19) {
45429
+ while (1) switch (_context19.prev = _context19.next) {
45367
45430
  case 0:
45368
45431
  // this comes from deviceHelpers.shouldAskForDevices in a round-about way
45369
45432
  audioDevices = processedOptions.audioDevices;
@@ -45388,7 +45451,7 @@ function PublisherFactory(_ref) {
45388
45451
  // else the wrong device will be returned/nonsensical
45389
45452
  currentDeviceId = (0, _getDeviceIdFromStream.default)(stream, videoDevices);
45390
45453
  }
45391
- _context18.next = 9;
45454
+ _context19.next = 9;
45392
45455
  return onStreamAvailable(stream);
45393
45456
  case 9:
45394
45457
  if (!properties.publishVideo) {
@@ -45403,7 +45466,7 @@ function PublisherFactory(_ref) {
45403
45466
  setCurrentTrackDeviceId(currentDeviceId);
45404
45467
  }
45405
45468
  }
45406
- return _context18.abrupt("return", bindVideo().catch(error => {
45469
+ return _context19.abrupt("return", bindVideo().catch(error => {
45407
45470
  if (error instanceof _cancel.CancellationError) {
45408
45471
  // If we get a CancellationError, it means something newer tried
45409
45472
  // to bindVideo before the old one succeeded, perhaps they called
@@ -45424,118 +45487,118 @@ function PublisherFactory(_ref) {
45424
45487
  }));
45425
45488
  case 12:
45426
45489
  case "end":
45427
- return _context18.stop();
45490
+ return _context19.stop();
45428
45491
  }
45429
- }, _callee18);
45492
+ }, _callee19);
45430
45493
  }));
45431
- return function (_x10) {
45432
- return _ref28.apply(this, arguments);
45494
+ return function (_x12) {
45495
+ return _ref29.apply(this, arguments);
45433
45496
  };
45434
45497
  }());
45435
45498
  });
45436
45499
  return this;
45437
45500
  };
45438
- this._getVideoSenders = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
45439
- return _regenerator.default.wrap(function _callee19$(_context19) {
45440
- while (1) switch (_context19.prev = _context19.next) {
45501
+ this._getVideoSenders = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
45502
+ return _regenerator.default.wrap(function _callee20$(_context20) {
45503
+ while (1) switch (_context20.prev = _context20.next) {
45441
45504
  case 0:
45442
- return _context19.abrupt("return", getAllPeerConnections().then(peerConnections => peerConnections[0].getSenders().filter(_ref30 => {
45443
- let kind = _ref30.track.kind;
45505
+ return _context20.abrupt("return", getAllPeerConnections().then(peerConnections => peerConnections[0].getSenders().filter(_ref31 => {
45506
+ let kind = _ref31.track.kind;
45444
45507
  return kind === 'video';
45445
45508
  })));
45446
45509
  case 1:
45447
45510
  case "end":
45448
- return _context19.stop();
45511
+ return _context20.stop();
45449
45512
  }
45450
- }, _callee19);
45513
+ }, _callee20);
45451
45514
  }));
45452
45515
  this._setScalableValues = /*#__PURE__*/function () {
45453
- var _ref31 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(scalableParam, scalableValues) {
45516
+ var _ref32 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(scalableParam, scalableValues) {
45454
45517
  var senders, sender, sendParameters;
45455
- return _regenerator.default.wrap(function _callee20$(_context20) {
45456
- while (1) switch (_context20.prev = _context20.next) {
45518
+ return _regenerator.default.wrap(function _callee21$(_context21) {
45519
+ while (1) switch (_context21.prev = _context21.next) {
45457
45520
  case 0:
45458
- _context20.next = 2;
45521
+ _context21.next = 2;
45459
45522
  return _this._getVideoSenders();
45460
45523
  case 2:
45461
- senders = _context20.sent;
45524
+ senders = _context21.sent;
45462
45525
  sender = senders[0];
45463
45526
  sendParameters = sender.getParameters();
45464
45527
  sendParameters.encodings.forEach((encoding, index) => {
45465
45528
  encoding[scalableParam] = scalableValues[index]; // eslint-disable-line no-param-reassign
45466
45529
  });
45467
- _context20.next = 8;
45530
+ _context21.next = 8;
45468
45531
  return sender.setParameters(sendParameters);
45469
45532
  case 8:
45470
45533
  case "end":
45471
- return _context20.stop();
45534
+ return _context21.stop();
45472
45535
  }
45473
- }, _callee20);
45536
+ }, _callee21);
45474
45537
  }));
45475
- return function (_x11, _x12) {
45476
- return _ref31.apply(this, arguments);
45538
+ return function (_x13, _x14) {
45539
+ return _ref32.apply(this, arguments);
45477
45540
  };
45478
45541
  }();
45479
45542
  this._setScalabilityMode = /*#__PURE__*/function () {
45480
- var _ref32 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(scalabilityMode, codecsWhitelist) {
45481
- return _regenerator.default.wrap(function _callee21$(_context21) {
45482
- while (1) switch (_context21.prev = _context21.next) {
45543
+ var _ref33 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(scalabilityMode, codecsWhitelist) {
45544
+ return _regenerator.default.wrap(function _callee22$(_context22) {
45545
+ while (1) switch (_context22.prev = _context22.next) {
45483
45546
  case 0:
45484
- return _context21.abrupt("return", setScalabilityMode(_this, scalabilityMode, codecsWhitelist));
45547
+ return _context22.abrupt("return", setScalabilityMode(_this, scalabilityMode, codecsWhitelist));
45485
45548
  case 1:
45486
45549
  case "end":
45487
- return _context21.stop();
45550
+ return _context22.stop();
45488
45551
  }
45489
- }, _callee21);
45552
+ }, _callee22);
45490
45553
  }));
45491
- return function (_x13, _x14) {
45492
- return _ref32.apply(this, arguments);
45554
+ return function (_x15, _x16) {
45555
+ return _ref33.apply(this, arguments);
45493
45556
  };
45494
45557
  }();
45495
45558
  this._setScalableFramerates = /*#__PURE__*/function () {
45496
- var _ref33 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(frameRates) {
45559
+ var _ref34 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(frameRates) {
45497
45560
  var framerateValues;
45498
- return _regenerator.default.wrap(function _callee22$(_context22) {
45499
- while (1) switch (_context22.prev = _context22.next) {
45561
+ return _regenerator.default.wrap(function _callee23$(_context23) {
45562
+ while (1) switch (_context23.prev = _context23.next) {
45500
45563
  case 0:
45501
45564
  framerateValues = normalizeScalableValues(frameRates);
45502
45565
  if (!(framerateValues && areValidFramerates(framerateValues))) {
45503
- _context22.next = 4;
45566
+ _context23.next = 4;
45504
45567
  break;
45505
45568
  }
45506
- _context22.next = 4;
45569
+ _context23.next = 4;
45507
45570
  return _this._setScalableValues('maxFramerate', framerateValues);
45508
45571
  case 4:
45509
45572
  case "end":
45510
- return _context22.stop();
45573
+ return _context23.stop();
45511
45574
  }
45512
- }, _callee22);
45575
+ }, _callee23);
45513
45576
  }));
45514
- return function (_x15) {
45515
- return _ref33.apply(this, arguments);
45577
+ return function (_x17) {
45578
+ return _ref34.apply(this, arguments);
45516
45579
  };
45517
45580
  }();
45518
45581
  this._setScalableVideoLayers = /*#__PURE__*/function () {
45519
- var _ref34 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(videoLayers) {
45582
+ var _ref35 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(videoLayers) {
45520
45583
  var videoLayerValues;
45521
- return _regenerator.default.wrap(function _callee23$(_context23) {
45522
- while (1) switch (_context23.prev = _context23.next) {
45584
+ return _regenerator.default.wrap(function _callee24$(_context24) {
45585
+ while (1) switch (_context24.prev = _context24.next) {
45523
45586
  case 0:
45524
45587
  videoLayerValues = normalizeScalableValues(videoLayers);
45525
45588
  if (!(videoLayerValues && areValidResolutionScales(videoLayerValues))) {
45526
- _context23.next = 4;
45589
+ _context24.next = 4;
45527
45590
  break;
45528
45591
  }
45529
- _context23.next = 4;
45592
+ _context24.next = 4;
45530
45593
  return _this._setScalableValues('scaleResolutionDownBy', videoLayerValues);
45531
45594
  case 4:
45532
45595
  case "end":
45533
- return _context23.stop();
45596
+ return _context24.stop();
45534
45597
  }
45535
- }, _callee23);
45598
+ }, _callee24);
45536
45599
  }));
45537
- return function (_x16) {
45538
- return _ref34.apply(this, arguments);
45600
+ return function (_x18) {
45601
+ return _ref35.apply(this, arguments);
45539
45602
  };
45540
45603
  }();
45541
45604
  const areValidFramerates = framerates => {
@@ -45687,15 +45750,15 @@ function PublisherFactory(_ref) {
45687
45750
  let isTrackManuallyStopped = false;
45688
45751
  const updateVideo = () => {
45689
45752
  const shouldSendVideo = haveWorkingTracks('video') && properties.publishVideo;
45690
- (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
45753
+ (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
45691
45754
  var peerConnections, shouldApplyCustomMaxBitrate, executionSentinel, activePeerConnections;
45692
- return _regenerator.default.wrap(function _callee24$(_context24) {
45693
- while (1) switch (_context24.prev = _context24.next) {
45755
+ return _regenerator.default.wrap(function _callee25$(_context25) {
45756
+ while (1) switch (_context25.prev = _context25.next) {
45694
45757
  case 0:
45695
- _context24.next = 2;
45758
+ _context25.next = 2;
45696
45759
  return getAllPeerConnections();
45697
45760
  case 2:
45698
- peerConnections = _context24.sent;
45761
+ peerConnections = _context25.sent;
45699
45762
  // Set maxBitrare only if video is enabled and customMaxBitrate/videoPreset is enforced.
45700
45763
  // Please note this may disable some encodings in Simulcast VP8.
45701
45764
  shouldApplyCustomMaxBitrate = shouldSendVideo && _videoMaxBitrateSetting;
@@ -45716,10 +45779,10 @@ function PublisherFactory(_ref) {
45716
45779
  });
45717
45780
  }
45718
45781
  }
45719
- _context24.next = 7;
45782
+ _context25.next = 7;
45720
45783
  return getActivePeerConnections();
45721
45784
  case 7:
45722
- activePeerConnections = _context24.sent;
45785
+ activePeerConnections = _context25.sent;
45723
45786
  if (shouldSendVideo && videoQualityChangedListenersCount > 0) {
45724
45787
  activePeerConnections.forEach(peerConnection => {
45725
45788
  peerConnection.enableVideoQualityWatcher();
@@ -45731,9 +45794,9 @@ function PublisherFactory(_ref) {
45731
45794
  }
45732
45795
  case 9:
45733
45796
  case "end":
45734
- return _context24.stop();
45797
+ return _context25.stop();
45735
45798
  }
45736
- }, _callee24);
45799
+ }, _callee25);
45737
45800
  }))();
45738
45801
  if (isCustomVideoTrack && mediaProcessor) {
45739
45802
  const originalTrack = mediaProcessor.getOriginalVideoTrack();
@@ -45759,25 +45822,25 @@ function PublisherFactory(_ref) {
45759
45822
  refreshAudioVideoUI();
45760
45823
  };
45761
45824
  const destroyMediaProcessor = /*#__PURE__*/function () {
45762
- var _ref36 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
45825
+ var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
45763
45826
  var videoTrack;
45764
- return _regenerator.default.wrap(function _callee25$(_context25) {
45765
- while (1) switch (_context25.prev = _context25.next) {
45827
+ return _regenerator.default.wrap(function _callee26$(_context26) {
45828
+ while (1) switch (_context26.prev = _context26.next) {
45766
45829
  case 0:
45767
45830
  // We need to cache this since calling the method below will
45768
45831
  // clear this value.
45769
45832
  videoTrack = mediaProcessor.getOriginalVideoTrack(); // Note: this needs to be called before the `stop` method below. Reversing
45770
45833
  // the order may cause race conditions with the MP worker.
45771
- _context25.prev = 1;
45772
- _context25.next = 4;
45834
+ _context26.prev = 1;
45835
+ _context26.next = 4;
45773
45836
  return mediaProcessor.destroy();
45774
45837
  case 4:
45775
- _context25.next = 9;
45838
+ _context26.next = 9;
45776
45839
  break;
45777
45840
  case 6:
45778
- _context25.prev = 6;
45779
- _context25.t0 = _context25["catch"](1);
45780
- logging.warn(`Error cleaning up mediaProcessor: ${_context25.t0}`);
45841
+ _context26.prev = 6;
45842
+ _context26.t0 = _context26["catch"](1);
45843
+ logging.warn(`Error cleaning up mediaProcessor: ${_context26.t0}`);
45781
45844
  case 9:
45782
45845
  // Since no filtering is being applied, we perform some cleanup. We
45783
45846
  // stop the original video track here since it's not being used
@@ -45785,12 +45848,12 @@ function PublisherFactory(_ref) {
45785
45848
  videoTrack.stop();
45786
45849
  case 10:
45787
45850
  case "end":
45788
- return _context25.stop();
45851
+ return _context26.stop();
45789
45852
  }
45790
- }, _callee25, null, [[1, 6]]);
45853
+ }, _callee26, null, [[1, 6]]);
45791
45854
  }));
45792
45855
  return function destroyMediaProcessor() {
45793
- return _ref36.apply(this, arguments);
45856
+ return _ref37.apply(this, arguments);
45794
45857
  };
45795
45858
  }();
45796
45859
  const hasTrackFromDevice = deviceId =>
@@ -45818,25 +45881,25 @@ function PublisherFactory(_ref) {
45818
45881
  let currentVideoFilter;
45819
45882
  let currentAudioFilter;
45820
45883
  this._toggleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/function () {
45821
- var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(shouldHaveVideo, videoDimensions) {
45884
+ var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(shouldHaveVideo, videoDimensions) {
45822
45885
  var _vidDevices$find;
45823
45886
  var vidDevices, oldTrack, oldTrackDeviceId, newTrack, videoFilter, originalVideoTrack, _originalVideoTrack;
45824
- return _regenerator.default.wrap(function _callee26$(_context26) {
45825
- while (1) switch (_context26.prev = _context26.next) {
45887
+ return _regenerator.default.wrap(function _callee27$(_context27) {
45888
+ while (1) switch (_context27.prev = _context27.next) {
45826
45889
  case 0:
45827
45890
  if (!(isScreenSharing || isCustomVideoTrack || isTrackManuallyStopped)) {
45828
- _context26.next = 2;
45891
+ _context27.next = 2;
45829
45892
  break;
45830
45893
  }
45831
- return _context26.abrupt("return");
45894
+ return _context27.abrupt("return");
45832
45895
  case 2:
45833
- _context26.next = 4;
45896
+ _context27.next = 4;
45834
45897
  return getVideoDevices();
45835
45898
  case 4:
45836
- vidDevices = _context26.sent;
45899
+ vidDevices = _context27.sent;
45837
45900
  oldTrack = getCurrentTrack();
45838
45901
  if (oldTrack) {
45839
- _context26.next = 8;
45902
+ _context27.next = 8;
45840
45903
  break;
45841
45904
  }
45842
45905
  throw otError(Errors.NOT_SUPPORTED, new Error('Publisher._toggleVideo cannot toggleVideo when you have no video source.'));
@@ -45844,17 +45907,17 @@ function PublisherFactory(_ref) {
45844
45907
  // oldTrackDeviceId is undefined when it comes from a canvasTracks, i.e.: it is currently muted
45845
45908
  oldTrackDeviceId = (_vidDevices$find = vidDevices.find(device => device.label === oldTrack.label)) == null ? void 0 : _vidDevices$find.deviceId;
45846
45909
  if (isNewTrackNeeded(shouldHaveVideo, oldTrackDeviceId)) {
45847
- _context26.next = 11;
45910
+ _context27.next = 11;
45848
45911
  break;
45849
45912
  }
45850
- return _context26.abrupt("return");
45913
+ return _context27.abrupt("return");
45851
45914
  case 11:
45852
45915
  if (!(oldTrack.readyState === 'ended')) {
45853
- _context26.next = 14;
45916
+ _context27.next = 14;
45854
45917
  break;
45855
45918
  }
45856
45919
  isTrackManuallyStopped = true;
45857
- return _context26.abrupt("return");
45920
+ return _context27.abrupt("return");
45858
45921
  case 14:
45859
45922
  if (shouldHaveVideo && OTHelpers.env.isAndroid && (OTHelpers.env.isChrome || OTHelpers.env.isSamsung)) {
45860
45923
  // On Chrome on Android you need to stop the previous video track OPENTOK-37206
@@ -45863,17 +45926,17 @@ function PublisherFactory(_ref) {
45863
45926
  }
45864
45927
  }
45865
45928
  if (shouldHaveVideo) {
45866
- _context26.next = 31;
45929
+ _context27.next = 31;
45867
45930
  break;
45868
45931
  }
45869
- _context26.prev = 16;
45932
+ _context27.prev = 16;
45870
45933
  newTrack = (0, _createCanvasVideoTrack.default)(videoDimensions);
45871
- _context26.next = 23;
45934
+ _context27.next = 23;
45872
45935
  break;
45873
45936
  case 20:
45874
- _context26.prev = 20;
45875
- _context26.t0 = _context26["catch"](16);
45876
- return _context26.abrupt("return");
45937
+ _context27.prev = 20;
45938
+ _context27.t0 = _context27["catch"](16);
45939
+ return _context27.abrupt("return");
45877
45940
  case 23:
45878
45941
  if (oldTrackDeviceId) {
45879
45942
  // store the current deviceId to reacquire the video later
@@ -45882,13 +45945,13 @@ function PublisherFactory(_ref) {
45882
45945
  setCurrentTrackDeviceId(newTrack.label);
45883
45946
  videoFilter = mediaProcessor.getVideoFilter();
45884
45947
  if (!videoFilter) {
45885
- _context26.next = 30;
45948
+ _context27.next = 30;
45886
45949
  break;
45887
45950
  }
45888
45951
  // Save the current video filter because we want to make sure it
45889
45952
  // gets enabled when the user publishes video again
45890
45953
  currentVideoFilter = videoFilter;
45891
- _context26.next = 30;
45954
+ _context27.next = 30;
45892
45955
  return destroyMediaProcessor();
45893
45956
  case 30:
45894
45957
  if (_videoMediaProcessorConnector) {
@@ -45897,102 +45960,102 @@ function PublisherFactory(_ref) {
45897
45960
  }
45898
45961
  case 31:
45899
45962
  if (!(currentDeviceId && vidDevices.findIndex(device => device.deviceId === currentDeviceId) === -1)) {
45900
- _context26.next = 33;
45963
+ _context27.next = 33;
45901
45964
  break;
45902
45965
  }
45903
45966
  throw otError(Errors.NO_DEVICES_FOUND, new Error('Previous device no longer available - deviceId not found'));
45904
45967
  case 33:
45905
45968
  privateEvents.emit('streamDestroy');
45906
45969
  if (!shouldHaveVideo) {
45907
- _context26.next = 64;
45970
+ _context27.next = 64;
45908
45971
  break;
45909
45972
  }
45910
45973
  if (!hasTrackFromDevice(currentDeviceId)) {
45911
- _context26.next = 37;
45974
+ _context27.next = 37;
45912
45975
  break;
45913
45976
  }
45914
- return _context26.abrupt("return");
45977
+ return _context27.abrupt("return");
45915
45978
  case 37:
45916
- _context26.prev = 37;
45917
- _context26.next = 40;
45979
+ _context27.prev = 37;
45980
+ _context27.next = 40;
45918
45981
  return getTrackFromDeviceId(currentDeviceId);
45919
45982
  case 40:
45920
- newTrack = _context26.sent;
45921
- _context26.next = 47;
45983
+ newTrack = _context27.sent;
45984
+ _context27.next = 47;
45922
45985
  break;
45923
45986
  case 43:
45924
- _context26.prev = 43;
45925
- _context26.t1 = _context26["catch"](37);
45926
- logging.error(`Error getting new track for current device(${currentDeviceId}): ${_context26.t1}`);
45927
- throw _context26.t1;
45987
+ _context27.prev = 43;
45988
+ _context27.t1 = _context27["catch"](37);
45989
+ logging.error(`Error getting new track for current device(${currentDeviceId}): ${_context27.t1}`);
45990
+ throw _context27.t1;
45928
45991
  case 47:
45929
45992
  if (newTrack) {
45930
- _context26.next = 50;
45993
+ _context27.next = 50;
45931
45994
  break;
45932
45995
  }
45933
45996
  logging.error('Failed to enable video. It was not possible to get a new track from the camera');
45934
- return _context26.abrupt("return");
45997
+ return _context27.abrupt("return");
45935
45998
  case 50:
45936
45999
  if (!currentVideoFilter) {
45937
- _context26.next = 59;
46000
+ _context27.next = 59;
45938
46001
  break;
45939
46002
  }
45940
46003
  originalVideoTrack = mediaProcessor.getOriginalVideoTrack();
45941
- _context26.next = 54;
46004
+ _context27.next = 54;
45942
46005
  return mediaProcessor.setVideoFilter(currentVideoFilter, true);
45943
46006
  case 54:
45944
- _context26.next = 56;
46007
+ _context27.next = 56;
45945
46008
  return mediaProcessor.setMediaStream(webRTCStream);
45946
46009
  case 56:
45947
- _context26.next = 58;
46010
+ _context27.next = 58;
45948
46011
  return mediaProcessor.setVideoTrack(newTrack);
45949
46012
  case 58:
45950
- newTrack = _context26.sent;
46013
+ newTrack = _context27.sent;
45951
46014
  case 59:
45952
46015
  if (!_videoMediaProcessorConnector) {
45953
- _context26.next = 64;
46016
+ _context27.next = 64;
45954
46017
  break;
45955
46018
  }
45956
46019
  originalVideoTrack = _videoMediaProcessorConnector.originalTrack;
45957
- _context26.next = 63;
46020
+ _context27.next = 63;
45958
46021
  return _videoMediaProcessorConnector.setTrack(newTrack);
45959
46022
  case 63:
45960
- newTrack = _context26.sent;
46023
+ newTrack = _context27.sent;
45961
46024
  case 64:
45962
- _context26.prev = 64;
45963
- _context26.next = 67;
46025
+ _context27.prev = 64;
46026
+ _context27.next = 67;
45964
46027
  return replaceTrackAndUpdate(oldTrack, newTrack);
45965
46028
  case 67:
45966
46029
  // We stop the original track as a final step because whatever effects
45967
46030
  // were applied to it should remain in effect until the new track is
45968
46031
  // set
45969
46032
  (_originalVideoTrack = originalVideoTrack) == null ? void 0 : _originalVideoTrack.stop();
45970
- _context26.next = 73;
46033
+ _context27.next = 73;
45971
46034
  break;
45972
46035
  case 70:
45973
- _context26.prev = 70;
45974
- _context26.t2 = _context26["catch"](64);
45975
- throw _context26.t2;
46036
+ _context27.prev = 70;
46037
+ _context27.t2 = _context27["catch"](64);
46038
+ throw _context27.t2;
45976
46039
  case 73:
45977
46040
  case "end":
45978
- return _context26.stop();
46041
+ return _context27.stop();
45979
46042
  }
45980
- }, _callee26, null, [[16, 20], [37, 43], [64, 70]]);
46043
+ }, _callee27, null, [[16, 20], [37, 43], [64, 70]]);
45981
46044
  }));
45982
- return function (_x17, _x18) {
45983
- return _ref37.apply(this, arguments);
46045
+ return function (_x19, _x20) {
46046
+ return _ref38.apply(this, arguments);
45984
46047
  };
45985
46048
  }());
45986
46049
  const resetCongestionLevelEstimationOnPeerConnection = (0, _cancellation.callWithCancellation)( /*#__PURE__*/function () {
45987
- var _ref38 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(isActive, cancellation) {
46050
+ var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(isActive, cancellation) {
45988
46051
  var peerConnections;
45989
- return _regenerator.default.wrap(function _callee27$(_context27) {
45990
- while (1) switch (_context27.prev = _context27.next) {
46052
+ return _regenerator.default.wrap(function _callee28$(_context28) {
46053
+ while (1) switch (_context28.prev = _context28.next) {
45991
46054
  case 0:
45992
- _context27.next = 2;
46055
+ _context28.next = 2;
45993
46056
  return getAllPeerConnections();
45994
46057
  case 2:
45995
- peerConnections = _context27.sent;
46058
+ peerConnections = _context28.sent;
45996
46059
  if (!cancellation.isCanceled()) {
45997
46060
  peerConnections.forEach(peerConnection => {
45998
46061
  if (isActive) {
@@ -46004,12 +46067,12 @@ function PublisherFactory(_ref) {
46004
46067
  }
46005
46068
  case 4:
46006
46069
  case "end":
46007
- return _context27.stop();
46070
+ return _context28.stop();
46008
46071
  }
46009
- }, _callee27);
46072
+ }, _callee28);
46010
46073
  }));
46011
- return function (_x19, _x20) {
46012
- return _ref38.apply(this, arguments);
46074
+ return function (_x21, _x22) {
46075
+ return _ref39.apply(this, arguments);
46013
46076
  };
46014
46077
  }());
46015
46078
  const resetAudioFallbackState = () => {
@@ -46019,10 +46082,10 @@ function PublisherFactory(_ref) {
46019
46082
  (_chromeMixin2 = chromeMixin) == null ? void 0 : _chromeMixin2.videoDisabledIndicator.setWarning(false);
46020
46083
  };
46021
46084
  const onAudioFallbackActiveVideo = /*#__PURE__*/function () {
46022
- var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(previousState) {
46085
+ var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(previousState) {
46023
46086
  var _chromeMixin3, _chromeMixin4;
46024
- return _regenerator.default.wrap(function _callee28$(_context28) {
46025
- while (1) switch (_context28.prev = _context28.next) {
46087
+ return _regenerator.default.wrap(function _callee29$(_context29) {
46088
+ while (1) switch (_context29.prev = _context29.next) {
46026
46089
  case 0:
46027
46090
  (_chromeMixin3 = chromeMixin) == null ? void 0 : _chromeMixin3.videoDisabledIndicator.disableVideo(false);
46028
46091
  (_chromeMixin4 = chromeMixin) == null ? void 0 : _chromeMixin4.videoDisabledIndicator.setWarning(false);
@@ -46036,12 +46099,12 @@ function PublisherFactory(_ref) {
46036
46099
  }
46037
46100
  case 4:
46038
46101
  case "end":
46039
- return _context28.stop();
46102
+ return _context29.stop();
46040
46103
  }
46041
- }, _callee28);
46104
+ }, _callee29);
46042
46105
  }));
46043
- return function onAudioFallbackActiveVideo(_x21) {
46044
- return _ref39.apply(this, arguments);
46106
+ return function onAudioFallbackActiveVideo(_x23) {
46107
+ return _ref40.apply(this, arguments);
46045
46108
  };
46046
46109
  }();
46047
46110
  const onAudioFallbackActiveVideoWithWarning = () => {
@@ -46052,10 +46115,10 @@ function PublisherFactory(_ref) {
46052
46115
  this.trigger('videoDisableWarning');
46053
46116
  };
46054
46117
  const onAudioFallbackSuspendedVideo = /*#__PURE__*/function () {
46055
- var _ref40 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
46118
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
46056
46119
  var _chromeMixin6;
46057
- return _regenerator.default.wrap(function _callee29$(_context29) {
46058
- while (1) switch (_context29.prev = _context29.next) {
46120
+ return _regenerator.default.wrap(function _callee30$(_context30) {
46121
+ while (1) switch (_context30.prev = _context30.next) {
46059
46122
  case 0:
46060
46123
  if (properties.publishVideo) {
46061
46124
  (_chromeMixin6 = chromeMixin) == null ? void 0 : _chromeMixin6.videoDisabledIndicator.disableVideo(true);
@@ -46065,12 +46128,12 @@ function PublisherFactory(_ref) {
46065
46128
  });
46066
46129
  case 2:
46067
46130
  case "end":
46068
- return _context29.stop();
46131
+ return _context30.stop();
46069
46132
  }
46070
- }, _callee29);
46133
+ }, _callee30);
46071
46134
  }));
46072
46135
  return function onAudioFallbackSuspendedVideo() {
46073
- return _ref40.apply(this, arguments);
46136
+ return _ref41.apply(this, arguments);
46074
46137
  };
46075
46138
  }();
46076
46139
  let audioFallbackCoordinator;
@@ -46083,9 +46146,9 @@ function PublisherFactory(_ref) {
46083
46146
  [_audioFallbackVideoStates.default.ACTIVE_VIDEO_WITH_WARNING]: onAudioFallbackActiveVideoWithWarning,
46084
46147
  [_audioFallbackVideoStates.default.SUSPENDED_VIDEO]: onAudioFallbackSuspendedVideo
46085
46148
  };
46086
- audioFallbackCoordinator.on('stateChange', _ref41 => {
46087
- let previousState = _ref41.previousState,
46088
- audioFallbackVideoState = _ref41.state;
46149
+ audioFallbackCoordinator.on('stateChange', _ref42 => {
46150
+ let previousState = _ref42.previousState,
46151
+ audioFallbackVideoState = _ref42.state;
46089
46152
  try {
46090
46153
  audioFallbackStateHandlers[audioFallbackVideoState](previousState);
46091
46154
  } catch (err) {
@@ -46177,10 +46240,10 @@ function PublisherFactory(_ref) {
46177
46240
  return this;
46178
46241
  };
46179
46242
  this._publishVideo = /*#__PURE__*/function () {
46180
- var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(value) {
46243
+ var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(value) {
46181
46244
  var videoDimensions;
46182
- return _regenerator.default.wrap(function _callee30$(_context30) {
46183
- while (1) switch (_context30.prev = _context30.next) {
46245
+ return _regenerator.default.wrap(function _callee31$(_context31) {
46246
+ while (1) switch (_context31.prev = _context31.next) {
46184
46247
  case 0:
46185
46248
  // Save videoDimensions to not alter video size between mute states.
46186
46249
  videoDimensions = getVideoDimensions();
@@ -46194,16 +46257,16 @@ function PublisherFactory(_ref) {
46194
46257
  resetAudioFallbackState();
46195
46258
  }
46196
46259
  }
46197
- _context30.next = 5;
46260
+ _context31.next = 5;
46198
46261
  return Promise.all([_this._toggleVideo(properties.publishVideo, videoDimensions), updateVideo()]);
46199
46262
  case 5:
46200
46263
  case "end":
46201
- return _context30.stop();
46264
+ return _context31.stop();
46202
46265
  }
46203
- }, _callee30);
46266
+ }, _callee31);
46204
46267
  }));
46205
- return function (_x22) {
46206
- return _ref42.apply(this, arguments);
46268
+ return function (_x24) {
46269
+ return _ref43.apply(this, arguments);
46207
46270
  };
46208
46271
  }();
46209
46272
 
@@ -46478,42 +46541,42 @@ function PublisherFactory(_ref) {
46478
46541
  {
46479
46542
  let videoIndex = 0;
46480
46543
  const cycleVideo = /*#__PURE__*/function () {
46481
- var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
46544
+ var _ref44 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
46482
46545
  var oldTrack, vidDevices, hasOtherVideoDevices, newVideoDevice, deviceId;
46483
- return _regenerator.default.wrap(function _callee31$(_context31) {
46484
- while (1) switch (_context31.prev = _context31.next) {
46546
+ return _regenerator.default.wrap(function _callee32$(_context32) {
46547
+ while (1) switch (_context32.prev = _context32.next) {
46485
46548
  case 0:
46486
46549
  if (!(OTHelpers.env.isLegacyEdge || !windowMock.RTCRtpSender || typeof windowMock.RTCRtpSender.prototype.replaceTrack !== 'function')) {
46487
- _context31.next = 2;
46550
+ _context32.next = 2;
46488
46551
  break;
46489
46552
  }
46490
46553
  throw otError(Errors.UNSUPPORTED_BROWSER, new Error('Publisher#cycleVideo is not supported in your browser.'), ExceptionCodes.UNABLE_TO_PUBLISH);
46491
46554
  case 2:
46492
46555
  if (!(isCustomVideoTrack || isScreenSharing)) {
46493
- _context31.next = 4;
46556
+ _context32.next = 4;
46494
46557
  break;
46495
46558
  }
46496
46559
  throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#cycleVideo: The publisher is not using a camera video source'));
46497
46560
  case 4:
46498
46561
  oldTrack = getCurrentTrack();
46499
46562
  if (oldTrack) {
46500
- _context31.next = 7;
46563
+ _context32.next = 7;
46501
46564
  break;
46502
46565
  }
46503
46566
  throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#cycleVideo cannot cycleVideo when you have no video source.'));
46504
46567
  case 7:
46505
46568
  videoIndex += 1;
46506
- _context31.next = 10;
46569
+ _context32.next = 10;
46507
46570
  return getVideoDevices();
46508
46571
  case 10:
46509
- vidDevices = _context31.sent;
46572
+ vidDevices = _context32.sent;
46510
46573
  // different devices return the cameras in different orders
46511
46574
  hasOtherVideoDevices = vidDevices.filter(device => device.deviceId !== currentDeviceId).length > 0;
46512
46575
  if (hasOtherVideoDevices) {
46513
- _context31.next = 14;
46576
+ _context32.next = 14;
46514
46577
  break;
46515
46578
  }
46516
- return _context31.abrupt("return", currentDeviceId);
46579
+ return _context32.abrupt("return", currentDeviceId);
46517
46580
  case 14:
46518
46581
  while (vidDevices[videoIndex % vidDevices.length].deviceId === currentDeviceId) {
46519
46582
  videoIndex += 1;
@@ -46521,18 +46584,18 @@ function PublisherFactory(_ref) {
46521
46584
  privateEvents.emit('streamDestroy');
46522
46585
  newVideoDevice = vidDevices[videoIndex % vidDevices.length];
46523
46586
  deviceId = newVideoDevice.deviceId;
46524
- _context31.next = 20;
46587
+ _context32.next = 20;
46525
46588
  return attemptToSetVideoTrack(deviceId, 'cycleVideo');
46526
46589
  case 20:
46527
- return _context31.abrupt("return", currentDeviceId);
46590
+ return _context32.abrupt("return", currentDeviceId);
46528
46591
  case 21:
46529
46592
  case "end":
46530
- return _context31.stop();
46593
+ return _context32.stop();
46531
46594
  }
46532
- }, _callee31);
46595
+ }, _callee32);
46533
46596
  }));
46534
46597
  return function cycleVideo() {
46535
- return _ref43.apply(this, arguments);
46598
+ return _ref44.apply(this, arguments);
46536
46599
  };
46537
46600
  }();
46538
46601
 
@@ -46577,75 +46640,75 @@ function PublisherFactory(_ref) {
46577
46640
  *
46578
46641
  * @see <a href="#setVideoSource">Publisher.setVideoSource()</a>
46579
46642
  */
46580
- this.cycleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
46643
+ this.cycleVideo = (0, _blockCallsUntilComplete.default)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
46581
46644
  var deviceId;
46582
- return _regenerator.default.wrap(function _callee32$(_context32) {
46583
- while (1) switch (_context32.prev = _context32.next) {
46645
+ return _regenerator.default.wrap(function _callee33$(_context33) {
46646
+ while (1) switch (_context33.prev = _context33.next) {
46584
46647
  case 0:
46585
- _context32.prev = 0;
46586
- _context32.next = 3;
46648
+ _context33.prev = 0;
46649
+ _context33.next = 3;
46587
46650
  return cycleVideo();
46588
46651
  case 3:
46589
- deviceId = _context32.sent;
46590
- _context32.next = 10;
46652
+ deviceId = _context33.sent;
46653
+ _context33.next = 10;
46591
46654
  break;
46592
46655
  case 6:
46593
- _context32.prev = 6;
46594
- _context32.t0 = _context32["catch"](0);
46595
- logging.error(`Publisher#cycleVideo: could not cycle video: ${_context32.t0}`);
46596
- throw _context32.t0;
46656
+ _context33.prev = 6;
46657
+ _context33.t0 = _context33["catch"](0);
46658
+ logging.error(`Publisher#cycleVideo: could not cycle video: ${_context33.t0}`);
46659
+ throw _context33.t0;
46597
46660
  case 10:
46598
- return _context32.abrupt("return", {
46661
+ return _context33.abrupt("return", {
46599
46662
  deviceId
46600
46663
  });
46601
46664
  case 11:
46602
46665
  case "end":
46603
- return _context32.stop();
46666
+ return _context33.stop();
46604
46667
  }
46605
- }, _callee32, null, [[0, 6]]);
46668
+ }, _callee33, null, [[0, 6]]);
46606
46669
  })));
46607
46670
  }
46608
46671
  const replaceTrackAndUpdate = /*#__PURE__*/function () {
46609
- var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(oldTrack, newTrack) {
46672
+ var _ref46 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(oldTrack, newTrack) {
46610
46673
  var pcs, video;
46611
- return _regenerator.default.wrap(function _callee34$(_context34) {
46612
- while (1) switch (_context34.prev = _context34.next) {
46674
+ return _regenerator.default.wrap(function _callee35$(_context35) {
46675
+ while (1) switch (_context35.prev = _context35.next) {
46613
46676
  case 0:
46614
- _context34.next = 2;
46677
+ _context35.next = 2;
46615
46678
  return getAllPeerConnections();
46616
46679
  case 2:
46617
- pcs = _context34.sent;
46618
- _context34.next = 5;
46680
+ pcs = _context35.sent;
46681
+ _context35.next = 5;
46619
46682
  return Promise.all(pcs.map( /*#__PURE__*/function () {
46620
- var _ref46 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(pc) {
46621
- return _regenerator.default.wrap(function _callee33$(_context33) {
46622
- while (1) switch (_context33.prev = _context33.next) {
46683
+ var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(pc) {
46684
+ return _regenerator.default.wrap(function _callee34$(_context34) {
46685
+ while (1) switch (_context34.prev = _context34.next) {
46623
46686
  case 0:
46624
- _context33.next = 2;
46687
+ _context34.next = 2;
46625
46688
  return pc.findAndReplaceTrack(oldTrack, newTrack);
46626
46689
  case 2:
46627
46690
  pc._setP2PDefaultMaxBitrate();
46628
46691
  case 3:
46629
46692
  case "end":
46630
- return _context33.stop();
46693
+ return _context34.stop();
46631
46694
  }
46632
- }, _callee33);
46695
+ }, _callee34);
46633
46696
  }));
46634
- return function (_x25) {
46635
- return _ref46.apply(this, arguments);
46697
+ return function (_x27) {
46698
+ return _ref47.apply(this, arguments);
46636
46699
  };
46637
46700
  }()));
46638
46701
  case 5:
46639
46702
  webRTCStream.removeTrack(oldTrack);
46640
46703
  webRTCStream.addTrack(newTrack);
46641
46704
  if (!(newTrack.id !== filteredVideoTrackId)) {
46642
- _context34.next = 11;
46705
+ _context35.next = 11;
46643
46706
  break;
46644
46707
  }
46645
46708
  if (oldTrack && oldTrack.stop) {
46646
46709
  oldTrack.stop();
46647
46710
  }
46648
- _context34.next = 11;
46711
+ _context35.next = 11;
46649
46712
  return applyVideoConstraintsTo(newTrack);
46650
46713
  case 11:
46651
46714
  if (OTHelpers.env.name === 'Firefox' || OTHelpers.env.name === 'Safari') {
@@ -46664,20 +46727,20 @@ function PublisherFactory(_ref) {
46664
46727
  updateVideo();
46665
46728
  case 16:
46666
46729
  case "end":
46667
- return _context34.stop();
46730
+ return _context35.stop();
46668
46731
  }
46669
- }, _callee34);
46732
+ }, _callee35);
46670
46733
  }));
46671
- return function replaceTrackAndUpdate(_x23, _x24) {
46672
- return _ref45.apply(this, arguments);
46734
+ return function replaceTrackAndUpdate(_x25, _x26) {
46735
+ return _ref46.apply(this, arguments);
46673
46736
  };
46674
46737
  }();
46675
46738
  const getTrackFromDeviceId = /*#__PURE__*/function () {
46676
- var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(deviceId) {
46739
+ var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(deviceId) {
46677
46740
  var _newVideoStream;
46678
46741
  var oldTrackDeviceId, newOptions, _processedOptions2, getUserMediaHelper, newVideoStream, _newVideoStream$getVi, track;
46679
- return _regenerator.default.wrap(function _callee35$(_context35) {
46680
- while (1) switch (_context35.prev = _context35.next) {
46742
+ return _regenerator.default.wrap(function _callee36$(_context36) {
46743
+ while (1) switch (_context36.prev = _context36.next) {
46681
46744
  case 0:
46682
46745
  oldTrackDeviceId = getCurrentTrackDeviceId();
46683
46746
  setCurrentTrackDeviceId(deviceId);
@@ -46690,32 +46753,32 @@ function PublisherFactory(_ref) {
46690
46753
  accessDialogClosed: onAccessDialogClosed
46691
46754
  });
46692
46755
  _processedOptions2 = processedOptions, getUserMediaHelper = _processedOptions2.getUserMedia;
46693
- _context35.prev = 8;
46694
- _context35.next = 11;
46756
+ _context36.prev = 8;
46757
+ _context36.next = 11;
46695
46758
  return getUserMediaHelper();
46696
46759
  case 11:
46697
- newVideoStream = _context35.sent;
46698
- _context35.next = 18;
46760
+ newVideoStream = _context36.sent;
46761
+ _context36.next = 18;
46699
46762
  break;
46700
46763
  case 14:
46701
- _context35.prev = 14;
46702
- _context35.t0 = _context35["catch"](8);
46703
- logging.error(_context35.t0);
46704
- throw _context35.t0;
46764
+ _context36.prev = 14;
46765
+ _context36.t0 = _context36["catch"](8);
46766
+ logging.error(_context36.t0);
46767
+ throw _context36.t0;
46705
46768
  case 18:
46706
46769
  _newVideoStream$getVi = (_newVideoStream = newVideoStream) == null ? void 0 : _newVideoStream.getVideoTracks(), track = _newVideoStream$getVi[0];
46707
46770
  if (!track) {
46708
46771
  setCurrentTrackDeviceId(oldTrackDeviceId);
46709
46772
  }
46710
- return _context35.abrupt("return", track);
46773
+ return _context36.abrupt("return", track);
46711
46774
  case 21:
46712
46775
  case "end":
46713
- return _context35.stop();
46776
+ return _context36.stop();
46714
46777
  }
46715
- }, _callee35, null, [[8, 14]]);
46778
+ }, _callee36, null, [[8, 14]]);
46716
46779
  }));
46717
- return function getTrackFromDeviceId(_x26) {
46718
- return _ref47.apply(this, arguments);
46780
+ return function getTrackFromDeviceId(_x28) {
46781
+ return _ref48.apply(this, arguments);
46719
46782
  };
46720
46783
  }();
46721
46784
  const getCurrentTrack = () => {
@@ -46732,96 +46795,96 @@ function PublisherFactory(_ref) {
46732
46795
  _currentTrackDeviceId = deviceId;
46733
46796
  };
46734
46797
  const getVideoDevices = /*#__PURE__*/function () {
46735
- var _ref48 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
46798
+ var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
46736
46799
  var devices, vidDevices;
46737
- return _regenerator.default.wrap(function _callee36$(_context36) {
46738
- while (1) switch (_context36.prev = _context36.next) {
46800
+ return _regenerator.default.wrap(function _callee37$(_context37) {
46801
+ while (1) switch (_context37.prev = _context37.next) {
46739
46802
  case 0:
46740
- _context36.next = 2;
46803
+ _context37.next = 2;
46741
46804
  return deviceHelpers.shouldAskForDevices();
46742
46805
  case 2:
46743
- devices = _context36.sent;
46806
+ devices = _context37.sent;
46744
46807
  vidDevices = devices.videoDevices;
46745
46808
  if (!(!devices.video || !vidDevices || !vidDevices.length)) {
46746
- _context36.next = 6;
46809
+ _context37.next = 6;
46747
46810
  break;
46748
46811
  }
46749
46812
  throw otError(Errors.NO_DEVICES_FOUND, new Error('No video devices available'), ExceptionCodes.UNABLE_TO_PUBLISH);
46750
46813
  case 6:
46751
- return _context36.abrupt("return", vidDevices);
46814
+ return _context37.abrupt("return", vidDevices);
46752
46815
  case 7:
46753
46816
  case "end":
46754
- return _context36.stop();
46817
+ return _context37.stop();
46755
46818
  }
46756
- }, _callee36);
46819
+ }, _callee37);
46757
46820
  }));
46758
46821
  return function getVideoDevices() {
46759
- return _ref48.apply(this, arguments);
46822
+ return _ref49.apply(this, arguments);
46760
46823
  };
46761
46824
  }();
46762
46825
  const replaceAudioTrackInPeerConnections = /*#__PURE__*/function () {
46763
- var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(oldTrack, newTrack) {
46826
+ var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(oldTrack, newTrack) {
46764
46827
  var _this$session$session2;
46765
46828
  var activePeerConnection, inactivePeerConnection, pcs;
46766
- return _regenerator.default.wrap(function _callee37$(_context37) {
46767
- while (1) switch (_context37.prev = _context37.next) {
46829
+ return _regenerator.default.wrap(function _callee38$(_context38) {
46830
+ while (1) switch (_context38.prev = _context38.next) {
46768
46831
  case 0:
46769
46832
  if (_this.session) {
46770
- _context37.next = 2;
46833
+ _context38.next = 2;
46771
46834
  break;
46772
46835
  }
46773
- return _context37.abrupt("return");
46836
+ return _context38.abrupt("return");
46774
46837
  case 2:
46775
46838
  if (!((_this$session$session2 = _this.session.sessionInfo) != null && _this$session$session2.isAdaptiveEnabled && activeSourceStreamId === 'P2P')) {
46776
- _context37.next = 15;
46839
+ _context38.next = 15;
46777
46840
  break;
46778
46841
  }
46779
- _context37.next = 5;
46842
+ _context38.next = 5;
46780
46843
  return getP2pPeerConnection();
46781
46844
  case 5:
46782
- activePeerConnection = _context37.sent;
46783
- _context37.next = 8;
46845
+ activePeerConnection = _context38.sent;
46846
+ _context38.next = 8;
46784
46847
  return activePeerConnection == null ? void 0 : activePeerConnection.findAndReplaceTrack(oldTrack, newTrack);
46785
46848
  case 8:
46786
- _context37.next = 10;
46849
+ _context38.next = 10;
46787
46850
  return getMantisPeerConnection();
46788
46851
  case 10:
46789
- inactivePeerConnection = _context37.sent;
46790
- _context37.next = 13;
46852
+ inactivePeerConnection = _context38.sent;
46853
+ _context38.next = 13;
46791
46854
  return amrAudioTrackProcessor.replaceTrackInMutedAudioTracks(inactivePeerConnection, oldTrack, newTrack);
46792
46855
  case 13:
46793
- _context37.next = 20;
46856
+ _context38.next = 20;
46794
46857
  break;
46795
46858
  case 15:
46796
- _context37.next = 17;
46859
+ _context38.next = 17;
46797
46860
  return getAllPeerConnections();
46798
46861
  case 17:
46799
- pcs = _context37.sent;
46800
- _context37.next = 20;
46862
+ pcs = _context38.sent;
46863
+ _context38.next = 20;
46801
46864
  return Promise.all(pcs.map(pc => pc.findAndReplaceTrack(oldTrack, newTrack)));
46802
46865
  case 20:
46803
46866
  case "end":
46804
- return _context37.stop();
46867
+ return _context38.stop();
46805
46868
  }
46806
- }, _callee37);
46869
+ }, _callee38);
46807
46870
  }));
46808
- return function replaceAudioTrackInPeerConnections(_x27, _x28) {
46809
- return _ref49.apply(this, arguments);
46871
+ return function replaceAudioTrackInPeerConnections(_x29, _x30) {
46872
+ return _ref50.apply(this, arguments);
46810
46873
  };
46811
46874
  }();
46812
46875
  const replaceAudioTrack = /*#__PURE__*/function () {
46813
- var _ref50 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(oldTrack, newTrack) {
46876
+ var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(oldTrack, newTrack) {
46814
46877
  var video, isFilteredTrack;
46815
- return _regenerator.default.wrap(function _callee38$(_context38) {
46816
- while (1) switch (_context38.prev = _context38.next) {
46878
+ return _regenerator.default.wrap(function _callee39$(_context39) {
46879
+ while (1) switch (_context39.prev = _context39.next) {
46817
46880
  case 0:
46818
46881
  if (!(oldTrack === newTrack)) {
46819
- _context38.next = 2;
46882
+ _context39.next = 2;
46820
46883
  break;
46821
46884
  }
46822
- return _context38.abrupt("return");
46885
+ return _context39.abrupt("return");
46823
46886
  case 2:
46824
- _context38.next = 4;
46887
+ _context39.next = 4;
46825
46888
  return replaceAudioTrackInPeerConnections(oldTrack, newTrack);
46826
46889
  case 4:
46827
46890
  if (newTrack) {
@@ -46863,23 +46926,23 @@ function PublisherFactory(_ref) {
46863
46926
  refreshAudioVideoUI();
46864
46927
  case 14:
46865
46928
  case "end":
46866
- return _context38.stop();
46929
+ return _context39.stop();
46867
46930
  }
46868
- }, _callee38);
46931
+ }, _callee39);
46869
46932
  }));
46870
- return function replaceAudioTrack(_x29, _x30) {
46871
- return _ref50.apply(this, arguments);
46933
+ return function replaceAudioTrack(_x31, _x32) {
46934
+ return _ref51.apply(this, arguments);
46872
46935
  };
46873
46936
  }();
46874
46937
  const resetAudioSource = /*#__PURE__*/function () {
46875
- var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(audioTrack) {
46938
+ var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(audioTrack) {
46876
46939
  var audioDeviceId, newAudioTrack;
46877
- return _regenerator.default.wrap(function _callee39$(_context39) {
46878
- while (1) switch (_context39.prev = _context39.next) {
46940
+ return _regenerator.default.wrap(function _callee40$(_context40) {
46941
+ while (1) switch (_context40.prev = _context40.next) {
46879
46942
  case 0:
46880
46943
  audioDeviceId = audioTrack.getSettings().deviceId;
46881
- _context39.prev = 1;
46882
- _context39.next = 4;
46944
+ _context40.prev = 1;
46945
+ _context40.next = 4;
46883
46946
  return _this.setAudioSource(audioDeviceId);
46884
46947
  case 4:
46885
46948
  // We need to add the onmute listener to the new audio track.
@@ -46888,20 +46951,20 @@ function PublisherFactory(_ref) {
46888
46951
  newAudioTrack.onmute = () => handleBuggedMutedLocalAudioTrack(newAudioTrack);
46889
46952
  newAudioTrack.onunmute = () => handleBuggedUnMutedLocalAudioTrack(newAudioTrack);
46890
46953
  }
46891
- _context39.next = 11;
46954
+ _context40.next = 11;
46892
46955
  break;
46893
46956
  case 8:
46894
- _context39.prev = 8;
46895
- _context39.t0 = _context39["catch"](1);
46896
- logging.error(_context39.t0);
46957
+ _context40.prev = 8;
46958
+ _context40.t0 = _context40["catch"](1);
46959
+ logging.error(_context40.t0);
46897
46960
  case 11:
46898
46961
  case "end":
46899
- return _context39.stop();
46962
+ return _context40.stop();
46900
46963
  }
46901
- }, _callee39, null, [[1, 8]]);
46964
+ }, _callee40, null, [[1, 8]]);
46902
46965
  }));
46903
- return function resetAudioSource(_x31) {
46904
- return _ref51.apply(this, arguments);
46966
+ return function resetAudioSource(_x33) {
46967
+ return _ref52.apply(this, arguments);
46905
46968
  };
46906
46969
  }();
46907
46970
 
@@ -46915,15 +46978,15 @@ function PublisherFactory(_ref) {
46915
46978
  }
46916
46979
  // trigger the handler onVisibilityChange
46917
46980
  const visibilityHandler = /*#__PURE__*/function () {
46918
- var _ref52 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
46919
- return _regenerator.default.wrap(function _callee40$(_context40) {
46920
- while (1) switch (_context40.prev = _context40.next) {
46981
+ var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
46982
+ return _regenerator.default.wrap(function _callee41$(_context41) {
46983
+ while (1) switch (_context41.prev = _context41.next) {
46921
46984
  case 0:
46922
46985
  if (document.hidden) {
46923
- _context40.next = 5;
46986
+ _context41.next = 5;
46924
46987
  break;
46925
46988
  }
46926
- _context40.next = 3;
46989
+ _context41.next = 3;
46927
46990
  return resetAudioSource(audioTrack);
46928
46991
  case 3:
46929
46992
  if (shouldRePublishVideo) {
@@ -46932,12 +46995,12 @@ function PublisherFactory(_ref) {
46932
46995
  document.removeEventListener('visibilitychange', visibilityHandler);
46933
46996
  case 5:
46934
46997
  case "end":
46935
- return _context40.stop();
46998
+ return _context41.stop();
46936
46999
  }
46937
- }, _callee40);
47000
+ }, _callee41);
46938
47001
  }));
46939
47002
  return function visibilityHandler() {
46940
- return _ref52.apply(this, arguments);
47003
+ return _ref53.apply(this, arguments);
46941
47004
  };
46942
47005
  }();
46943
47006
  document.addEventListener('visibilitychange', visibilityHandler);
@@ -47018,84 +47081,84 @@ function PublisherFactory(_ref) {
47018
47081
  };
47019
47082
  const isMediaStreamTrack = track => track instanceof MediaStreamTrack || track && typeof track === 'object' && Object.getPrototypeOf(track).toString().includes('MediaStreamTrack');
47020
47083
  const setAudioSource = /*#__PURE__*/function () {
47021
- var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(audioSource) {
47084
+ var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(audioSource) {
47022
47085
  var currentCancelSentinel, setStreamIfNotCancelled, prevAudioSource, newTrack, newOptions, prevLabel, prevDeviceId, _processedOptions3, getUserMediaHelper, prevOptions, previousDevice, stream;
47023
- return _regenerator.default.wrap(function _callee42$(_context42) {
47024
- while (1) switch (_context42.prev = _context42.next) {
47086
+ return _regenerator.default.wrap(function _callee43$(_context43) {
47087
+ while (1) switch (_context43.prev = _context43.next) {
47025
47088
  case 0:
47026
47089
  if (isSetAudioSourceSupported) {
47027
- _context42.next = 2;
47090
+ _context43.next = 2;
47028
47091
  break;
47029
47092
  }
47030
47093
  throw setAudioSourceNotSupportedError();
47031
47094
  case 2:
47032
47095
  currentCancelSentinel = getSetAudioSourceCancellationSentinel();
47033
47096
  setStreamIfNotCancelled = /*#__PURE__*/function () {
47034
- var _ref54 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(stream) {
47035
- return _regenerator.default.wrap(function _callee41$(_context41) {
47036
- while (1) switch (_context41.prev = _context41.next) {
47097
+ var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(stream) {
47098
+ return _regenerator.default.wrap(function _callee42$(_context42) {
47099
+ while (1) switch (_context42.prev = _context42.next) {
47037
47100
  case 0:
47038
47101
  if (!currentCancelSentinel.isCanceled()) {
47039
- _context41.next = 3;
47102
+ _context42.next = 3;
47040
47103
  break;
47041
47104
  }
47042
47105
  stream.getTracks(track => track.stop());
47043
47106
  throw setAudioSourceCancellationError();
47044
47107
  case 3:
47045
- return _context41.abrupt("return", setAudioSource(stream.getAudioTracks()[0]));
47108
+ return _context42.abrupt("return", setAudioSource(stream.getAudioTracks()[0]));
47046
47109
  case 4:
47047
47110
  case "end":
47048
- return _context41.stop();
47111
+ return _context42.stop();
47049
47112
  }
47050
- }, _callee41);
47113
+ }, _callee42);
47051
47114
  }));
47052
- return function setStreamIfNotCancelled(_x33) {
47053
- return _ref54.apply(this, arguments);
47115
+ return function setStreamIfNotCancelled(_x35) {
47116
+ return _ref55.apply(this, arguments);
47054
47117
  };
47055
47118
  }();
47056
47119
  prevAudioSource = _this._getAudioSource();
47057
47120
  if (prevAudioSource) {
47058
- _context42.next = 7;
47121
+ _context43.next = 7;
47059
47122
  break;
47060
47123
  }
47061
47124
  throw otError(Errors.NOT_SUPPORTED, new Error('Publisher#setAudioSource cannot add an audio source when you started without one.'));
47062
47125
  case 7:
47063
47126
  if (!isMediaStreamTrack(audioSource)) {
47064
- _context42.next = 27;
47127
+ _context43.next = 27;
47065
47128
  break;
47066
47129
  }
47067
47130
  if (!currentCancelSentinel.isCanceled()) {
47068
- _context42.next = 10;
47131
+ _context43.next = 10;
47069
47132
  break;
47070
47133
  }
47071
47134
  throw setAudioSourceCancellationError();
47072
47135
  case 10:
47073
47136
  if (!_audioMediaProcessorConnector) {
47074
- _context42.next = 23;
47137
+ _context43.next = 23;
47075
47138
  break;
47076
47139
  }
47077
- _context42.prev = 11;
47078
- _context42.next = 14;
47140
+ _context43.prev = 11;
47141
+ _context43.next = 14;
47079
47142
  return _audioMediaProcessorConnector.setTrack(audioSource);
47080
47143
  case 14:
47081
- newTrack = _context42.sent;
47082
- _context42.next = 17;
47144
+ newTrack = _context43.sent;
47145
+ _context43.next = 17;
47083
47146
  return replaceAudioTrack(prevAudioSource, newTrack);
47084
47147
  case 17:
47085
- return _context42.abrupt("return", _context42.sent);
47148
+ return _context43.abrupt("return", _context43.sent);
47086
47149
  case 20:
47087
- _context42.prev = 20;
47088
- _context42.t0 = _context42["catch"](11);
47089
- logging.error(`Error setting track on audioMediaProcessorConnector: ${_context42.t0}`);
47150
+ _context43.prev = 20;
47151
+ _context43.t0 = _context43["catch"](11);
47152
+ logging.error(`Error setting track on audioMediaProcessorConnector: ${_context43.t0}`);
47090
47153
  case 23:
47091
47154
  logAnalyticsEvent('setAudioSource', 'Event', {
47092
47155
  deviceId: audioSource.getSettings().deviceId,
47093
47156
  hasAudio: properties.publishAudio
47094
47157
  });
47095
- return _context42.abrupt("return", replaceAudioTrack(prevAudioSource, audioSource));
47158
+ return _context43.abrupt("return", replaceAudioTrack(prevAudioSource, audioSource));
47096
47159
  case 27:
47097
47160
  if (!(typeof audioSource === 'string')) {
47098
- _context42.next = 74;
47161
+ _context43.next = 74;
47099
47162
  break;
47100
47163
  }
47101
47164
  // Must be a deviceId, call getUserMedia and get the MediaStreamTrack
@@ -47113,21 +47176,21 @@ function PublisherFactory(_ref) {
47113
47176
  prevAudioSource.stop();
47114
47177
  }
47115
47178
  _processedOptions3 = processedOptions, getUserMediaHelper = _processedOptions3.getUserMedia;
47116
- _context42.prev = 37;
47117
- _context42.t1 = setStreamIfNotCancelled;
47118
- _context42.next = 41;
47179
+ _context43.prev = 37;
47180
+ _context43.t1 = setStreamIfNotCancelled;
47181
+ _context43.next = 41;
47119
47182
  return getUserMediaHelper();
47120
47183
  case 41:
47121
- _context42.t2 = _context42.sent;
47122
- _context42.next = 44;
47123
- return (0, _context42.t1)(_context42.t2);
47184
+ _context43.t2 = _context43.sent;
47185
+ _context43.next = 44;
47186
+ return (0, _context43.t1)(_context43.t2);
47124
47187
  case 44:
47125
- return _context42.abrupt("return", _context42.sent);
47188
+ return _context43.abrupt("return", _context43.sent);
47126
47189
  case 47:
47127
- _context42.prev = 47;
47128
- _context42.t3 = _context42["catch"](37);
47190
+ _context43.prev = 47;
47191
+ _context43.t3 = _context43["catch"](37);
47129
47192
  if (!currentCancelSentinel.isCanceled()) {
47130
- _context42.next = 51;
47193
+ _context43.next = 51;
47131
47194
  break;
47132
47195
  }
47133
47196
  throw setAudioSourceCancellationError();
@@ -47136,15 +47199,15 @@ function PublisherFactory(_ref) {
47136
47199
  prevOptions.videoSource = null;
47137
47200
  prevOptions.audioSource = prevDeviceId;
47138
47201
  if (!(!prevOptions.audioSource && prevLabel)) {
47139
- _context42.next = 61;
47202
+ _context43.next = 61;
47140
47203
  break;
47141
47204
  }
47142
- _context42.next = 57;
47205
+ _context43.next = 57;
47143
47206
  return deviceHelpers.getInputMediaDevices();
47144
47207
  case 57:
47145
- previousDevice = _context42.sent.find(x => x.label === prevLabel);
47208
+ previousDevice = _context43.sent.find(x => x.label === prevLabel);
47146
47209
  if (!currentCancelSentinel.isCanceled()) {
47147
- _context42.next = 60;
47210
+ _context43.next = 60;
47148
47211
  break;
47149
47212
  }
47150
47213
  throw setAudioSourceCancellationError();
@@ -47154,39 +47217,39 @@ function PublisherFactory(_ref) {
47154
47217
  }
47155
47218
  case 61:
47156
47219
  if (prevOptions.audioSource) {
47157
- _context42.next = 64;
47220
+ _context43.next = 64;
47158
47221
  break;
47159
47222
  }
47160
- _context42.t3.message += ' (could not determine previous audio device)';
47161
- throw otError(Errors.NOT_FOUND, _context42.t3);
47223
+ _context43.t3.message += ' (could not determine previous audio device)';
47224
+ throw otError(Errors.NOT_FOUND, _context43.t3);
47162
47225
  case 64:
47163
47226
  processedOptions = processPubOptions(prevOptions, 'OT.Publisher.setAudioSource', () => currentCancelSentinel.isCanceled() || state && state.isDestroyed());
47164
- _context42.next = 67;
47227
+ _context43.next = 67;
47165
47228
  return processedOptions.getUserMedia().catch(error => {
47166
47229
  // eslint-disable-next-line no-param-reassign
47167
47230
  error.message += ' (could not obtain previous audio device)';
47168
47231
  throw error;
47169
47232
  });
47170
47233
  case 67:
47171
- stream = _context42.sent;
47172
- _context42.next = 70;
47234
+ stream = _context43.sent;
47235
+ _context43.next = 70;
47173
47236
  return setStreamIfNotCancelled(stream);
47174
47237
  case 70:
47175
- _context42.t3.message += ' (reverted to previous audio device)';
47176
- throw _context42.t3;
47238
+ _context43.t3.message += ' (reverted to previous audio device)';
47239
+ throw _context43.t3;
47177
47240
  case 72:
47178
- _context42.next = 75;
47241
+ _context43.next = 75;
47179
47242
  break;
47180
47243
  case 74:
47181
47244
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid parameter passed to OT.Publisher.setAudioSource(). Expected string or MediaStreamTrack.'));
47182
47245
  case 75:
47183
47246
  case "end":
47184
- return _context42.stop();
47247
+ return _context43.stop();
47185
47248
  }
47186
- }, _callee42, null, [[11, 20], [37, 47]]);
47249
+ }, _callee43, null, [[11, 20], [37, 47]]);
47187
47250
  }));
47188
- return function setAudioSource(_x32) {
47189
- return _ref53.apply(this, arguments);
47251
+ return function setAudioSource(_x34) {
47252
+ return _ref54.apply(this, arguments);
47190
47253
  };
47191
47254
  }();
47192
47255
  this.setAudioSource = setAudioSource;
@@ -47249,21 +47312,21 @@ function PublisherFactory(_ref) {
47249
47312
  * completes successfully. If there is an error, the promise is rejected.
47250
47313
  */
47251
47314
  const setVideoSource = /*#__PURE__*/function () {
47252
- var _setVideoSource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(videoSourceId) {
47315
+ var _setVideoSource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(videoSourceId) {
47253
47316
  var invalidVideoSourceOtError, setVideoSourceOtError, isAudioOnly, deviceList, isValidVideoDeviceId;
47254
- return _regenerator.default.wrap(function _callee43$(_context43) {
47255
- while (1) switch (_context43.prev = _context43.next) {
47317
+ return _regenerator.default.wrap(function _callee44$(_context44) {
47318
+ while (1) switch (_context44.prev = _context44.next) {
47256
47319
  case 0:
47257
47320
  invalidVideoSourceOtError = otError(Errors.INVALID_VIDEO_SOURCE, new Error('Invalid video source. Video source must be a valid video input deviceId'), 1041);
47258
47321
  setVideoSourceOtError = otError(Errors.SET_VIDEO_SOURCE_FAILURE, new Error('You cannot reset the video source on a publisher that does not currently use a camera source.'), 1040);
47259
47322
  if (!(OTHelpers.env.isLegacyEdge || !windowMock.RTCRtpSender || typeof windowMock.RTCRtpSender.prototype.replaceTrack !== 'function')) {
47260
- _context43.next = 4;
47323
+ _context44.next = 4;
47261
47324
  break;
47262
47325
  }
47263
47326
  throw otError(Errors.UNSUPPORTED_BROWSER, new Error('setVideoSource is not supported in your browser.'), ExceptionCodes.UNABLE_TO_PUBLISH);
47264
47327
  case 4:
47265
47328
  if (!(typeof videoSourceId !== 'string')) {
47266
- _context43.next = 6;
47329
+ _context44.next = 6;
47267
47330
  break;
47268
47331
  }
47269
47332
  throw invalidVideoSourceOtError;
@@ -47271,75 +47334,75 @@ function PublisherFactory(_ref) {
47271
47334
  // we can't use hasVideo because that only checks if the video is
47272
47335
  isAudioOnly = !webRTCStream || webRTCStream.getVideoTracks().length === 0;
47273
47336
  if (!(isCustomVideoTrack || isScreenSharing || isAudioOnly)) {
47274
- _context43.next = 9;
47337
+ _context44.next = 9;
47275
47338
  break;
47276
47339
  }
47277
47340
  throw setVideoSourceOtError;
47278
47341
  case 9:
47279
- _context43.next = 11;
47342
+ _context44.next = 11;
47280
47343
  return deviceHelpers.getInputMediaDevices();
47281
47344
  case 11:
47282
- deviceList = _context43.sent;
47345
+ deviceList = _context44.sent;
47283
47346
  isValidVideoDeviceId = deviceList.find(device => device.kind === 'videoInput' && device.deviceId === videoSourceId);
47284
47347
  if (isValidVideoDeviceId) {
47285
- _context43.next = 15;
47348
+ _context44.next = 15;
47286
47349
  break;
47287
47350
  }
47288
47351
  throw invalidVideoSourceOtError;
47289
47352
  case 15:
47290
- _context43.next = 17;
47353
+ _context44.next = 17;
47291
47354
  return attemptToSetVideoTrack(videoSourceId, 'setVideoSource');
47292
47355
  case 17:
47293
47356
  case "end":
47294
- return _context43.stop();
47357
+ return _context44.stop();
47295
47358
  }
47296
- }, _callee43);
47359
+ }, _callee44);
47297
47360
  }));
47298
- function setVideoSource(_x34) {
47361
+ function setVideoSource(_x36) {
47299
47362
  return _setVideoSource.apply(this, arguments);
47300
47363
  }
47301
47364
  return setVideoSource;
47302
47365
  }();
47303
47366
  this.setVideoSource = setVideoSource;
47304
47367
  const attemptToSetVideoTrack = /*#__PURE__*/function () {
47305
- var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(newVideoDeviceId, action) {
47368
+ var _ref56 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45(newVideoDeviceId, action) {
47306
47369
  var _originalVideoTrack2;
47307
47370
  var oldDeviceID, oldTrack, supportedBrowsers, videoFilterToReapplyOnAndroid, newVideoTrack, originalVideoTrack;
47308
- return _regenerator.default.wrap(function _callee44$(_context44) {
47309
- while (1) switch (_context44.prev = _context44.next) {
47371
+ return _regenerator.default.wrap(function _callee45$(_context45) {
47372
+ while (1) switch (_context45.prev = _context45.next) {
47310
47373
  case 0:
47311
47374
  oldDeviceID = currentDeviceId;
47312
47375
  currentDeviceId = newVideoDeviceId;
47313
47376
 
47314
47377
  // We shouldn't replace the track unless the video is on
47315
47378
  if (properties.publishVideo) {
47316
- _context44.next = 5;
47379
+ _context45.next = 5;
47317
47380
  break;
47318
47381
  }
47319
47382
  logAnalyticsEvent(action, 'Event', {
47320
47383
  deviceId: newVideoDeviceId,
47321
47384
  hasVideo: properties.publishVideo
47322
47385
  });
47323
- return _context44.abrupt("return");
47386
+ return _context45.abrupt("return");
47324
47387
  case 5:
47325
47388
  if (!hasTrackFromDevice(newVideoDeviceId)) {
47326
- _context44.next = 7;
47389
+ _context45.next = 7;
47327
47390
  break;
47328
47391
  }
47329
- return _context44.abrupt("return");
47392
+ return _context45.abrupt("return");
47330
47393
  case 7:
47331
47394
  oldTrack = getCurrentTrack();
47332
47395
  supportedBrowsers = OTHelpers.env.isChrome || OTHelpers.env.isFirefox || OTHelpers.env.isSamsung;
47333
47396
  if (!(properties.publishVideo && OTHelpers.env.isAndroid && supportedBrowsers)) {
47334
- _context44.next = 16;
47397
+ _context45.next = 16;
47335
47398
  break;
47336
47399
  }
47337
47400
  if (!currentVideoFilter) {
47338
- _context44.next = 15;
47401
+ _context45.next = 15;
47339
47402
  break;
47340
47403
  }
47341
47404
  videoFilterToReapplyOnAndroid = currentVideoFilter;
47342
- _context44.next = 14;
47405
+ _context45.next = 14;
47343
47406
  return destroyMediaProcessor();
47344
47407
  case 14:
47345
47408
  currentVideoFilter = null;
@@ -47348,22 +47411,22 @@ function PublisherFactory(_ref) {
47348
47411
  oldTrack.stop();
47349
47412
  }
47350
47413
  case 16:
47351
- _context44.prev = 16;
47352
- _context44.next = 19;
47414
+ _context45.prev = 16;
47415
+ _context45.next = 19;
47353
47416
  return getTrackFromDeviceId(newVideoDeviceId);
47354
47417
  case 19:
47355
- newVideoTrack = _context44.sent;
47356
- _context44.next = 27;
47418
+ newVideoTrack = _context45.sent;
47419
+ _context45.next = 27;
47357
47420
  break;
47358
47421
  case 22:
47359
- _context44.prev = 22;
47360
- _context44.t0 = _context44["catch"](16);
47422
+ _context45.prev = 22;
47423
+ _context45.t0 = _context45["catch"](16);
47361
47424
  currentDeviceId = oldDeviceID;
47362
- logging.error(_context44.t0);
47363
- throw _context44.t0;
47425
+ logging.error(_context45.t0);
47426
+ throw _context45.t0;
47364
47427
  case 27:
47365
47428
  if (newVideoTrack) {
47366
- _context44.next = 31;
47429
+ _context45.next = 31;
47367
47430
  break;
47368
47431
  }
47369
47432
  logAnalyticsEvent(action, 'Event', {
@@ -47372,36 +47435,36 @@ function PublisherFactory(_ref) {
47372
47435
  error: 'Unable to aquire video track'
47373
47436
  });
47374
47437
  logging.warn('Unable to aquire video track. Moving to next device.');
47375
- return _context44.abrupt("return");
47438
+ return _context45.abrupt("return");
47376
47439
  case 31:
47377
47440
  if (!currentVideoFilter) {
47378
- _context44.next = 36;
47441
+ _context45.next = 36;
47379
47442
  break;
47380
47443
  }
47381
47444
  originalVideoTrack = mediaProcessor.getOriginalVideoTrack();
47382
- _context44.next = 35;
47445
+ _context45.next = 35;
47383
47446
  return mediaProcessor.setVideoTrack(newVideoTrack);
47384
47447
  case 35:
47385
- newVideoTrack = _context44.sent;
47448
+ newVideoTrack = _context45.sent;
47386
47449
  case 36:
47387
47450
  if (!_videoMediaProcessorConnector) {
47388
- _context44.next = 41;
47451
+ _context45.next = 41;
47389
47452
  break;
47390
47453
  }
47391
47454
  originalVideoTrack = _videoMediaProcessorConnector.originalTrack;
47392
- _context44.next = 40;
47455
+ _context45.next = 40;
47393
47456
  return _videoMediaProcessorConnector.setTrack(newVideoTrack);
47394
47457
  case 40:
47395
- newVideoTrack = _context44.sent;
47458
+ newVideoTrack = _context45.sent;
47396
47459
  case 41:
47397
- _context44.next = 43;
47460
+ _context45.next = 43;
47398
47461
  return replaceTrackAndUpdate(oldTrack, newVideoTrack);
47399
47462
  case 43:
47400
47463
  if (!videoFilterToReapplyOnAndroid) {
47401
- _context44.next = 46;
47464
+ _context45.next = 46;
47402
47465
  break;
47403
47466
  }
47404
- _context44.next = 46;
47467
+ _context45.next = 46;
47405
47468
  return _this.applyVideoFilter(videoFilterToReapplyOnAndroid);
47406
47469
  case 46:
47407
47470
  logAnalyticsEvent(action, 'Event', {
@@ -47418,12 +47481,12 @@ function PublisherFactory(_ref) {
47418
47481
  }
47419
47482
  case 49:
47420
47483
  case "end":
47421
- return _context44.stop();
47484
+ return _context45.stop();
47422
47485
  }
47423
- }, _callee44, null, [[16, 22]]);
47486
+ }, _callee45, null, [[16, 22]]);
47424
47487
  }));
47425
- return function attemptToSetVideoTrack(_x35, _x36) {
47426
- return _ref55.apply(this, arguments);
47488
+ return function attemptToSetVideoTrack(_x37, _x38) {
47489
+ return _ref56.apply(this, arguments);
47427
47490
  };
47428
47491
  }();
47429
47492
 
@@ -47473,21 +47536,21 @@ function PublisherFactory(_ref) {
47473
47536
  this._ = {
47474
47537
  privateEvents,
47475
47538
  setIceConfig(newIceConfig) {
47476
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
47539
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46() {
47477
47540
  var pcs;
47478
- return _regenerator.default.wrap(function _callee45$(_context45) {
47479
- while (1) switch (_context45.prev = _context45.next) {
47541
+ return _regenerator.default.wrap(function _callee46$(_context46) {
47542
+ while (1) switch (_context46.prev = _context46.next) {
47480
47543
  case 0:
47481
- _context45.next = 2;
47544
+ _context46.next = 2;
47482
47545
  return getAllPeerConnections();
47483
47546
  case 2:
47484
- pcs = _context45.sent;
47547
+ pcs = _context46.sent;
47485
47548
  pcs.forEach(pc => pc.setIceConfig(newIceConfig));
47486
47549
  case 4:
47487
47550
  case "end":
47488
- return _context45.stop();
47551
+ return _context46.stop();
47489
47552
  }
47490
- }, _callee45);
47553
+ }, _callee46);
47491
47554
  }))();
47492
47555
  },
47493
47556
  publishToSession: (session, analyticsReplacement) => {
@@ -47523,8 +47586,8 @@ function PublisherFactory(_ref) {
47523
47586
  return;
47524
47587
  }
47525
47588
  this.once('initSuccess', resolve);
47526
- this.once('destroyed', _ref56 => {
47527
- let reason = _ref56.reason;
47589
+ this.once('destroyed', _ref57 => {
47590
+ let reason = _ref57.reason;
47528
47591
  let reasonDescription = '';
47529
47592
  if (reason) {
47530
47593
  reasonDescription = ` Reason: ${reason}`;
@@ -47534,16 +47597,16 @@ function PublisherFactory(_ref) {
47534
47597
  });
47535
47598
  logging.debug('publishToSession: waiting for publishComplete, which is triggered by ' + 'stream#created from rumor');
47536
47599
  const checkForAndSetScalabilityMode = /*#__PURE__*/function () {
47537
- var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46() {
47600
+ var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
47538
47601
  var scalabilityMode, codecsWhitelist, isCamera, contentHint;
47539
- return _regenerator.default.wrap(function _callee46$(_context46) {
47540
- while (1) switch (_context46.prev = _context46.next) {
47602
+ return _regenerator.default.wrap(function _callee47$(_context47) {
47603
+ while (1) switch (_context47.prev = _context47.next) {
47541
47604
  case 0:
47542
47605
  if (!(!properties.constraints.video || !sessionSimulcastEnabled || capableSimulcastStreams < 2)) {
47543
- _context46.next = 2;
47606
+ _context47.next = 2;
47544
47607
  break;
47545
47608
  }
47546
- return _context46.abrupt("return");
47609
+ return _context47.abrupt("return");
47547
47610
  case 2:
47548
47611
  codecsWhitelist = ['VP9'];
47549
47612
  isCamera = !isScreenSharing && !isCustomVideoTrack;
@@ -47559,12 +47622,12 @@ function PublisherFactory(_ref) {
47559
47622
  }
47560
47623
  case 6:
47561
47624
  case "end":
47562
- return _context46.stop();
47625
+ return _context47.stop();
47563
47626
  }
47564
- }, _callee46);
47627
+ }, _callee47);
47565
47628
  }));
47566
47629
  return function checkForAndSetScalabilityMode() {
47567
- return _ref57.apply(this, arguments);
47630
+ return _ref58.apply(this, arguments);
47568
47631
  };
47569
47632
  }();
47570
47633
  const completedPromise = new Promise((resolve, reject) => {
@@ -47764,11 +47827,11 @@ function PublisherFactory(_ref) {
47764
47827
  return this._.unpublishFromSession(session, reason);
47765
47828
  },
47766
47829
  startMigration: function () {
47767
- var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
47830
+ var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48() {
47768
47831
  var _publisherSenderStats4, _this$session23, _this$session23$sessi;
47769
47832
  var relayedPeerConnection, onCreateStreamError;
47770
- return _regenerator.default.wrap(function _callee47$(_context47) {
47771
- while (1) switch (_context47.prev = _context47.next) {
47833
+ return _regenerator.default.wrap(function _callee48$(_context48) {
47834
+ while (1) switch (_context48.prev = _context48.next) {
47772
47835
  case 0:
47773
47836
  state.set('Migrating');
47774
47837
  logAnalyticsEvent('SessionMigration', 'Attempt');
@@ -47776,10 +47839,10 @@ function PublisherFactory(_ref) {
47776
47839
 
47777
47840
  // Update sender method in P2P PC because it needs to use the new Rumor. No need for
47778
47841
  // Mantis PC since a new PC will be created.
47779
- _context47.next = 5;
47842
+ _context48.next = 5;
47780
47843
  return getP2pPeerConnection();
47781
47844
  case 5:
47782
- relayedPeerConnection = _context47.sent;
47845
+ relayedPeerConnection = _context48.sent;
47783
47846
  relayedPeerConnection == null ? void 0 : relayedPeerConnection.setSendMessage(createSendMessage('P2P'));
47784
47847
  (_publisherSenderStats4 = publisherSenderStats) == null ? void 0 : _publisherSenderStats4.setSocket(_this.session._.getSocket());
47785
47848
  onCreateStreamError = error => {
@@ -47788,23 +47851,23 @@ function PublisherFactory(_ref) {
47788
47851
  }
47789
47852
  };
47790
47853
  if (!((_this$session23 = _this.session) != null && (_this$session23$sessi = _this$session23.sessionInfo) != null && _this$session23$sessi.p2pEnabled)) {
47791
- _context47.next = 13;
47854
+ _context48.next = 13;
47792
47855
  break;
47793
47856
  }
47794
47857
  _createStream('P2P', onCreateStreamError);
47795
- _context47.next = 17;
47858
+ _context48.next = 17;
47796
47859
  break;
47797
47860
  case 13:
47798
- _context47.next = 15;
47861
+ _context48.next = 15;
47799
47862
  return getMantisPeerConnection();
47800
47863
  case 15:
47801
- _previousPeerConnection = _context47.sent;
47864
+ _previousPeerConnection = _context48.sent;
47802
47865
  _createStream('MANTIS', onCreateStreamError);
47803
47866
  case 17:
47804
47867
  case "end":
47805
- return _context47.stop();
47868
+ return _context48.stop();
47806
47869
  }
47807
- }, _callee47);
47870
+ }, _callee48);
47808
47871
  }));
47809
47872
  function startMigration() {
47810
47873
  return _startMigration.apply(this, arguments);
@@ -47815,16 +47878,16 @@ function PublisherFactory(_ref) {
47815
47878
  var _this$session24, _this$session24$sessi;
47816
47879
  clearTimeout(_migrationTimeoutId);
47817
47880
  const destroyPeerConnection = /*#__PURE__*/function () {
47818
- var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(pc) {
47881
+ var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(pc) {
47819
47882
  var _getPeerConnectionMet10, peerConnectionId;
47820
- return _regenerator.default.wrap(function _callee48$(_context48) {
47821
- while (1) switch (_context48.prev = _context48.next) {
47883
+ return _regenerator.default.wrap(function _callee49$(_context49) {
47884
+ while (1) switch (_context49.prev = _context49.next) {
47822
47885
  case 0:
47823
47886
  if (!pc) {
47824
- _context48.next = 7;
47887
+ _context49.next = 7;
47825
47888
  break;
47826
47889
  }
47827
- _context48.next = 3;
47890
+ _context49.next = 3;
47828
47891
  return _publisherStatsHelper.removePeerConnection(pc);
47829
47892
  case 3:
47830
47893
  _getPeerConnectionMet10 = getPeerConnectionMeta(pc), peerConnectionId = _getPeerConnectionMet10.peerConnectionId;
@@ -47833,12 +47896,12 @@ function PublisherFactory(_ref) {
47833
47896
  pc.destroy();
47834
47897
  case 7:
47835
47898
  case "end":
47836
- return _context48.stop();
47899
+ return _context49.stop();
47837
47900
  }
47838
- }, _callee48);
47901
+ }, _callee49);
47839
47902
  }));
47840
- return function destroyPeerConnection(_x37) {
47841
- return _ref58.apply(this, arguments);
47903
+ return function destroyPeerConnection(_x39) {
47904
+ return _ref59.apply(this, arguments);
47842
47905
  };
47843
47906
  }();
47844
47907
 
@@ -47878,55 +47941,55 @@ function PublisherFactory(_ref) {
47878
47941
  return webRTCStream;
47879
47942
  },
47880
47943
  switchTracks() {
47881
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
47944
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
47882
47945
  var stream;
47883
- return _regenerator.default.wrap(function _callee49$(_context49) {
47884
- while (1) switch (_context49.prev = _context49.next) {
47946
+ return _regenerator.default.wrap(function _callee50$(_context50) {
47947
+ while (1) switch (_context50.prev = _context50.next) {
47885
47948
  case 0:
47886
- _context49.prev = 0;
47887
- _context49.next = 3;
47949
+ _context50.prev = 0;
47950
+ _context50.next = 3;
47888
47951
  return getUserMedia().catch(userMediaError);
47889
47952
  case 3:
47890
- stream = _context49.sent;
47891
- _context49.next = 10;
47953
+ stream = _context50.sent;
47954
+ _context50.next = 10;
47892
47955
  break;
47893
47956
  case 6:
47894
- _context49.prev = 6;
47895
- _context49.t0 = _context49["catch"](0);
47896
- logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context49.t0}`);
47897
- throw _context49.t0;
47957
+ _context50.prev = 6;
47958
+ _context50.t0 = _context50["catch"](0);
47959
+ logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context50.t0}`);
47960
+ throw _context50.t0;
47898
47961
  case 10:
47899
47962
  setNewStream(stream);
47900
- _context49.prev = 11;
47963
+ _context50.prev = 11;
47901
47964
  bindVideo();
47902
- _context49.next = 21;
47965
+ _context50.next = 21;
47903
47966
  break;
47904
47967
  case 15:
47905
- _context49.prev = 15;
47906
- _context49.t1 = _context49["catch"](11);
47907
- if (!(_context49.t1 instanceof _cancel.CancellationError)) {
47908
- _context49.next = 19;
47968
+ _context50.prev = 15;
47969
+ _context50.t1 = _context50["catch"](11);
47970
+ if (!(_context50.t1 instanceof _cancel.CancellationError)) {
47971
+ _context50.next = 19;
47909
47972
  break;
47910
47973
  }
47911
- return _context49.abrupt("return");
47974
+ return _context50.abrupt("return");
47912
47975
  case 19:
47913
- logging.error('Error while binding video', _context49.t1);
47914
- throw _context49.t1;
47976
+ logging.error('Error while binding video', _context50.t1);
47977
+ throw _context50.t1;
47915
47978
  case 21:
47916
- _context49.prev = 21;
47979
+ _context50.prev = 21;
47917
47980
  replaceTracks();
47918
- _context49.next = 29;
47981
+ _context50.next = 29;
47919
47982
  break;
47920
47983
  case 25:
47921
- _context49.prev = 25;
47922
- _context49.t2 = _context49["catch"](21);
47923
- logging.error('Error replacing tracks', _context49.t2);
47924
- throw _context49.t2;
47984
+ _context50.prev = 25;
47985
+ _context50.t2 = _context50["catch"](21);
47986
+ logging.error('Error replacing tracks', _context50.t2);
47987
+ throw _context50.t2;
47925
47988
  case 29:
47926
47989
  case "end":
47927
- return _context49.stop();
47990
+ return _context50.stop();
47928
47991
  }
47929
- }, _callee49, null, [[0, 6], [11, 15], [21, 25]]);
47992
+ }, _callee50, null, [[0, 6], [11, 15], [21, 25]]);
47930
47993
  }))();
47931
47994
  },
47932
47995
  getDataChannel(label, getOptions, completion) {
@@ -47966,27 +48029,27 @@ function PublisherFactory(_ref) {
47966
48029
  },
47967
48030
  demoOnlyCycleVideo: this.cycleVideo,
47968
48031
  testOnlyGetFramesEncoded() {
47969
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
48032
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
47970
48033
  var peerConnections;
47971
- return _regenerator.default.wrap(function _callee50$(_context50) {
47972
- while (1) switch (_context50.prev = _context50.next) {
48034
+ return _regenerator.default.wrap(function _callee51$(_context51) {
48035
+ while (1) switch (_context51.prev = _context51.next) {
47973
48036
  case 0:
47974
- _context50.next = 2;
48037
+ _context51.next = 2;
47975
48038
  return getAllPeerConnections();
47976
48039
  case 2:
47977
- peerConnections = _context50.sent;
48040
+ peerConnections = _context51.sent;
47978
48041
  if (peerConnections.length) {
47979
- _context50.next = 5;
48042
+ _context51.next = 5;
47980
48043
  break;
47981
48044
  }
47982
48045
  throw new Error('No established PeerConnections yet');
47983
48046
  case 5:
47984
- return _context50.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
48047
+ return _context51.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
47985
48048
  case 6:
47986
48049
  case "end":
47987
- return _context50.stop();
48050
+ return _context51.stop();
47988
48051
  }
47989
- }, _callee50);
48052
+ }, _callee51);
47990
48053
  }))();
47991
48054
  },
47992
48055
  onStreamAvailable,
@@ -48015,47 +48078,47 @@ function PublisherFactory(_ref) {
48015
48078
  }
48016
48079
  }.bind(this),
48017
48080
  setCongestionLevel: function () {
48018
- var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51(level, peerId) {
48081
+ var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(level, peerId) {
48019
48082
  var pcs;
48020
- return _regenerator.default.wrap(function _callee51$(_context51) {
48021
- while (1) switch (_context51.prev = _context51.next) {
48083
+ return _regenerator.default.wrap(function _callee52$(_context52) {
48084
+ while (1) switch (_context52.prev = _context52.next) {
48022
48085
  case 0:
48023
48086
  if (!audioFallbackCoordinator) {
48024
- _context51.next = 15;
48087
+ _context52.next = 15;
48025
48088
  break;
48026
48089
  }
48027
48090
  if (!peerId) {
48028
- _context51.next = 8;
48091
+ _context52.next = 8;
48029
48092
  break;
48030
48093
  }
48031
- _context51.next = 4;
48094
+ _context52.next = 4;
48032
48095
  return getPeerConnectionById(peerId);
48033
48096
  case 4:
48034
- _context51.t1 = _context51.sent;
48035
- _context51.t0 = [_context51.t1];
48036
- _context51.next = 11;
48097
+ _context52.t1 = _context52.sent;
48098
+ _context52.t0 = [_context52.t1];
48099
+ _context52.next = 11;
48037
48100
  break;
48038
48101
  case 8:
48039
- _context51.next = 10;
48102
+ _context52.next = 10;
48040
48103
  return getAllPeerConnections();
48041
48104
  case 10:
48042
- _context51.t0 = _context51.sent;
48105
+ _context52.t0 = _context52.sent;
48043
48106
  case 11:
48044
- pcs = _context51.t0;
48107
+ pcs = _context52.t0;
48045
48108
  pcs.forEach(pc => {
48046
48109
  pc.setCongestionLevel(level);
48047
48110
  });
48048
- _context51.next = 16;
48111
+ _context52.next = 16;
48049
48112
  break;
48050
48113
  case 15:
48051
48114
  logging.warn('Audio Fallback is not enabled');
48052
48115
  case 16:
48053
48116
  case "end":
48054
- return _context51.stop();
48117
+ return _context52.stop();
48055
48118
  }
48056
- }, _callee51);
48119
+ }, _callee52);
48057
48120
  }));
48058
- function setCongestionLevel(_x38, _x39) {
48121
+ function setCongestionLevel(_x40, _x41) {
48059
48122
  return _setCongestionLevel.apply(this, arguments);
48060
48123
  }
48061
48124
  return setCongestionLevel;
@@ -48442,10 +48505,10 @@ function PublisherFactory(_ref) {
48442
48505
  * If there is an error, the promise is rejected and no new video filter is set.
48443
48506
  */
48444
48507
  this.applyVideoFilter = /*#__PURE__*/function () {
48445
- var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(videoFilter, avoidOriginalTrackLeak) {
48508
+ var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(videoFilter, avoidOriginalTrackLeak) {
48446
48509
  var sanitizedVideoFilter, isSupported, message, _webRTCStream$getVide2, originalVideoTrack, filteredVideoTrack;
48447
- return _regenerator.default.wrap(function _callee52$(_context52) {
48448
- while (1) switch (_context52.prev = _context52.next) {
48510
+ return _regenerator.default.wrap(function _callee53$(_context53) {
48511
+ while (1) switch (_context53.prev = _context53.next) {
48449
48512
  case 0:
48450
48513
  if (avoidOriginalTrackLeak === void 0) {
48451
48514
  avoidOriginalTrackLeak = false;
@@ -48454,28 +48517,28 @@ function PublisherFactory(_ref) {
48454
48517
  logAnalyticsEvent('applyVideoFilter', 'Attempt', {
48455
48518
  videoFilter: sanitizedVideoFilter
48456
48519
  });
48457
- _context52.prev = 3;
48520
+ _context53.prev = 3;
48458
48521
  if (!_videoMediaProcessorConnector) {
48459
- _context52.next = 6;
48522
+ _context53.next = 6;
48460
48523
  break;
48461
48524
  }
48462
48525
  throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply video filter when videoMediaProcessorConnector is set.'));
48463
48526
  case 6:
48464
48527
  isSupported = MediaProcessor.isSupported('video');
48465
48528
  if (isSupported) {
48466
- _context52.next = 9;
48529
+ _context53.next = 9;
48467
48530
  break;
48468
48531
  }
48469
48532
  throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support video filters (Insertable Streams and Worker APIs are required)'));
48470
48533
  case 9:
48471
48534
  if (mediaProcessor.isValidVideoFilter(videoFilter)) {
48472
- _context52.next = 11;
48535
+ _context53.next = 11;
48473
48536
  break;
48474
48537
  }
48475
48538
  throw otError(Errors.INVALID_PARAMETER, new Error('Video filter has invalid configuration'));
48476
48539
  case 11:
48477
48540
  if (webRTCStream) {
48478
- _context52.next = 16;
48541
+ _context53.next = 16;
48479
48542
  break;
48480
48543
  }
48481
48544
  message = 'Ignoring. No mediaStream';
@@ -48483,53 +48546,53 @@ function PublisherFactory(_ref) {
48483
48546
  message
48484
48547
  });
48485
48548
  logging.warn(message);
48486
- return _context52.abrupt("return");
48549
+ return _context53.abrupt("return");
48487
48550
  case 16:
48488
48551
  if (!isScreenSharing) {
48489
- _context52.next = 18;
48552
+ _context53.next = 18;
48490
48553
  break;
48491
48554
  }
48492
48555
  throw otError(Errors.INVALID_PARAMETER, new Error('Video filters can not be applied to screen share'));
48493
48556
  case 18:
48494
48557
  enableMediaProcessorLogging();
48495
48558
  if (properties.publishVideo) {
48496
- _context52.next = 23;
48559
+ _context53.next = 23;
48497
48560
  break;
48498
48561
  }
48499
48562
  currentVideoFilter = videoFilter;
48500
48563
  logAnalyticsEvent('applyVideoFilter', 'Success', {
48501
48564
  videoFilter: sanitizedVideoFilter
48502
48565
  });
48503
- return _context52.abrupt("return");
48566
+ return _context53.abrupt("return");
48504
48567
  case 23:
48505
48568
  if (!mediaProcessor.getVideoFilter()) {
48506
- _context52.next = 38;
48569
+ _context53.next = 38;
48507
48570
  break;
48508
48571
  }
48509
48572
  if (!mediaProcessor.canUpdateVideoFilter(videoFilter.type)) {
48510
- _context52.next = 36;
48573
+ _context53.next = 36;
48511
48574
  break;
48512
48575
  }
48513
- _context52.prev = 25;
48514
- _context52.next = 28;
48576
+ _context53.prev = 25;
48577
+ _context53.next = 28;
48515
48578
  return mediaProcessor.updateVideoFilter(videoFilter);
48516
48579
  case 28:
48517
48580
  currentVideoFilter = videoFilter;
48518
48581
  logAnalyticsEvent('applyVideoFilter', 'Success', {
48519
48582
  videoFilter: sanitizedVideoFilter
48520
48583
  });
48521
- return _context52.abrupt("return");
48584
+ return _context53.abrupt("return");
48522
48585
  case 33:
48523
- _context52.prev = 33;
48524
- _context52.t0 = _context52["catch"](25);
48525
- logging.warn(`Error updating video filter: ${_context52.t0}`);
48586
+ _context53.prev = 33;
48587
+ _context53.t0 = _context53["catch"](25);
48588
+ logging.warn(`Error updating video filter: ${_context53.t0}`);
48526
48589
  case 36:
48527
- _context52.next = 38;
48590
+ _context53.next = 38;
48528
48591
  return _this.clearVideoFilter();
48529
48592
  case 38:
48530
48593
  _webRTCStream$getVide2 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide2[0];
48531
48594
  if (originalVideoTrack) {
48532
- _context52.next = 44;
48595
+ _context53.next = 44;
48533
48596
  break;
48534
48597
  }
48535
48598
  message = 'Ignoring. No video';
@@ -48537,33 +48600,33 @@ function PublisherFactory(_ref) {
48537
48600
  message
48538
48601
  });
48539
48602
  logging.warn(message);
48540
- return _context52.abrupt("return");
48603
+ return _context53.abrupt("return");
48541
48604
  case 44:
48542
- _context52.next = 46;
48605
+ _context53.next = 46;
48543
48606
  return mediaProcessor.setVideoFilter(videoFilter, avoidOriginalTrackLeak);
48544
48607
  case 46:
48545
- _context52.next = 48;
48608
+ _context53.next = 48;
48546
48609
  return mediaProcessor.setMediaStream(webRTCStream);
48547
48610
  case 48:
48548
- filteredVideoTrack = _context52.sent;
48611
+ filteredVideoTrack = _context53.sent;
48549
48612
  if (!filteredVideoTrack) {
48550
- _context52.next = 53;
48613
+ _context53.next = 53;
48551
48614
  break;
48552
48615
  }
48553
48616
  filteredVideoTrackId = filteredVideoTrack.id;
48554
- _context52.next = 53;
48617
+ _context53.next = 53;
48555
48618
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
48556
48619
  case 53:
48557
- _context52.next = 60;
48620
+ _context53.next = 60;
48558
48621
  break;
48559
48622
  case 55:
48560
- _context52.prev = 55;
48561
- _context52.t1 = _context52["catch"](3);
48562
- logging.error(`Error applying video filter: ${_context52.t1}`);
48623
+ _context53.prev = 55;
48624
+ _context53.t1 = _context53["catch"](3);
48625
+ logging.error(`Error applying video filter: ${_context53.t1}`);
48563
48626
  logAnalyticsEvent('applyVideoFilter', 'Failure', {
48564
- message: _context52.t1.message
48627
+ message: _context53.t1.message
48565
48628
  });
48566
- throw _context52.t1;
48629
+ throw _context53.t1;
48567
48630
  case 60:
48568
48631
  currentVideoFilter = videoFilter;
48569
48632
  logAnalyticsEvent('applyVideoFilter', 'Success', {
@@ -48571,12 +48634,12 @@ function PublisherFactory(_ref) {
48571
48634
  });
48572
48635
  case 62:
48573
48636
  case "end":
48574
- return _context52.stop();
48637
+ return _context53.stop();
48575
48638
  }
48576
- }, _callee52, null, [[3, 55], [25, 33]]);
48639
+ }, _callee53, null, [[3, 55], [25, 33]]);
48577
48640
  }));
48578
- return function (_x40, _x41) {
48579
- return _ref59.apply(this, arguments);
48641
+ return function (_x42, _x43) {
48642
+ return _ref60.apply(this, arguments);
48580
48643
  };
48581
48644
  }();
48582
48645
 
@@ -48683,35 +48746,35 @@ function PublisherFactory(_ref) {
48683
48746
  * If there is an error, the promise is rejected and no new video filter is set.
48684
48747
  */
48685
48748
  this.applyAudioFilter = /*#__PURE__*/function () {
48686
- var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(audioFilter) {
48749
+ var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(audioFilter) {
48687
48750
  var isSupported, message, _getNoiseSuppressionC, assetsDirBaseUrl, vonageNoiseSuppression, noiseSuppressionConnector;
48688
- return _regenerator.default.wrap(function _callee53$(_context53) {
48689
- while (1) switch (_context53.prev = _context53.next) {
48751
+ return _regenerator.default.wrap(function _callee54$(_context54) {
48752
+ while (1) switch (_context54.prev = _context54.next) {
48690
48753
  case 0:
48691
48754
  logAnalyticsEvent('applyAudioFilter', 'Attempt', {
48692
48755
  audioFilter
48693
48756
  });
48694
48757
  isSupported = MediaProcessor.isSupported('audio');
48695
48758
  if (isSupported) {
48696
- _context53.next = 4;
48759
+ _context54.next = 4;
48697
48760
  break;
48698
48761
  }
48699
48762
  throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support audio filters (Insertable Streams and Worker APIs are required)'));
48700
48763
  case 4:
48701
48764
  if ((0, _isValidAudioFilter.default)(audioFilter)) {
48702
- _context53.next = 6;
48765
+ _context54.next = 6;
48703
48766
  break;
48704
48767
  }
48705
48768
  throw otError(Errors.INVALID_PARAMETER, new Error('Audio filter has invalid configuration'));
48706
48769
  case 6:
48707
48770
  if (!_audioMediaProcessorConnector) {
48708
- _context53.next = 8;
48771
+ _context54.next = 8;
48709
48772
  break;
48710
48773
  }
48711
48774
  throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply audio filter when audioMediaProcessorConnector is set.'));
48712
48775
  case 8:
48713
48776
  if (webRTCStream) {
48714
- _context53.next = 13;
48777
+ _context54.next = 13;
48715
48778
  break;
48716
48779
  }
48717
48780
  message = 'Ignoring. No mediaStream';
@@ -48719,68 +48782,68 @@ function PublisherFactory(_ref) {
48719
48782
  message
48720
48783
  });
48721
48784
  logging.warn(message);
48722
- return _context53.abrupt("return");
48785
+ return _context54.abrupt("return");
48723
48786
  case 13:
48724
48787
  if (properties.publishAudio) {
48725
- _context53.next = 17;
48788
+ _context54.next = 17;
48726
48789
  break;
48727
48790
  }
48728
48791
  currentAudioFilter = audioFilter;
48729
48792
  logAnalyticsEvent('applyAudioFilter', 'Success', {
48730
48793
  audioFilter
48731
48794
  });
48732
- return _context53.abrupt("return");
48795
+ return _context54.abrupt("return");
48733
48796
  case 17:
48734
48797
  if (!_this.getAudioFilter()) {
48735
- _context53.next = 20;
48798
+ _context54.next = 20;
48736
48799
  break;
48737
48800
  }
48738
- _context53.next = 20;
48801
+ _context54.next = 20;
48739
48802
  return _this.clearAudioFilter();
48740
48803
  case 20:
48741
- _context53.prev = 20;
48804
+ _context54.prev = 20;
48742
48805
  if (!(audioFilter.type === 'advancedNoiseSuppression')) {
48743
- _context53.next = 32;
48806
+ _context54.next = 32;
48744
48807
  break;
48745
48808
  }
48746
48809
  _getNoiseSuppressionC = (0, _getDefaultConfig.default)({
48747
48810
  proxyUrl: (0, _proxyUrl.getProxyUrl)()
48748
48811
  }), assetsDirBaseUrl = _getNoiseSuppressionC.assetsDirBaseUrl;
48749
48812
  vonageNoiseSuppression = createVonageNoiseSuppression();
48750
- _context53.next = 26;
48813
+ _context54.next = 26;
48751
48814
  return vonageNoiseSuppression.init({
48752
48815
  assetsDirBaseUrl
48753
48816
  });
48754
48817
  case 26:
48755
- _context53.next = 28;
48818
+ _context54.next = 28;
48756
48819
  return vonageNoiseSuppression.getConnector();
48757
48820
  case 28:
48758
- noiseSuppressionConnector = _context53.sent;
48759
- _context53.next = 31;
48821
+ noiseSuppressionConnector = _context54.sent;
48822
+ _context54.next = 31;
48760
48823
  return _setAudioMediaProcessorConnector(noiseSuppressionConnector);
48761
48824
  case 31:
48762
48825
  currentAudioFilter = audioFilter;
48763
48826
  case 32:
48764
- _context53.next = 39;
48827
+ _context54.next = 39;
48765
48828
  break;
48766
48829
  case 34:
48767
- _context53.prev = 34;
48768
- _context53.t0 = _context53["catch"](20);
48769
- logging.error(`Error applying audio filter: ${_context53.t0}`);
48830
+ _context54.prev = 34;
48831
+ _context54.t0 = _context54["catch"](20);
48832
+ logging.error(`Error applying audio filter: ${_context54.t0}`);
48770
48833
  logAnalyticsEvent('applyAudioFilter', 'Failure', {
48771
- message: _context53.t0.message
48834
+ message: _context54.t0.message
48772
48835
  });
48773
- throw _context53.t0;
48836
+ throw _context54.t0;
48774
48837
  case 39:
48775
48838
  logAnalyticsEvent('applyAudioFilter', 'Success');
48776
48839
  case 40:
48777
48840
  case "end":
48778
- return _context53.stop();
48841
+ return _context54.stop();
48779
48842
  }
48780
- }, _callee53, null, [[20, 34]]);
48843
+ }, _callee54, null, [[20, 34]]);
48781
48844
  }));
48782
- return function (_x42) {
48783
- return _ref60.apply(this, arguments);
48845
+ return function (_x44) {
48846
+ return _ref61.apply(this, arguments);
48784
48847
  };
48785
48848
  }();
48786
48849
 
@@ -48801,22 +48864,22 @@ function PublisherFactory(_ref) {
48801
48864
  * @return {Promise} A promise that resolves when the operation completes successfully.
48802
48865
  * If there is an error, the promise is rejected.
48803
48866
  */
48804
- this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
48867
+ this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
48805
48868
  var message;
48806
- return _regenerator.default.wrap(function _callee54$(_context54) {
48807
- while (1) switch (_context54.prev = _context54.next) {
48869
+ return _regenerator.default.wrap(function _callee55$(_context55) {
48870
+ while (1) switch (_context55.prev = _context55.next) {
48808
48871
  case 0:
48809
48872
  logAnalyticsEvent('clearAudioFilter', 'Attempt');
48810
48873
  if (!(!properties.publishAudio && _this.getAudioFilter())) {
48811
- _context54.next = 5;
48874
+ _context55.next = 5;
48812
48875
  break;
48813
48876
  }
48814
48877
  currentAudioFilter = null;
48815
48878
  logAnalyticsEvent('clearAudioFilter', 'Success');
48816
- return _context54.abrupt("return");
48879
+ return _context55.abrupt("return");
48817
48880
  case 5:
48818
48881
  if (MediaProcessor.isSupported('audio')) {
48819
- _context54.next = 10;
48882
+ _context55.next = 10;
48820
48883
  break;
48821
48884
  }
48822
48885
  message = 'Ignoring. "clearAudioFilter" not supported.';
@@ -48824,10 +48887,10 @@ function PublisherFactory(_ref) {
48824
48887
  message
48825
48888
  });
48826
48889
  logging.warn(message);
48827
- return _context54.abrupt("return");
48890
+ return _context55.abrupt("return");
48828
48891
  case 10:
48829
48892
  if (_this.getAudioFilter()) {
48830
- _context54.next = 15;
48893
+ _context55.next = 15;
48831
48894
  break;
48832
48895
  }
48833
48896
  message = 'Ignoring. No audio filter applied';
@@ -48835,10 +48898,10 @@ function PublisherFactory(_ref) {
48835
48898
  message
48836
48899
  });
48837
48900
  logging.debug(message);
48838
- return _context54.abrupt("return");
48901
+ return _context55.abrupt("return");
48839
48902
  case 15:
48840
48903
  if (webRTCStream) {
48841
- _context54.next = 20;
48904
+ _context55.next = 20;
48842
48905
  break;
48843
48906
  }
48844
48907
  message = 'Ignoring. No mediaStream';
@@ -48846,29 +48909,29 @@ function PublisherFactory(_ref) {
48846
48909
  message
48847
48910
  });
48848
48911
  logging.warn(message);
48849
- return _context54.abrupt("return");
48912
+ return _context55.abrupt("return");
48850
48913
  case 20:
48851
- _context54.prev = 20;
48852
- _context54.next = 23;
48914
+ _context55.prev = 20;
48915
+ _context55.next = 23;
48853
48916
  return _setAudioMediaProcessorConnector(null);
48854
48917
  case 23:
48855
48918
  currentAudioFilter = null;
48856
- _context54.next = 30;
48919
+ _context55.next = 30;
48857
48920
  break;
48858
48921
  case 26:
48859
- _context54.prev = 26;
48860
- _context54.t0 = _context54["catch"](20);
48922
+ _context55.prev = 26;
48923
+ _context55.t0 = _context55["catch"](20);
48861
48924
  logAnalyticsEvent('clearAudioFilter', 'Failure', {
48862
- error: _context54.t0
48925
+ error: _context55.t0
48863
48926
  });
48864
- return _context54.abrupt("return");
48927
+ return _context55.abrupt("return");
48865
48928
  case 30:
48866
48929
  logAnalyticsEvent('clearAudioFilter', 'Success');
48867
48930
  case 31:
48868
48931
  case "end":
48869
- return _context54.stop();
48932
+ return _context55.stop();
48870
48933
  }
48871
- }, _callee54, null, [[20, 26]]);
48934
+ }, _callee55, null, [[20, 26]]);
48872
48935
  }));
48873
48936
 
48874
48937
  /**
@@ -48963,16 +49026,16 @@ function PublisherFactory(_ref) {
48963
49026
  * If there is an error, the promise is rejected and no connector is set.
48964
49027
  */
48965
49028
  this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
48966
- var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(mediaProcessorConnector) {
49029
+ var _ref63 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(mediaProcessorConnector) {
48967
49030
  var _webRTCStream$getVide3, filteredVideoTrack, videoTrack, _webRTCStream$getVide4, originalVideoTrack, message;
48968
- return _regenerator.default.wrap(function _callee55$(_context55) {
48969
- while (1) switch (_context55.prev = _context55.next) {
49031
+ return _regenerator.default.wrap(function _callee56$(_context56) {
49032
+ while (1) switch (_context56.prev = _context56.next) {
48970
49033
  case 0:
48971
49034
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Attempt', {
48972
49035
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
48973
49036
  });
48974
49037
  if (!_this.getVideoFilter()) {
48975
- _context55.next = 4;
49038
+ _context56.next = 4;
48976
49039
  break;
48977
49040
  }
48978
49041
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
@@ -48981,16 +49044,16 @@ function PublisherFactory(_ref) {
48981
49044
  throw otError(Errors.NOT_SUPPORTED, new Error('setVideoMediaProcessorConnector: Cannot use this method when videoFilter is set.'));
48982
49045
  case 4:
48983
49046
  if (!_videoMediaProcessorConnector) {
48984
- _context55.next = 15;
49047
+ _context56.next = 15;
48985
49048
  break;
48986
49049
  }
48987
49050
  _webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
48988
- _context55.next = 8;
49051
+ _context56.next = 8;
48989
49052
  return getTrackFromDeviceId(currentDeviceId);
48990
49053
  case 8:
48991
- videoTrack = _context55.sent;
49054
+ videoTrack = _context56.sent;
48992
49055
  filteredVideoTrackId = null;
48993
- _context55.next = 12;
49056
+ _context56.next = 12;
48994
49057
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
48995
49058
  case 12:
48996
49059
  _videoMediaProcessorConnector.destroy();
@@ -48998,16 +49061,16 @@ function PublisherFactory(_ref) {
48998
49061
  _videoMediaProcessorConnector = null;
48999
49062
  case 15:
49000
49063
  if (mediaProcessorConnector) {
49001
- _context55.next = 18;
49064
+ _context56.next = 18;
49002
49065
  break;
49003
49066
  }
49004
49067
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
49005
49068
  message: 'clearing the connector'
49006
49069
  });
49007
- return _context55.abrupt("return");
49070
+ return _context56.abrupt("return");
49008
49071
  case 18:
49009
49072
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
49010
- _context55.next = 21;
49073
+ _context56.next = 21;
49011
49074
  break;
49012
49075
  }
49013
49076
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
@@ -49018,7 +49081,7 @@ function PublisherFactory(_ref) {
49018
49081
  _videoMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
49019
49082
  _webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
49020
49083
  if (originalVideoTrack) {
49021
- _context55.next = 29;
49084
+ _context56.next = 29;
49022
49085
  break;
49023
49086
  }
49024
49087
  message = 'Connector not set as no video track is present.';
@@ -49027,38 +49090,38 @@ function PublisherFactory(_ref) {
49027
49090
  });
49028
49091
  logging.warn(`setVideoMediaProcessorConnector: ${message}`);
49029
49092
  _videoMediaProcessorConnector = null;
49030
- return _context55.abrupt("return");
49093
+ return _context56.abrupt("return");
49031
49094
  case 29:
49032
- _context55.prev = 29;
49033
- _context55.next = 32;
49095
+ _context56.prev = 29;
49096
+ _context56.next = 32;
49034
49097
  return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
49035
49098
  case 32:
49036
- filteredVideoTrack = _context55.sent;
49099
+ filteredVideoTrack = _context56.sent;
49037
49100
  filteredVideoTrackId = filteredVideoTrack.id;
49038
- _context55.next = 36;
49101
+ _context56.next = 36;
49039
49102
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
49040
49103
  case 36:
49041
- _context55.next = 44;
49104
+ _context56.next = 44;
49042
49105
  break;
49043
49106
  case 38:
49044
- _context55.prev = 38;
49045
- _context55.t0 = _context55["catch"](29);
49107
+ _context56.prev = 38;
49108
+ _context56.t0 = _context56["catch"](29);
49046
49109
  _videoMediaProcessorConnector = null;
49047
- logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context55.t0}`);
49110
+ logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context56.t0}`);
49048
49111
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
49049
- message: _context55.t0.message
49112
+ message: _context56.t0.message
49050
49113
  });
49051
- throw _context55.t0;
49114
+ throw _context56.t0;
49052
49115
  case 44:
49053
49116
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
49054
49117
  case 45:
49055
49118
  case "end":
49056
- return _context55.stop();
49119
+ return _context56.stop();
49057
49120
  }
49058
- }, _callee55, null, [[29, 38]]);
49121
+ }, _callee56, null, [[29, 38]]);
49059
49122
  }));
49060
- return function (_x43) {
49061
- return _ref62.apply(this, arguments);
49123
+ return function (_x45) {
49124
+ return _ref63.apply(this, arguments);
49062
49125
  };
49063
49126
  }();
49064
49127
 
@@ -49122,71 +49185,71 @@ function PublisherFactory(_ref) {
49122
49185
  * If there is an error, the promise is rejected and no connector is set.
49123
49186
  */
49124
49187
  this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
49125
- var _ref63 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(mediaProcessorConnector) {
49126
- return _regenerator.default.wrap(function _callee56$(_context56) {
49127
- while (1) switch (_context56.prev = _context56.next) {
49188
+ var _ref64 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
49189
+ return _regenerator.default.wrap(function _callee57$(_context57) {
49190
+ while (1) switch (_context57.prev = _context57.next) {
49128
49191
  case 0:
49129
49192
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Attempt', {
49130
49193
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
49131
49194
  });
49132
- _context56.prev = 1;
49133
- _context56.next = 4;
49195
+ _context57.prev = 1;
49196
+ _context57.next = 4;
49134
49197
  return _setAudioMediaProcessorConnector(mediaProcessorConnector);
49135
49198
  case 4:
49136
49199
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
49137
49200
  message: mediaProcessorConnector ? undefined : 'clearing the connector'
49138
49201
  });
49139
- _context56.next = 11;
49202
+ _context57.next = 11;
49140
49203
  break;
49141
49204
  case 7:
49142
- _context56.prev = 7;
49143
- _context56.t0 = _context56["catch"](1);
49205
+ _context57.prev = 7;
49206
+ _context57.t0 = _context57["catch"](1);
49144
49207
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Failure', {
49145
- message: _context56.t0.message
49208
+ message: _context57.t0.message
49146
49209
  });
49147
- throw _context56.t0;
49210
+ throw _context57.t0;
49148
49211
  case 11:
49149
49212
  case "end":
49150
- return _context56.stop();
49213
+ return _context57.stop();
49151
49214
  }
49152
- }, _callee56, null, [[1, 7]]);
49215
+ }, _callee57, null, [[1, 7]]);
49153
49216
  }));
49154
- return function (_x44) {
49155
- return _ref63.apply(this, arguments);
49217
+ return function (_x46) {
49218
+ return _ref64.apply(this, arguments);
49156
49219
  };
49157
49220
  }();
49158
49221
  const _setAudioMediaProcessorConnector = /*#__PURE__*/function () {
49159
- var _ref64 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
49222
+ var _ref65 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(mediaProcessorConnector) {
49160
49223
  var message, _webRTCStream$getAudi, filteredAudioTrack, _webRTCStream$getAudi2, originalAudioTrack;
49161
- return _regenerator.default.wrap(function _callee57$(_context57) {
49162
- while (1) switch (_context57.prev = _context57.next) {
49224
+ return _regenerator.default.wrap(function _callee58$(_context58) {
49225
+ while (1) switch (_context58.prev = _context58.next) {
49163
49226
  case 0:
49164
49227
  if (!(_this.getAudioFilter() && mediaProcessorConnector)) {
49165
- _context57.next = 3;
49228
+ _context58.next = 3;
49166
49229
  break;
49167
49230
  }
49168
49231
  message = 'Tried to set audio MediaProcessorConnector when audio filter applied.';
49169
49232
  throw otError(Errors.NOT_SUPPORTED, new Error(message));
49170
49233
  case 3:
49171
49234
  if (!_audioMediaProcessorConnector) {
49172
- _context57.next = 9;
49235
+ _context58.next = 9;
49173
49236
  break;
49174
49237
  }
49175
49238
  _webRTCStream$getAudi = webRTCStream.getAudioTracks(), filteredAudioTrack = _webRTCStream$getAudi[0];
49176
- _context57.next = 7;
49239
+ _context58.next = 7;
49177
49240
  return replaceAudioTrack(filteredAudioTrack, _audioMediaProcessorConnector.originalTrack);
49178
49241
  case 7:
49179
49242
  _audioMediaProcessorConnector.destroy();
49180
49243
  _audioMediaProcessorConnector = null;
49181
49244
  case 9:
49182
49245
  if (mediaProcessorConnector) {
49183
- _context57.next = 11;
49246
+ _context58.next = 11;
49184
49247
  break;
49185
49248
  }
49186
- return _context57.abrupt("return");
49249
+ return _context58.abrupt("return");
49187
49250
  case 11:
49188
49251
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
49189
- _context57.next = 14;
49252
+ _context58.next = 14;
49190
49253
  break;
49191
49254
  }
49192
49255
  message = 'Invalid MediaProcessorConnector';
@@ -49194,7 +49257,7 @@ function PublisherFactory(_ref) {
49194
49257
  case 14:
49195
49258
  _webRTCStream$getAudi2 = webRTCStream.getAudioTracks(), originalAudioTrack = _webRTCStream$getAudi2[0];
49196
49259
  if (originalAudioTrack) {
49197
- _context57.next = 20;
49260
+ _context58.next = 20;
49198
49261
  break;
49199
49262
  }
49200
49263
  message = 'Connector not set as no audio track is present.';
@@ -49203,30 +49266,30 @@ function PublisherFactory(_ref) {
49203
49266
  throw new Error(message);
49204
49267
  case 20:
49205
49268
  _audioMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
49206
- _context57.prev = 21;
49207
- _context57.next = 24;
49269
+ _context58.prev = 21;
49270
+ _context58.next = 24;
49208
49271
  return _audioMediaProcessorConnector.setTrack(originalAudioTrack);
49209
49272
  case 24:
49210
- filteredAudioTrack = _context57.sent;
49211
- _context57.next = 27;
49273
+ filteredAudioTrack = _context58.sent;
49274
+ _context58.next = 27;
49212
49275
  return replaceAudioTrack(_this._getAudioSource(), filteredAudioTrack);
49213
49276
  case 27:
49214
- _context57.next = 34;
49277
+ _context58.next = 34;
49215
49278
  break;
49216
49279
  case 29:
49217
- _context57.prev = 29;
49218
- _context57.t0 = _context57["catch"](21);
49280
+ _context58.prev = 29;
49281
+ _context58.t0 = _context58["catch"](21);
49219
49282
  _audioMediaProcessorConnector = null;
49220
- logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context57.t0}`);
49221
- throw _context57.t0;
49283
+ logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context58.t0}`);
49284
+ throw _context58.t0;
49222
49285
  case 34:
49223
49286
  case "end":
49224
- return _context57.stop();
49287
+ return _context58.stop();
49225
49288
  }
49226
- }, _callee57, null, [[21, 29]]);
49289
+ }, _callee58, null, [[21, 29]]);
49227
49290
  }));
49228
- return function _setAudioMediaProcessorConnector(_x45) {
49229
- return _ref64.apply(this, arguments);
49291
+ return function _setAudioMediaProcessorConnector(_x47) {
49292
+ return _ref65.apply(this, arguments);
49230
49293
  };
49231
49294
  }();
49232
49295
 
@@ -49247,22 +49310,22 @@ function PublisherFactory(_ref) {
49247
49310
  * @return {Promise} A promise that resolves when the operation completes successfully.
49248
49311
  * If there is an error, the promise is rejected.
49249
49312
  */
49250
- this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
49313
+ this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59() {
49251
49314
  var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, videoTrack;
49252
- return _regenerator.default.wrap(function _callee58$(_context58) {
49253
- while (1) switch (_context58.prev = _context58.next) {
49315
+ return _regenerator.default.wrap(function _callee59$(_context59) {
49316
+ while (1) switch (_context59.prev = _context59.next) {
49254
49317
  case 0:
49255
49318
  logAnalyticsEvent('clearVideoFilter', 'Attempt');
49256
49319
  if (!(!properties.publishVideo && !mediaProcessor.getVideoFilter())) {
49257
- _context58.next = 5;
49320
+ _context59.next = 5;
49258
49321
  break;
49259
49322
  }
49260
49323
  currentVideoFilter = null;
49261
49324
  logAnalyticsEvent('clearVideoFilter', 'Success');
49262
- return _context58.abrupt("return");
49325
+ return _context59.abrupt("return");
49263
49326
  case 5:
49264
49327
  if (!(!mediaProcessor.getVideoFilter() && !currentVideoFilter)) {
49265
- _context58.next = 10;
49328
+ _context59.next = 10;
49266
49329
  break;
49267
49330
  }
49268
49331
  message = 'Ignoring. No video filter applied';
@@ -49270,10 +49333,10 @@ function PublisherFactory(_ref) {
49270
49333
  message
49271
49334
  });
49272
49335
  logging.debug(message);
49273
- return _context58.abrupt("return");
49336
+ return _context59.abrupt("return");
49274
49337
  case 10:
49275
49338
  if (MediaProcessor.isSupported('video')) {
49276
- _context58.next = 15;
49339
+ _context59.next = 15;
49277
49340
  break;
49278
49341
  }
49279
49342
  message = 'Ignoring. "clearVideoFilter" not supported.';
@@ -49281,10 +49344,10 @@ function PublisherFactory(_ref) {
49281
49344
  message
49282
49345
  });
49283
49346
  logging.warn(message);
49284
- return _context58.abrupt("return");
49347
+ return _context59.abrupt("return");
49285
49348
  case 15:
49286
49349
  if (webRTCStream) {
49287
- _context58.next = 20;
49350
+ _context59.next = 20;
49288
49351
  break;
49289
49352
  }
49290
49353
  message = 'Ignoring. No mediaStream';
@@ -49292,44 +49355,44 @@ function PublisherFactory(_ref) {
49292
49355
  message
49293
49356
  });
49294
49357
  logging.warn(message);
49295
- return _context58.abrupt("return");
49358
+ return _context59.abrupt("return");
49296
49359
  case 20:
49297
49360
  oldVideoFilter = currentVideoFilter;
49298
49361
  currentVideoFilter = null;
49299
49362
  _webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0];
49300
- _context58.prev = 23;
49301
- _context58.next = 26;
49363
+ _context59.prev = 23;
49364
+ _context59.next = 26;
49302
49365
  return getTrackFromDeviceId(currentDeviceId);
49303
49366
  case 26:
49304
- videoTrack = _context58.sent;
49305
- _context58.next = 33;
49367
+ videoTrack = _context59.sent;
49368
+ _context59.next = 33;
49306
49369
  break;
49307
49370
  case 29:
49308
- _context58.prev = 29;
49309
- _context58.t0 = _context58["catch"](23);
49310
- logging.error(_context58.t0);
49311
- return _context58.abrupt("return");
49371
+ _context59.prev = 29;
49372
+ _context59.t0 = _context59["catch"](23);
49373
+ logging.error(_context59.t0);
49374
+ return _context59.abrupt("return");
49312
49375
  case 33:
49313
49376
  if (videoTrack) {
49314
- _context58.next = 36;
49377
+ _context59.next = 36;
49315
49378
  break;
49316
49379
  }
49317
49380
  logging.warn('Failed to clear filter because there is no video track.');
49318
- return _context58.abrupt("return");
49381
+ return _context59.abrupt("return");
49319
49382
  case 36:
49320
49383
  filteredVideoTrackId = null;
49321
- _context58.prev = 37;
49322
- _context58.next = 40;
49384
+ _context59.prev = 37;
49385
+ _context59.next = 40;
49323
49386
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
49324
49387
  case 40:
49325
- _context58.next = 42;
49388
+ _context59.next = 42;
49326
49389
  return destroyMediaProcessor();
49327
49390
  case 42:
49328
- _context58.next = 47;
49391
+ _context59.next = 47;
49329
49392
  break;
49330
49393
  case 44:
49331
- _context58.prev = 44;
49332
- _context58.t1 = _context58["catch"](37);
49394
+ _context59.prev = 44;
49395
+ _context59.t1 = _context59["catch"](37);
49333
49396
  // Restore the previous filter since this call has failed. This way, this function can be
49334
49397
  // called again if needed.
49335
49398
  currentVideoFilter = oldVideoFilter;
@@ -49337,29 +49400,29 @@ function PublisherFactory(_ref) {
49337
49400
  logAnalyticsEvent('clearVideoFilter', 'Success');
49338
49401
  case 48:
49339
49402
  case "end":
49340
- return _context58.stop();
49403
+ return _context59.stop();
49341
49404
  }
49342
- }, _callee58, null, [[23, 29], [37, 44]]);
49405
+ }, _callee59, null, [[23, 29], [37, 44]]);
49343
49406
  }));
49344
49407
  const applySetMaxBitrateToPeerConnection = /*#__PURE__*/function () {
49345
- var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(peerConnection) {
49408
+ var _ref67 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60(peerConnection) {
49346
49409
  var maxBitrateHasChanged, isPreset;
49347
- return _regenerator.default.wrap(function _callee59$(_context59) {
49348
- while (1) switch (_context59.prev = _context59.next) {
49410
+ return _regenerator.default.wrap(function _callee60$(_context60) {
49411
+ while (1) switch (_context60.prev = _context60.next) {
49349
49412
  case 0:
49350
- _context59.next = 2;
49413
+ _context60.next = 2;
49351
49414
  return peerConnection.setMaxBitrate(_videoMaxBitrateSetting);
49352
49415
  case 2:
49353
- maxBitrateHasChanged = _context59.sent;
49416
+ maxBitrateHasChanged = _context60.sent;
49354
49417
  if (!maxBitrateHasChanged) {
49355
- _context59.next = 8;
49418
+ _context60.next = 8;
49356
49419
  break;
49357
49420
  }
49358
49421
  if (!(_videoMaxBitrateSetting === 0)) {
49359
- _context59.next = 6;
49422
+ _context60.next = 6;
49360
49423
  break;
49361
49424
  }
49362
- return _context59.abrupt("return");
49425
+ return _context60.abrupt("return");
49363
49426
  case 6:
49364
49427
  isPreset = typeof _videoMaxBitrateSetting === 'string';
49365
49428
  if (isPreset) {
@@ -49371,12 +49434,12 @@ function PublisherFactory(_ref) {
49371
49434
  }
49372
49435
  case 8:
49373
49436
  case "end":
49374
- return _context59.stop();
49437
+ return _context60.stop();
49375
49438
  }
49376
- }, _callee59);
49439
+ }, _callee60);
49377
49440
  }));
49378
- return function applySetMaxBitrateToPeerConnection(_x46) {
49379
- return _ref66.apply(this, arguments);
49441
+ return function applySetMaxBitrateToPeerConnection(_x48) {
49442
+ return _ref67.apply(this, arguments);
49380
49443
  };
49381
49444
  }();
49382
49445
 
@@ -49404,16 +49467,16 @@ function PublisherFactory(_ref) {
49404
49467
  */
49405
49468
  this.getVideoBitratePreset = () => properties.videoBitratePreset;
49406
49469
  const setMaxVideoBitrateToPublisher = /*#__PURE__*/function () {
49407
- var _ref67 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(peerConnection) {
49470
+ var _ref68 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(peerConnection) {
49408
49471
  var logOptions, applyMaxBitrate, peerConnections;
49409
- return _regenerator.default.wrap(function _callee61$(_context61) {
49410
- while (1) switch (_context61.prev = _context61.next) {
49472
+ return _regenerator.default.wrap(function _callee62$(_context62) {
49473
+ while (1) switch (_context62.prev = _context62.next) {
49411
49474
  case 0:
49412
49475
  if (!(_videoMaxBitrateSetting === undefined)) {
49413
- _context61.next = 2;
49476
+ _context62.next = 2;
49414
49477
  break;
49415
49478
  }
49416
- return _context61.abrupt("return");
49479
+ return _context62.abrupt("return");
49417
49480
  case 2:
49418
49481
  if (isNaN(_videoMaxBitrateSetting)) {
49419
49482
  logOptions = {
@@ -49429,57 +49492,57 @@ function PublisherFactory(_ref) {
49429
49492
  logOptions.NearestResolution = (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight());
49430
49493
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Attempt', {}, logOptions);
49431
49494
  applyMaxBitrate = /*#__PURE__*/function () {
49432
- var _ref68 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60(pc) {
49433
- return _regenerator.default.wrap(function _callee60$(_context60) {
49434
- while (1) switch (_context60.prev = _context60.next) {
49495
+ var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(pc) {
49496
+ return _regenerator.default.wrap(function _callee61$(_context61) {
49497
+ while (1) switch (_context61.prev = _context61.next) {
49435
49498
  case 0:
49436
- _context60.prev = 0;
49437
- _context60.next = 3;
49499
+ _context61.prev = 0;
49500
+ _context61.next = 3;
49438
49501
  return applySetMaxBitrateToPeerConnection(pc);
49439
49502
  case 3:
49440
49503
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', {}, logOptions);
49441
- _context60.next = 11;
49504
+ _context61.next = 11;
49442
49505
  break;
49443
49506
  case 6:
49444
- _context60.prev = 6;
49445
- _context60.t0 = _context60["catch"](0);
49446
- logOptions.failureReason = _context60.t0.message;
49507
+ _context61.prev = 6;
49508
+ _context61.t0 = _context61["catch"](0);
49509
+ logOptions.failureReason = _context61.t0.message;
49447
49510
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', {}, logOptions);
49448
49511
  throw otError(Errors.UNEXPECTED_ERROR_CODE, new Error('An unexpected error was encountered'));
49449
49512
  case 11:
49450
49513
  case "end":
49451
- return _context60.stop();
49514
+ return _context61.stop();
49452
49515
  }
49453
- }, _callee60, null, [[0, 6]]);
49516
+ }, _callee61, null, [[0, 6]]);
49454
49517
  }));
49455
- return function applyMaxBitrate(_x48) {
49456
- return _ref68.apply(this, arguments);
49518
+ return function applyMaxBitrate(_x50) {
49519
+ return _ref69.apply(this, arguments);
49457
49520
  };
49458
49521
  }();
49459
49522
  if (!peerConnection) {
49460
- _context61.next = 11;
49523
+ _context62.next = 11;
49461
49524
  break;
49462
49525
  }
49463
- _context61.next = 9;
49526
+ _context62.next = 9;
49464
49527
  return applyMaxBitrate(peerConnection);
49465
49528
  case 9:
49466
- _context61.next = 16;
49529
+ _context62.next = 16;
49467
49530
  break;
49468
49531
  case 11:
49469
- _context61.next = 13;
49532
+ _context62.next = 13;
49470
49533
  return getAllPeerConnections();
49471
49534
  case 13:
49472
- peerConnections = _context61.sent;
49473
- _context61.next = 16;
49535
+ peerConnections = _context62.sent;
49536
+ _context62.next = 16;
49474
49537
  return Promise.all(peerConnections.map(applyMaxBitrate));
49475
49538
  case 16:
49476
49539
  case "end":
49477
- return _context61.stop();
49540
+ return _context62.stop();
49478
49541
  }
49479
- }, _callee61);
49542
+ }, _callee62);
49480
49543
  }));
49481
- return function setMaxVideoBitrateToPublisher(_x47) {
49482
- return _ref67.apply(this, arguments);
49544
+ return function setMaxVideoBitrateToPublisher(_x49) {
49545
+ return _ref68.apply(this, arguments);
49483
49546
  };
49484
49547
  }();
49485
49548
  const applyVideoConstraintsTo = track => {
@@ -49535,17 +49598,17 @@ function PublisherFactory(_ref) {
49535
49598
  * @memberOf Publisher
49536
49599
  */
49537
49600
  this.setPreferredResolution = /*#__PURE__*/function () {
49538
- var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(preferredResolution) {
49601
+ var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(preferredResolution) {
49539
49602
  var _webRTCStream, _webRTCStream$getVide6, _properties$videoDime3, _properties$videoDime4;
49540
49603
  var message, startingWidth, startingHeight, startingArea, preferredArea, result;
49541
- return _regenerator.default.wrap(function _callee62$(_context62) {
49542
- while (1) switch (_context62.prev = _context62.next) {
49604
+ return _regenerator.default.wrap(function _callee63$(_context63) {
49605
+ while (1) switch (_context63.prev = _context63.next) {
49543
49606
  case 0:
49544
49607
  logAnalyticsEvent('setPreferredResolution', 'Attempt', {
49545
49608
  preferredResolution
49546
49609
  });
49547
49610
  if (!(!properties.publishVideo || !((_webRTCStream = webRTCStream) != null && (_webRTCStream$getVide6 = _webRTCStream.getVideoTracks()) != null && _webRTCStream$getVide6.length))) {
49548
- _context62.next = 5;
49611
+ _context63.next = 5;
49549
49612
  break;
49550
49613
  }
49551
49614
  message = 'setPreferredResolution needs to be called on a video publisher';
@@ -49556,7 +49619,7 @@ function PublisherFactory(_ref) {
49556
49619
  throw new Error(message);
49557
49620
  case 5:
49558
49621
  if (!(!preferredResolution || !Number.isInteger(preferredResolution.width) || preferredResolution.width <= 0 || !Number.isInteger(preferredResolution.height) || preferredResolution.height <= 0)) {
49559
- _context62.next = 9;
49622
+ _context63.next = 9;
49560
49623
  break;
49561
49624
  }
49562
49625
  message = 'preferredResolution must be an object with positive integer width and height properties';
@@ -49571,7 +49634,7 @@ function PublisherFactory(_ref) {
49571
49634
  startingArea = startingWidth * startingHeight;
49572
49635
  preferredArea = preferredResolution.width * preferredResolution.height;
49573
49636
  if (!(preferredArea > startingArea)) {
49574
- _context62.next = 17;
49637
+ _context63.next = 17;
49575
49638
  break;
49576
49639
  }
49577
49640
  message = 'preferredResolution cannot be higher than the initial ' + 'publishing resolution';
@@ -49583,31 +49646,31 @@ function PublisherFactory(_ref) {
49583
49646
  case 17:
49584
49647
  _preferredWidth = preferredResolution.width;
49585
49648
  _preferredHeight = preferredResolution.height;
49586
- _context62.prev = 19;
49587
- _context62.next = 22;
49649
+ _context63.prev = 19;
49650
+ _context63.next = 22;
49588
49651
  return applyVideoConstraints();
49589
49652
  case 22:
49590
- result = _context62.sent;
49653
+ result = _context63.sent;
49591
49654
  logAnalyticsEvent('setPreferredResolution', 'Success', {
49592
49655
  preferredResolution
49593
49656
  });
49594
- return _context62.abrupt("return", result);
49657
+ return _context63.abrupt("return", result);
49595
49658
  case 27:
49596
- _context62.prev = 27;
49597
- _context62.t0 = _context62["catch"](19);
49659
+ _context63.prev = 27;
49660
+ _context63.t0 = _context63["catch"](19);
49598
49661
  logAnalyticsEvent('setPreferredResolution', 'Failure', {
49599
49662
  preferredResolution,
49600
- message: _context62.t0.message
49663
+ message: _context63.t0.message
49601
49664
  });
49602
- throw _context62.t0;
49665
+ throw _context63.t0;
49603
49666
  case 31:
49604
49667
  case "end":
49605
- return _context62.stop();
49668
+ return _context63.stop();
49606
49669
  }
49607
- }, _callee62, null, [[19, 27]]);
49670
+ }, _callee63, null, [[19, 27]]);
49608
49671
  }));
49609
- return function (_x49) {
49610
- return _ref69.apply(this, arguments);
49672
+ return function (_x51) {
49673
+ return _ref70.apply(this, arguments);
49611
49674
  };
49612
49675
  }();
49613
49676
 
@@ -49628,17 +49691,17 @@ function PublisherFactory(_ref) {
49628
49691
  * @memberOf Publisher
49629
49692
  */
49630
49693
  this.setPreferredFrameRate = /*#__PURE__*/function () {
49631
- var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(frameRate) {
49694
+ var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(frameRate) {
49632
49695
  var _webRTCStream2, _webRTCStream2$getVid;
49633
49696
  var message, result;
49634
- return _regenerator.default.wrap(function _callee63$(_context63) {
49635
- while (1) switch (_context63.prev = _context63.next) {
49697
+ return _regenerator.default.wrap(function _callee64$(_context64) {
49698
+ while (1) switch (_context64.prev = _context64.next) {
49636
49699
  case 0:
49637
49700
  logAnalyticsEvent('setPreferredFrameRate', 'Attempt', {
49638
49701
  frameRate
49639
49702
  });
49640
49703
  if (!(!properties.publishVideo || !((_webRTCStream2 = webRTCStream) != null && (_webRTCStream2$getVid = _webRTCStream2.getVideoTracks()) != null && _webRTCStream2$getVid.length))) {
49641
- _context63.next = 5;
49704
+ _context64.next = 5;
49642
49705
  break;
49643
49706
  }
49644
49707
  message = 'setPreferredFrameRate needs to be called on a video publisher';
@@ -49649,7 +49712,7 @@ function PublisherFactory(_ref) {
49649
49712
  throw new Error(message);
49650
49713
  case 5:
49651
49714
  if (!(!Number.isInteger(frameRate) || frameRate < 1)) {
49652
- _context63.next = 9;
49715
+ _context64.next = 9;
49653
49716
  break;
49654
49717
  }
49655
49718
  message = 'Invalid frameRate: must be an integer ≥ 1';
@@ -49660,31 +49723,31 @@ function PublisherFactory(_ref) {
49660
49723
  throw new Error(message);
49661
49724
  case 9:
49662
49725
  _preferredFrameRate = frameRate;
49663
- _context63.prev = 10;
49664
- _context63.next = 13;
49726
+ _context64.prev = 10;
49727
+ _context64.next = 13;
49665
49728
  return applyVideoConstraints();
49666
49729
  case 13:
49667
- result = _context63.sent;
49730
+ result = _context64.sent;
49668
49731
  logAnalyticsEvent('setPreferredFrameRate', 'Success', {
49669
49732
  frameRate
49670
49733
  });
49671
- return _context63.abrupt("return", result);
49734
+ return _context64.abrupt("return", result);
49672
49735
  case 18:
49673
- _context63.prev = 18;
49674
- _context63.t0 = _context63["catch"](10);
49736
+ _context64.prev = 18;
49737
+ _context64.t0 = _context64["catch"](10);
49675
49738
  logAnalyticsEvent('setPreferredFrameRate', 'Failure', {
49676
49739
  frameRate,
49677
- message: _context63.t0.message
49740
+ message: _context64.t0.message
49678
49741
  });
49679
- throw _context63.t0;
49742
+ throw _context64.t0;
49680
49743
  case 22:
49681
49744
  case "end":
49682
- return _context63.stop();
49745
+ return _context64.stop();
49683
49746
  }
49684
- }, _callee63, null, [[10, 18]]);
49747
+ }, _callee64, null, [[10, 18]]);
49685
49748
  }));
49686
- return function (_x50) {
49687
- return _ref70.apply(this, arguments);
49749
+ return function (_x52) {
49750
+ return _ref71.apply(this, arguments);
49688
49751
  };
49689
49752
  }();
49690
49753
 
@@ -49708,44 +49771,44 @@ function PublisherFactory(_ref) {
49708
49771
  * @memberOf Publisher
49709
49772
  */
49710
49773
  this.setMaxVideoBitrate = /*#__PURE__*/function () {
49711
- var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(bitrateBps) {
49774
+ var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(bitrateBps) {
49712
49775
  var bitrate;
49713
- return _regenerator.default.wrap(function _callee64$(_context64) {
49714
- while (1) switch (_context64.prev = _context64.next) {
49776
+ return _regenerator.default.wrap(function _callee65$(_context65) {
49777
+ while (1) switch (_context65.prev = _context65.next) {
49715
49778
  case 0:
49716
49779
  if (!(typeof bitrateBps !== 'number')) {
49717
- _context64.next = 2;
49780
+ _context65.next = 2;
49718
49781
  break;
49719
49782
  }
49720
49783
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
49721
49784
  case 2:
49722
49785
  bitrate = parseInt(bitrateBps, 10);
49723
49786
  if (!(isNaN(bitrate) || bitrate !== 0 && (bitrate < 5000 || bitrate > 10000000))) {
49724
- _context64.next = 5;
49787
+ _context65.next = 5;
49725
49788
  break;
49726
49789
  }
49727
49790
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
49728
49791
  case 5:
49729
49792
  _videoMaxBitrateSetting = bitrate === 0 ? _VideoBitratePreset.default.DEFAULT : bitrate;
49730
49793
  if (isAudioFallbackActive()) {
49731
- _context64.next = 11;
49794
+ _context65.next = 11;
49732
49795
  break;
49733
49796
  }
49734
- _context64.next = 9;
49797
+ _context65.next = 9;
49735
49798
  return setMaxVideoBitrateToPublisher();
49736
49799
  case 9:
49737
- _context64.next = 12;
49800
+ _context65.next = 12;
49738
49801
  break;
49739
49802
  case 11:
49740
49803
  logging.debug('Video is currently inactive, max bitrate will be applied once active.');
49741
49804
  case 12:
49742
49805
  case "end":
49743
- return _context64.stop();
49806
+ return _context65.stop();
49744
49807
  }
49745
- }, _callee64);
49808
+ }, _callee65);
49746
49809
  }));
49747
- return function (_x51) {
49748
- return _ref71.apply(this, arguments);
49810
+ return function (_x53) {
49811
+ return _ref72.apply(this, arguments);
49749
49812
  };
49750
49813
  }();
49751
49814
 
@@ -49767,44 +49830,44 @@ function PublisherFactory(_ref) {
49767
49830
  * @memberOf Publisher
49768
49831
  */
49769
49832
  this.setVideoBitratePreset = /*#__PURE__*/function () {
49770
- var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(preset) {
49833
+ var _ref73 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66(preset) {
49771
49834
  var filteredPreset;
49772
- return _regenerator.default.wrap(function _callee65$(_context65) {
49773
- while (1) switch (_context65.prev = _context65.next) {
49835
+ return _regenerator.default.wrap(function _callee66$(_context66) {
49836
+ while (1) switch (_context66.prev = _context66.next) {
49774
49837
  case 0:
49775
49838
  if (!(typeof preset !== 'string')) {
49776
- _context65.next = 2;
49839
+ _context66.next = 2;
49777
49840
  break;
49778
49841
  }
49779
49842
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid preset. It must be either "default", "bw_saver", or "extra_bw_saver"'));
49780
49843
  case 2:
49781
49844
  filteredPreset = _VideoBitratePreset.default[preset.toUpperCase()];
49782
49845
  if (!(filteredPreset === undefined)) {
49783
- _context65.next = 5;
49846
+ _context66.next = 5;
49784
49847
  break;
49785
49848
  }
49786
49849
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid preset. It must be either "default", "bw_saver", or "extra_bw_saver"'));
49787
49850
  case 5:
49788
49851
  _videoMaxBitrateSetting = filteredPreset;
49789
49852
  if (isAudioFallbackActive()) {
49790
- _context65.next = 11;
49853
+ _context66.next = 11;
49791
49854
  break;
49792
49855
  }
49793
- _context65.next = 9;
49856
+ _context66.next = 9;
49794
49857
  return setMaxVideoBitrateToPublisher();
49795
49858
  case 9:
49796
- _context65.next = 12;
49859
+ _context66.next = 12;
49797
49860
  break;
49798
49861
  case 11:
49799
49862
  logging.debug('Video is currently inactive, bitrate preset will be applied once active.');
49800
49863
  case 12:
49801
49864
  case "end":
49802
- return _context65.stop();
49865
+ return _context66.stop();
49803
49866
  }
49804
- }, _callee65);
49867
+ }, _callee66);
49805
49868
  }));
49806
- return function (_x52) {
49807
- return _ref72.apply(this, arguments);
49869
+ return function (_x54) {
49870
+ return _ref73.apply(this, arguments);
49808
49871
  };
49809
49872
  }();
49810
49873