@opentok/client 2.35.0-alpha.54 → 2.35.0-alpha.55

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 d6f903917
2
+ * @license OpenTok.js 2.35.0 5b7d62ce7
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: Mon, 15 Jun 2026 07:58:33 GMT
8
+ * Date: Tue, 16 Jun 2026 08:15:22 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -8502,6 +8502,7 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(79092));
8502
8502
  var _createClass2 = _interopRequireDefault(__webpack_require__(65044));
8503
8503
  var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(41972));
8504
8504
  var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(20310));
8505
+ var _uuid = _interopRequireDefault(__webpack_require__(68414));
8505
8506
  var _logEvents = _interopRequireDefault(__webpack_require__(32901));
8506
8507
  var _socketCloseCodes = __webpack_require__(1155);
8507
8508
  var _Timer = _interopRequireDefault(__webpack_require__(44299));
@@ -8540,7 +8541,7 @@ var _default = _ref => {
8540
8541
  _this._pingWarningTimer = void 0;
8541
8542
  _this._disconnectTimer = void 0;
8542
8543
  _this._missedAckTimer = void 0;
8543
- _this._queuedMessages = [];
8544
+ _this._queuedMessages = new Map();
8544
8545
  _this._draining = false;
8545
8546
  _this._analytics = new AnalyticsHelper();
8546
8547
  _this._logAnalyticsEvent = _ref2 => {
@@ -8595,8 +8596,9 @@ var _default = _ref => {
8595
8596
  _this._resetDisconnectTimer();
8596
8597
  _this._connectTimer.clear();
8597
8598
  if (from === 'reconnecting') {
8598
- _this._queuedMessages.forEach(msg => _this.send(msg));
8599
- _this._queuedMessages = [];
8599
+ const queuedMessages = _this._queuedMessages;
8600
+ _this._queuedMessages = new Map();
8601
+ queuedMessages.forEach(msg => _this.send(msg));
8600
8602
  _this.emit('reconnected');
8601
8603
  _this._logAnalyticsEvent({
8602
8604
  action: 'WebSocket:reconnect',
@@ -8850,7 +8852,8 @@ var _default = _ref => {
8850
8852
  _proto.send = function send(_ref13) {
8851
8853
  let data = _ref13.data,
8852
8854
  retryAfterReconnect = _ref13.retryAfterReconnect,
8853
- expectAck = _ref13.expectAck;
8855
+ expectAck = _ref13.expectAck,
8856
+ transactionId = _ref13.transactionId;
8854
8857
  // send deviates from WebSocket a little in that it returns a status instead of nothing.
8855
8858
 
8856
8859
  if (this.readyState === ReconnectableSocket.OPEN) {
@@ -8884,7 +8887,7 @@ var _default = _ref => {
8884
8887
  }
8885
8888
  }
8886
8889
  if (retryAfterReconnect) {
8887
- this._queuedMessages.push({
8890
+ this._queuedMessages.set(transactionId != null ? transactionId : (0, _uuid.default)(), {
8888
8891
  data,
8889
8892
  retryAfterReconnect,
8890
8893
  expectAck
@@ -8896,6 +8899,9 @@ var _default = _ref => {
8896
8899
  }
8897
8900
  return sendMessage();
8898
8901
  };
8902
+ _proto.cancel = function cancel(transactionId) {
8903
+ this._queuedMessages.delete(transactionId);
8904
+ };
8899
8905
  _proto.close = function close(code, reason) {
8900
8906
  if (this.readyState === ReconnectableSocket.CLOSING) {
8901
8907
  throw new Error('Can not call close on a closing ReconnectableSocket');
@@ -18324,7 +18330,8 @@ var _default = _ref => {
18324
18330
  const status = this._socket.send({
18325
18331
  data: rumorMessage.serialize(),
18326
18332
  retryAfterReconnect: false,
18327
- expectAck: true
18333
+ expectAck: true,
18334
+ transactionId: rumorMessage.transactionId
18328
18335
  });
18329
18336
  if (status === 'dropped' && !retryAfterReconnect) {
18330
18337
  const error = new Error('Not connected.');
@@ -18339,6 +18346,11 @@ var _default = _ref => {
18339
18346
  timestamp: Date.now()
18340
18347
  });
18341
18348
  };
18349
+ _proto.cancel = function cancel(transactionId) {
18350
+ this._pendingMessages.delete(transactionId);
18351
+ this._receivedTransactionIDs.add(transactionId);
18352
+ this._socket.cancel(transactionId);
18353
+ };
18342
18354
  _proto.subscribe = function subscribe(topics) {
18343
18355
  this._socket.send({
18344
18356
  data: _RumorMessage.default.Subscribe(topics).serialize(),
@@ -26833,6 +26845,10 @@ function RaptorSocketFactory(deps) {
26833
26845
  });
26834
26846
  return transactionId;
26835
26847
  };
26848
+ const cancelTransactionId = transactionId => {
26849
+ _dispatcher.cancelCallback(transactionId);
26850
+ this._rumor.cancel(transactionId);
26851
+ };
26836
26852
 
26837
26853
  /**
26838
26854
  * Like publish, but automaitcally serializes the message parameter
@@ -26885,9 +26901,12 @@ function RaptorSocketFactory(deps) {
26885
26901
  customProperties
26886
26902
  };
26887
26903
  const message = RaptorMessage.streams.create(streamCreateOpts);
26888
- this.publish(message, {}, true, (error, message) => {
26904
+ const transactionId = this.publish(message, {}, true, (error, message) => {
26889
26905
  completion(error, streamId, message);
26890
26906
  });
26907
+ return () => {
26908
+ cancelTransactionId(transactionId);
26909
+ };
26891
26910
  };
26892
26911
  this.streamDestroy = function (streamId, sourceStreamId) {
26893
26912
  this.publish(RaptorMessage.streams.destroy(_apiKey, _sessionId, streamId, sourceStreamId), {}, true);
@@ -39183,7 +39202,7 @@ function staticConfigFactory(_temp) {
39183
39202
  _ref$axios = _ref.axios,
39184
39203
  axios = _ref$axios === void 0 ? _axios.default : _ref$axios,
39185
39204
  _ref$properties = _ref.properties,
39186
- properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"d6f903917","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;
39205
+ properties = _ref$properties === void 0 ? {"version":"v2.35.0","buildHash":"5b7d62ce7","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;
39187
39206
  /** @type builtInConfig */
39188
39207
  const builtInConfig = (0, _cloneDeep.default)(properties);
39189
39208
  /**
@@ -39715,6 +39734,9 @@ const Dispatcher = function Dispatcher() {
39715
39734
  Dispatcher.prototype.registerCallback = function (transactionId, completion) {
39716
39735
  this.callbacks[transactionId] = completion;
39717
39736
  };
39737
+ Dispatcher.prototype.cancelCallback = function (transactionId) {
39738
+ delete this.callbacks[transactionId];
39739
+ };
39718
39740
  Dispatcher.prototype.triggerCallback = function (transactionId) {
39719
39741
  /* , arg1, arg2, argN-1, argN */
39720
39742
  if (!transactionId) {
@@ -42403,38 +42425,43 @@ function PublisherFactory(_ref) {
42403
42425
  shouldAllowAudio,
42404
42426
  logAnalyticsEvent
42405
42427
  });
42406
- const reset = () => {
42428
+ const reset = function reset(afterPublishError) {
42407
42429
  var _publisherSenderStats3;
42408
- this.off('publishComplete', refreshAudioVideoUI);
42430
+ if (afterPublishError === void 0) {
42431
+ afterPublishError = false;
42432
+ }
42433
+ _this.off('publishComplete', refreshAudioVideoUI);
42409
42434
  if (chromeMixin) {
42410
42435
  chromeMixin.reset();
42411
42436
  }
42412
42437
  streamCleanupJobs.releaseAll();
42413
42438
  streamReadyJobs.empty();
42414
- const disconnectPromise = this.disconnect();
42415
- microphone = null;
42416
- cleanupLocalStream();
42417
- webRTCStream = null;
42418
- if (widgetView) {
42419
- widgetView.destroy();
42420
- widgetView = null;
42421
- }
42422
- if (this.session) {
42423
- this._.unpublishFromSession(this.session, 'reset');
42439
+ const disconnectPromise = _this.disconnect();
42440
+ if (!afterPublishError) {
42441
+ microphone = null;
42442
+ cleanupLocalStream();
42443
+ webRTCStream = null;
42444
+ if (widgetView) {
42445
+ widgetView.destroy();
42446
+ widgetView = null;
42447
+ }
42448
+ if (mediaProcessor.getVideoFilter()) {
42449
+ destroyMediaProcessor();
42450
+ }
42451
+ _this.id = null;
42452
+ loaded = false;
42424
42453
  }
42425
- if (mediaProcessor.getVideoFilter()) {
42426
- destroyMediaProcessor();
42454
+ if (_this.session) {
42455
+ _this._.unpublishFromSession(_this.session, 'reset', afterPublishError);
42427
42456
  }
42428
42457
  amrAudioTrackProcessor.destroy();
42429
42458
  (_publisherSenderStats3 = publisherSenderStats) == null ? void 0 : _publisherSenderStats3.destroy();
42430
42459
  publisherSenderStats = null;
42431
- this.id = null;
42432
- this.stream = null;
42433
- loaded = false;
42434
- this.session = null;
42435
- this.streamId = null;
42460
+ _this.stream = null;
42461
+ _this.session = null;
42462
+ _this.streamId = null;
42436
42463
  if (!state.isDestroyed()) {
42437
- state.set('NotPublishing');
42464
+ state.set(loaded ? 'MediaBound' : 'NotPublishing');
42438
42465
  }
42439
42466
  return disconnectPromise;
42440
42467
  };
@@ -42614,7 +42641,7 @@ function PublisherFactory(_ref) {
42614
42641
  initials: properties.initials
42615
42642
  }
42616
42643
  };
42617
- this.session._.streamCreate(streamOptions, completionHandler);
42644
+ return this.session._.streamCreate(streamOptions, completionHandler);
42618
42645
  };
42619
42646
  const _stopSendingRtpToMantis = /*#__PURE__*/function () {
42620
42647
  var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
@@ -45473,7 +45500,7 @@ function PublisherFactory(_ref) {
45473
45500
  });
45474
45501
  throw publicError;
45475
45502
  };
45476
- logging.debug('publishToSession: waiting for loaded');
45503
+ let cancelStreamCreate;
45477
45504
  const streamCreatedPromise = loadedPromise.then(() => session._.getVideoCodecsCompatible(webRTCStream)).then(videoCodecsCompatible => {
45478
45505
  logging.debug('publishToSession: loaded');
45479
45506
  // Bail if this.session is gone, it means we were unpublished
@@ -45546,7 +45573,8 @@ function PublisherFactory(_ref) {
45546
45573
  this._.streamChannels = streamChannels;
45547
45574
  logging.debug('publishToSession: creating rumor stream id');
45548
45575
  return new Promise((resolve, reject) => {
45549
- _createStream(null, (messagingError, streamId, message) => {
45576
+ cancelStreamCreate = _createStream(null, (messagingError, streamId, message) => {
45577
+ cancelStreamCreate = null;
45550
45578
  if (messagingError) {
45551
45579
  reject(processMessagingError(messagingError));
45552
45580
  return;
@@ -45573,9 +45601,29 @@ function PublisherFactory(_ref) {
45573
45601
  this.trigger('publishComplete', err);
45574
45602
  throw err;
45575
45603
  });
45576
- return Promise.all([streamCreatedPromise, completedPromise]);
45604
+ return Promise.all([streamCreatedPromise, completedPromise]).catch( /*#__PURE__*/function () {
45605
+ var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(err) {
45606
+ return _regenerator.default.wrap(function _callee48$(_context48) {
45607
+ while (1) switch (_context48.prev = _context48.next) {
45608
+ case 0:
45609
+ cancelStreamCreate == null ? void 0 : cancelStreamCreate();
45610
+ cancelStreamCreate = null;
45611
+ _context48.next = 4;
45612
+ return reset(true).catch(() => {});
45613
+ case 4:
45614
+ throw err;
45615
+ case 5:
45616
+ case "end":
45617
+ return _context48.stop();
45618
+ }
45619
+ }, _callee48);
45620
+ }));
45621
+ return function (_x39) {
45622
+ return _ref59.apply(this, arguments);
45623
+ };
45624
+ }());
45577
45625
  },
45578
- unpublishFromSession: (session, reason) => {
45626
+ unpublishFromSession: (session, reason, afterPublishError) => {
45579
45627
  if (!this.session || session.id !== this.session.id) {
45580
45628
  if (reason === 'unpublished') {
45581
45629
  const selfSessionText = this.session && this.session.id || 'no session';
@@ -45613,7 +45661,7 @@ function PublisherFactory(_ref) {
45613
45661
  }
45614
45662
  this.session = null;
45615
45663
  logAnalyticsEvent('unpublish', 'Success');
45616
- this._.streamDestroyed(reason);
45664
+ this._.streamDestroyed(reason, afterPublishError);
45617
45665
  return this;
45618
45666
  },
45619
45667
  unpublishStreamFromSession: (stream, session, reason) => {
@@ -45624,11 +45672,11 @@ function PublisherFactory(_ref) {
45624
45672
  return this._.unpublishFromSession(session, reason);
45625
45673
  },
45626
45674
  startMigration: function () {
45627
- var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48() {
45675
+ var _startMigration = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
45628
45676
  var _publisherSenderStats4, _this$session23, _this$session23$sessi;
45629
45677
  var relayedPeerConnection, onCreateStreamError;
45630
- return _regenerator.default.wrap(function _callee48$(_context48) {
45631
- while (1) switch (_context48.prev = _context48.next) {
45678
+ return _regenerator.default.wrap(function _callee49$(_context49) {
45679
+ while (1) switch (_context49.prev = _context49.next) {
45632
45680
  case 0:
45633
45681
  state.set('Migrating');
45634
45682
  logAnalyticsEvent('SessionMigration', 'Attempt');
@@ -45636,10 +45684,10 @@ function PublisherFactory(_ref) {
45636
45684
 
45637
45685
  // Update sender method in P2P PC because it needs to use the new Rumor. No need for
45638
45686
  // Mantis PC since a new PC will be created.
45639
- _context48.next = 5;
45687
+ _context49.next = 5;
45640
45688
  return getP2pPeerConnection();
45641
45689
  case 5:
45642
- relayedPeerConnection = _context48.sent;
45690
+ relayedPeerConnection = _context49.sent;
45643
45691
  relayedPeerConnection == null ? void 0 : relayedPeerConnection.setSendMessage(createSendMessage('P2P'));
45644
45692
  (_publisherSenderStats4 = publisherSenderStats) == null ? void 0 : _publisherSenderStats4.setSocket(_this.session._.getSocket());
45645
45693
  onCreateStreamError = error => {
@@ -45648,23 +45696,23 @@ function PublisherFactory(_ref) {
45648
45696
  }
45649
45697
  };
45650
45698
  if (!((_this$session23 = _this.session) != null && (_this$session23$sessi = _this$session23.sessionInfo) != null && _this$session23$sessi.p2pEnabled)) {
45651
- _context48.next = 13;
45699
+ _context49.next = 13;
45652
45700
  break;
45653
45701
  }
45654
45702
  _createStream('P2P', onCreateStreamError);
45655
- _context48.next = 17;
45703
+ _context49.next = 17;
45656
45704
  break;
45657
45705
  case 13:
45658
- _context48.next = 15;
45706
+ _context49.next = 15;
45659
45707
  return getMantisPeerConnection();
45660
45708
  case 15:
45661
- _previousPeerConnection = _context48.sent;
45709
+ _previousPeerConnection = _context49.sent;
45662
45710
  _createStream('MANTIS', onCreateStreamError);
45663
45711
  case 17:
45664
45712
  case "end":
45665
- return _context48.stop();
45713
+ return _context49.stop();
45666
45714
  }
45667
- }, _callee48);
45715
+ }, _callee49);
45668
45716
  }));
45669
45717
  function startMigration() {
45670
45718
  return _startMigration.apply(this, arguments);
@@ -45675,16 +45723,16 @@ function PublisherFactory(_ref) {
45675
45723
  var _this$session24, _this$session24$sessi;
45676
45724
  clearTimeout(_migrationTimeoutId);
45677
45725
  const destroyPeerConnection = /*#__PURE__*/function () {
45678
- var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(pc) {
45726
+ var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(pc) {
45679
45727
  var _getPeerConnectionMet8, peerConnectionId;
45680
- return _regenerator.default.wrap(function _callee49$(_context49) {
45681
- while (1) switch (_context49.prev = _context49.next) {
45728
+ return _regenerator.default.wrap(function _callee50$(_context50) {
45729
+ while (1) switch (_context50.prev = _context50.next) {
45682
45730
  case 0:
45683
45731
  if (!pc) {
45684
- _context49.next = 7;
45732
+ _context50.next = 7;
45685
45733
  break;
45686
45734
  }
45687
- _context49.next = 3;
45735
+ _context50.next = 3;
45688
45736
  return _publisherStatsHelper.removePeerConnection(pc);
45689
45737
  case 3:
45690
45738
  _getPeerConnectionMet8 = getPeerConnectionMeta(pc), peerConnectionId = _getPeerConnectionMet8.peerConnectionId;
@@ -45693,12 +45741,12 @@ function PublisherFactory(_ref) {
45693
45741
  pc.destroy();
45694
45742
  case 7:
45695
45743
  case "end":
45696
- return _context49.stop();
45744
+ return _context50.stop();
45697
45745
  }
45698
- }, _callee49);
45746
+ }, _callee50);
45699
45747
  }));
45700
- return function destroyPeerConnection(_x39) {
45701
- return _ref59.apply(this, arguments);
45748
+ return function destroyPeerConnection(_x40) {
45749
+ return _ref60.apply(this, arguments);
45702
45750
  };
45703
45751
  }();
45704
45752
 
@@ -45714,7 +45762,7 @@ function PublisherFactory(_ref) {
45714
45762
  state.set('Publishing');
45715
45763
  logAnalyticsEvent('SessionMigration', 'Success');
45716
45764
  },
45717
- streamDestroyed: reason => {
45765
+ streamDestroyed: (reason, afterPublishError) => {
45718
45766
  if (['reset'].indexOf(reason) < 0) {
45719
45767
  // We're back to being a stand-alone publisher again.
45720
45768
  if (!state.isDestroyed()) {
@@ -45723,7 +45771,7 @@ function PublisherFactory(_ref) {
45723
45771
  }
45724
45772
  const event = new Events.StreamEvent('streamDestroyed', this.stream, reason, true);
45725
45773
  this.dispatchEventOnce(event, this.streamId);
45726
- if (!event.isDefaultPrevented()) {
45774
+ if (!event.isDefaultPrevented() && !afterPublishError) {
45727
45775
  this.destroy();
45728
45776
  }
45729
45777
  this.streamId = null;
@@ -45738,55 +45786,55 @@ function PublisherFactory(_ref) {
45738
45786
  return webRTCStream;
45739
45787
  },
45740
45788
  switchTracks() {
45741
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
45789
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
45742
45790
  var stream;
45743
- return _regenerator.default.wrap(function _callee50$(_context50) {
45744
- while (1) switch (_context50.prev = _context50.next) {
45791
+ return _regenerator.default.wrap(function _callee51$(_context51) {
45792
+ while (1) switch (_context51.prev = _context51.next) {
45745
45793
  case 0:
45746
- _context50.prev = 0;
45747
- _context50.next = 3;
45794
+ _context51.prev = 0;
45795
+ _context51.next = 3;
45748
45796
  return getUserMedia().catch(userMediaError);
45749
45797
  case 3:
45750
- stream = _context50.sent;
45751
- _context50.next = 10;
45798
+ stream = _context51.sent;
45799
+ _context51.next = 10;
45752
45800
  break;
45753
45801
  case 6:
45754
- _context50.prev = 6;
45755
- _context50.t0 = _context50["catch"](0);
45756
- logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context50.t0}`);
45757
- throw _context50.t0;
45802
+ _context51.prev = 6;
45803
+ _context51.t0 = _context51["catch"](0);
45804
+ logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context51.t0}`);
45805
+ throw _context51.t0;
45758
45806
  case 10:
45759
45807
  setNewStream(stream);
45760
- _context50.prev = 11;
45808
+ _context51.prev = 11;
45761
45809
  bindVideo();
45762
- _context50.next = 21;
45810
+ _context51.next = 21;
45763
45811
  break;
45764
45812
  case 15:
45765
- _context50.prev = 15;
45766
- _context50.t1 = _context50["catch"](11);
45767
- if (!(_context50.t1 instanceof _cancel.CancellationError)) {
45768
- _context50.next = 19;
45813
+ _context51.prev = 15;
45814
+ _context51.t1 = _context51["catch"](11);
45815
+ if (!(_context51.t1 instanceof _cancel.CancellationError)) {
45816
+ _context51.next = 19;
45769
45817
  break;
45770
45818
  }
45771
- return _context50.abrupt("return");
45819
+ return _context51.abrupt("return");
45772
45820
  case 19:
45773
- logging.error('Error while binding video', _context50.t1);
45774
- throw _context50.t1;
45821
+ logging.error('Error while binding video', _context51.t1);
45822
+ throw _context51.t1;
45775
45823
  case 21:
45776
- _context50.prev = 21;
45824
+ _context51.prev = 21;
45777
45825
  replaceTracks();
45778
- _context50.next = 29;
45826
+ _context51.next = 29;
45779
45827
  break;
45780
45828
  case 25:
45781
- _context50.prev = 25;
45782
- _context50.t2 = _context50["catch"](21);
45783
- logging.error('Error replacing tracks', _context50.t2);
45784
- throw _context50.t2;
45829
+ _context51.prev = 25;
45830
+ _context51.t2 = _context51["catch"](21);
45831
+ logging.error('Error replacing tracks', _context51.t2);
45832
+ throw _context51.t2;
45785
45833
  case 29:
45786
45834
  case "end":
45787
- return _context50.stop();
45835
+ return _context51.stop();
45788
45836
  }
45789
- }, _callee50, null, [[0, 6], [11, 15], [21, 25]]);
45837
+ }, _callee51, null, [[0, 6], [11, 15], [21, 25]]);
45790
45838
  }))();
45791
45839
  },
45792
45840
  getDataChannel(label, getOptions, completion) {
@@ -45818,27 +45866,27 @@ function PublisherFactory(_ref) {
45818
45866
  },
45819
45867
  demoOnlyCycleVideo: this.cycleVideo,
45820
45868
  testOnlyGetFramesEncoded() {
45821
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
45869
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
45822
45870
  var peerConnections;
45823
- return _regenerator.default.wrap(function _callee51$(_context51) {
45824
- while (1) switch (_context51.prev = _context51.next) {
45871
+ return _regenerator.default.wrap(function _callee52$(_context52) {
45872
+ while (1) switch (_context52.prev = _context52.next) {
45825
45873
  case 0:
45826
- _context51.next = 2;
45874
+ _context52.next = 2;
45827
45875
  return getAllPeerConnections();
45828
45876
  case 2:
45829
- peerConnections = _context51.sent;
45877
+ peerConnections = _context52.sent;
45830
45878
  if (peerConnections.length) {
45831
- _context51.next = 5;
45879
+ _context52.next = 5;
45832
45880
  break;
45833
45881
  }
45834
45882
  throw new Error('No established PeerConnections yet');
45835
45883
  case 5:
45836
- return _context51.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
45884
+ return _context52.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
45837
45885
  case 6:
45838
45886
  case "end":
45839
- return _context51.stop();
45887
+ return _context52.stop();
45840
45888
  }
45841
- }, _callee51);
45889
+ }, _callee52);
45842
45890
  }))();
45843
45891
  },
45844
45892
  onStreamAvailable,
@@ -45867,47 +45915,47 @@ function PublisherFactory(_ref) {
45867
45915
  }
45868
45916
  }.bind(this),
45869
45917
  setCongestionLevel: function () {
45870
- var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(level, peerId) {
45918
+ var _setCongestionLevel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(level, peerId) {
45871
45919
  var pcs;
45872
- return _regenerator.default.wrap(function _callee52$(_context52) {
45873
- while (1) switch (_context52.prev = _context52.next) {
45920
+ return _regenerator.default.wrap(function _callee53$(_context53) {
45921
+ while (1) switch (_context53.prev = _context53.next) {
45874
45922
  case 0:
45875
45923
  if (!audioFallbackCoordinator) {
45876
- _context52.next = 15;
45924
+ _context53.next = 15;
45877
45925
  break;
45878
45926
  }
45879
45927
  if (!peerId) {
45880
- _context52.next = 8;
45928
+ _context53.next = 8;
45881
45929
  break;
45882
45930
  }
45883
- _context52.next = 4;
45931
+ _context53.next = 4;
45884
45932
  return getPeerConnectionById(peerId);
45885
45933
  case 4:
45886
- _context52.t1 = _context52.sent;
45887
- _context52.t0 = [_context52.t1];
45888
- _context52.next = 11;
45934
+ _context53.t1 = _context53.sent;
45935
+ _context53.t0 = [_context53.t1];
45936
+ _context53.next = 11;
45889
45937
  break;
45890
45938
  case 8:
45891
- _context52.next = 10;
45939
+ _context53.next = 10;
45892
45940
  return getAllPeerConnections();
45893
45941
  case 10:
45894
- _context52.t0 = _context52.sent;
45942
+ _context53.t0 = _context53.sent;
45895
45943
  case 11:
45896
- pcs = _context52.t0;
45944
+ pcs = _context53.t0;
45897
45945
  pcs.forEach(pc => {
45898
45946
  pc.setCongestionLevel(level);
45899
45947
  });
45900
- _context52.next = 16;
45948
+ _context53.next = 16;
45901
45949
  break;
45902
45950
  case 15:
45903
45951
  logging.warn('Audio Fallback is not enabled');
45904
45952
  case 16:
45905
45953
  case "end":
45906
- return _context52.stop();
45954
+ return _context53.stop();
45907
45955
  }
45908
- }, _callee52);
45956
+ }, _callee53);
45909
45957
  }));
45910
- function setCongestionLevel(_x40, _x41) {
45958
+ function setCongestionLevel(_x41, _x42) {
45911
45959
  return _setCongestionLevel.apply(this, arguments);
45912
45960
  }
45913
45961
  return setCongestionLevel;
@@ -46307,10 +46355,10 @@ function PublisherFactory(_ref) {
46307
46355
  * If there is an error, the promise is rejected and no new video filter is set.
46308
46356
  */
46309
46357
  this.applyVideoFilter = /*#__PURE__*/function () {
46310
- var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53(videoFilter, avoidOriginalTrackLeak) {
46358
+ var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(videoFilter, avoidOriginalTrackLeak) {
46311
46359
  var sanitizedVideoFilter, isSupported, message, _webRTCStream$getVide2, originalVideoTrack, filteredVideoTrack;
46312
- return _regenerator.default.wrap(function _callee53$(_context53) {
46313
- while (1) switch (_context53.prev = _context53.next) {
46360
+ return _regenerator.default.wrap(function _callee54$(_context54) {
46361
+ while (1) switch (_context54.prev = _context54.next) {
46314
46362
  case 0:
46315
46363
  if (avoidOriginalTrackLeak === void 0) {
46316
46364
  avoidOriginalTrackLeak = false;
@@ -46319,28 +46367,28 @@ function PublisherFactory(_ref) {
46319
46367
  logAnalyticsEvent('applyVideoFilter', 'Attempt', {
46320
46368
  videoFilter: sanitizedVideoFilter
46321
46369
  });
46322
- _context53.prev = 3;
46370
+ _context54.prev = 3;
46323
46371
  if (!_videoMediaProcessorConnector) {
46324
- _context53.next = 6;
46372
+ _context54.next = 6;
46325
46373
  break;
46326
46374
  }
46327
46375
  throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply video filter when videoMediaProcessorConnector is set.'));
46328
46376
  case 6:
46329
46377
  isSupported = MediaProcessor.isSupported('video');
46330
46378
  if (isSupported) {
46331
- _context53.next = 9;
46379
+ _context54.next = 9;
46332
46380
  break;
46333
46381
  }
46334
46382
  throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support video filters (Insertable Streams and Worker APIs are required)'));
46335
46383
  case 9:
46336
46384
  if (mediaProcessor.isValidVideoFilter(videoFilter)) {
46337
- _context53.next = 11;
46385
+ _context54.next = 11;
46338
46386
  break;
46339
46387
  }
46340
46388
  throw otError(Errors.INVALID_PARAMETER, new Error('Video filter has invalid configuration'));
46341
46389
  case 11:
46342
46390
  if (webRTCStream) {
46343
- _context53.next = 16;
46391
+ _context54.next = 16;
46344
46392
  break;
46345
46393
  }
46346
46394
  message = 'Ignoring. No mediaStream';
@@ -46348,53 +46396,53 @@ function PublisherFactory(_ref) {
46348
46396
  message
46349
46397
  });
46350
46398
  logging.warn(message);
46351
- return _context53.abrupt("return");
46399
+ return _context54.abrupt("return");
46352
46400
  case 16:
46353
46401
  if (!isScreenSharing) {
46354
- _context53.next = 18;
46402
+ _context54.next = 18;
46355
46403
  break;
46356
46404
  }
46357
46405
  throw otError(Errors.INVALID_PARAMETER, new Error('Video filters can not be applied to screen share'));
46358
46406
  case 18:
46359
46407
  enableMediaProcessorLogging();
46360
46408
  if (properties.publishVideo) {
46361
- _context53.next = 23;
46409
+ _context54.next = 23;
46362
46410
  break;
46363
46411
  }
46364
46412
  currentVideoFilter = videoFilter;
46365
46413
  logAnalyticsEvent('applyVideoFilter', 'Success', {
46366
46414
  videoFilter: sanitizedVideoFilter
46367
46415
  });
46368
- return _context53.abrupt("return");
46416
+ return _context54.abrupt("return");
46369
46417
  case 23:
46370
46418
  if (!mediaProcessor.getVideoFilter()) {
46371
- _context53.next = 38;
46419
+ _context54.next = 38;
46372
46420
  break;
46373
46421
  }
46374
46422
  if (!mediaProcessor.canUpdateVideoFilter(videoFilter.type)) {
46375
- _context53.next = 36;
46423
+ _context54.next = 36;
46376
46424
  break;
46377
46425
  }
46378
- _context53.prev = 25;
46379
- _context53.next = 28;
46426
+ _context54.prev = 25;
46427
+ _context54.next = 28;
46380
46428
  return mediaProcessor.updateVideoFilter(videoFilter);
46381
46429
  case 28:
46382
46430
  currentVideoFilter = videoFilter;
46383
46431
  logAnalyticsEvent('applyVideoFilter', 'Success', {
46384
46432
  videoFilter: sanitizedVideoFilter
46385
46433
  });
46386
- return _context53.abrupt("return");
46434
+ return _context54.abrupt("return");
46387
46435
  case 33:
46388
- _context53.prev = 33;
46389
- _context53.t0 = _context53["catch"](25);
46390
- logging.warn(`Error updating video filter: ${_context53.t0}`);
46436
+ _context54.prev = 33;
46437
+ _context54.t0 = _context54["catch"](25);
46438
+ logging.warn(`Error updating video filter: ${_context54.t0}`);
46391
46439
  case 36:
46392
- _context53.next = 38;
46440
+ _context54.next = 38;
46393
46441
  return _this.clearVideoFilter();
46394
46442
  case 38:
46395
46443
  _webRTCStream$getVide2 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide2[0];
46396
46444
  if (originalVideoTrack) {
46397
- _context53.next = 44;
46445
+ _context54.next = 44;
46398
46446
  break;
46399
46447
  }
46400
46448
  message = 'Ignoring. No video';
@@ -46402,33 +46450,33 @@ function PublisherFactory(_ref) {
46402
46450
  message
46403
46451
  });
46404
46452
  logging.warn(message);
46405
- return _context53.abrupt("return");
46453
+ return _context54.abrupt("return");
46406
46454
  case 44:
46407
- _context53.next = 46;
46455
+ _context54.next = 46;
46408
46456
  return mediaProcessor.setVideoFilter(videoFilter, avoidOriginalTrackLeak);
46409
46457
  case 46:
46410
- _context53.next = 48;
46458
+ _context54.next = 48;
46411
46459
  return mediaProcessor.setMediaStream(webRTCStream);
46412
46460
  case 48:
46413
- filteredVideoTrack = _context53.sent;
46461
+ filteredVideoTrack = _context54.sent;
46414
46462
  if (!filteredVideoTrack) {
46415
- _context53.next = 53;
46463
+ _context54.next = 53;
46416
46464
  break;
46417
46465
  }
46418
46466
  filteredVideoTrackId = filteredVideoTrack.id;
46419
- _context53.next = 53;
46467
+ _context54.next = 53;
46420
46468
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
46421
46469
  case 53:
46422
- _context53.next = 60;
46470
+ _context54.next = 60;
46423
46471
  break;
46424
46472
  case 55:
46425
- _context53.prev = 55;
46426
- _context53.t1 = _context53["catch"](3);
46427
- logging.error(`Error applying video filter: ${_context53.t1}`);
46473
+ _context54.prev = 55;
46474
+ _context54.t1 = _context54["catch"](3);
46475
+ logging.error(`Error applying video filter: ${_context54.t1}`);
46428
46476
  logAnalyticsEvent('applyVideoFilter', 'Failure', {
46429
- message: _context53.t1.message
46477
+ message: _context54.t1.message
46430
46478
  });
46431
- throw _context53.t1;
46479
+ throw _context54.t1;
46432
46480
  case 60:
46433
46481
  currentVideoFilter = videoFilter;
46434
46482
  logAnalyticsEvent('applyVideoFilter', 'Success', {
@@ -46436,12 +46484,12 @@ function PublisherFactory(_ref) {
46436
46484
  });
46437
46485
  case 62:
46438
46486
  case "end":
46439
- return _context53.stop();
46487
+ return _context54.stop();
46440
46488
  }
46441
- }, _callee53, null, [[3, 55], [25, 33]]);
46489
+ }, _callee54, null, [[3, 55], [25, 33]]);
46442
46490
  }));
46443
- return function (_x42, _x43) {
46444
- return _ref60.apply(this, arguments);
46491
+ return function (_x43, _x44) {
46492
+ return _ref61.apply(this, arguments);
46445
46493
  };
46446
46494
  }();
46447
46495
 
@@ -46548,35 +46596,35 @@ function PublisherFactory(_ref) {
46548
46596
  * If there is an error, the promise is rejected and no new video filter is set.
46549
46597
  */
46550
46598
  this.applyAudioFilter = /*#__PURE__*/function () {
46551
- var _ref61 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(audioFilter) {
46599
+ var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(audioFilter) {
46552
46600
  var isSupported, message, _getNoiseSuppressionC, assetsDirBaseUrl, vonageNoiseSuppression, noiseSuppressionConnector;
46553
- return _regenerator.default.wrap(function _callee54$(_context54) {
46554
- while (1) switch (_context54.prev = _context54.next) {
46601
+ return _regenerator.default.wrap(function _callee55$(_context55) {
46602
+ while (1) switch (_context55.prev = _context55.next) {
46555
46603
  case 0:
46556
46604
  logAnalyticsEvent('applyAudioFilter', 'Attempt', {
46557
46605
  audioFilter
46558
46606
  });
46559
46607
  isSupported = MediaProcessor.isSupported('audio');
46560
46608
  if (isSupported) {
46561
- _context54.next = 4;
46609
+ _context55.next = 4;
46562
46610
  break;
46563
46611
  }
46564
46612
  throw otError(Errors.NOT_SUPPORTED, new Error('Browser does not support audio filters (Insertable Streams and Worker APIs are required)'));
46565
46613
  case 4:
46566
46614
  if ((0, _isValidAudioFilter.default)(audioFilter)) {
46567
- _context54.next = 6;
46615
+ _context55.next = 6;
46568
46616
  break;
46569
46617
  }
46570
46618
  throw otError(Errors.INVALID_PARAMETER, new Error('Audio filter has invalid configuration'));
46571
46619
  case 6:
46572
46620
  if (!_audioMediaProcessorConnector) {
46573
- _context54.next = 8;
46621
+ _context55.next = 8;
46574
46622
  break;
46575
46623
  }
46576
46624
  throw otError(Errors.NOT_SUPPORTED, new Error('Cannot apply audio filter when audioMediaProcessorConnector is set.'));
46577
46625
  case 8:
46578
46626
  if (webRTCStream) {
46579
- _context54.next = 13;
46627
+ _context55.next = 13;
46580
46628
  break;
46581
46629
  }
46582
46630
  message = 'Ignoring. No mediaStream';
@@ -46584,68 +46632,68 @@ function PublisherFactory(_ref) {
46584
46632
  message
46585
46633
  });
46586
46634
  logging.warn(message);
46587
- return _context54.abrupt("return");
46635
+ return _context55.abrupt("return");
46588
46636
  case 13:
46589
46637
  if (properties.publishAudio) {
46590
- _context54.next = 17;
46638
+ _context55.next = 17;
46591
46639
  break;
46592
46640
  }
46593
46641
  currentAudioFilter = audioFilter;
46594
46642
  logAnalyticsEvent('applyAudioFilter', 'Success', {
46595
46643
  audioFilter
46596
46644
  });
46597
- return _context54.abrupt("return");
46645
+ return _context55.abrupt("return");
46598
46646
  case 17:
46599
46647
  if (!_this.getAudioFilter()) {
46600
- _context54.next = 20;
46648
+ _context55.next = 20;
46601
46649
  break;
46602
46650
  }
46603
- _context54.next = 20;
46651
+ _context55.next = 20;
46604
46652
  return _this.clearAudioFilter();
46605
46653
  case 20:
46606
- _context54.prev = 20;
46654
+ _context55.prev = 20;
46607
46655
  if (!(audioFilter.type === 'advancedNoiseSuppression')) {
46608
- _context54.next = 32;
46656
+ _context55.next = 32;
46609
46657
  break;
46610
46658
  }
46611
46659
  _getNoiseSuppressionC = (0, _getDefaultConfig.default)({
46612
46660
  proxyUrl: (0, _proxyUrl.getProxyUrl)()
46613
46661
  }), assetsDirBaseUrl = _getNoiseSuppressionC.assetsDirBaseUrl;
46614
46662
  vonageNoiseSuppression = createVonageNoiseSuppression();
46615
- _context54.next = 26;
46663
+ _context55.next = 26;
46616
46664
  return vonageNoiseSuppression.init({
46617
46665
  assetsDirBaseUrl
46618
46666
  });
46619
46667
  case 26:
46620
- _context54.next = 28;
46668
+ _context55.next = 28;
46621
46669
  return vonageNoiseSuppression.getConnector();
46622
46670
  case 28:
46623
- noiseSuppressionConnector = _context54.sent;
46624
- _context54.next = 31;
46671
+ noiseSuppressionConnector = _context55.sent;
46672
+ _context55.next = 31;
46625
46673
  return _setAudioMediaProcessorConnector(noiseSuppressionConnector);
46626
46674
  case 31:
46627
46675
  currentAudioFilter = audioFilter;
46628
46676
  case 32:
46629
- _context54.next = 39;
46677
+ _context55.next = 39;
46630
46678
  break;
46631
46679
  case 34:
46632
- _context54.prev = 34;
46633
- _context54.t0 = _context54["catch"](20);
46634
- logging.error(`Error applying audio filter: ${_context54.t0}`);
46680
+ _context55.prev = 34;
46681
+ _context55.t0 = _context55["catch"](20);
46682
+ logging.error(`Error applying audio filter: ${_context55.t0}`);
46635
46683
  logAnalyticsEvent('applyAudioFilter', 'Failure', {
46636
- message: _context54.t0.message
46684
+ message: _context55.t0.message
46637
46685
  });
46638
- throw _context54.t0;
46686
+ throw _context55.t0;
46639
46687
  case 39:
46640
46688
  logAnalyticsEvent('applyAudioFilter', 'Success');
46641
46689
  case 40:
46642
46690
  case "end":
46643
- return _context54.stop();
46691
+ return _context55.stop();
46644
46692
  }
46645
- }, _callee54, null, [[20, 34]]);
46693
+ }, _callee55, null, [[20, 34]]);
46646
46694
  }));
46647
- return function (_x44) {
46648
- return _ref61.apply(this, arguments);
46695
+ return function (_x45) {
46696
+ return _ref62.apply(this, arguments);
46649
46697
  };
46650
46698
  }();
46651
46699
 
@@ -46666,22 +46714,22 @@ function PublisherFactory(_ref) {
46666
46714
  * @return {Promise} A promise that resolves when the operation completes successfully.
46667
46715
  * If there is an error, the promise is rejected.
46668
46716
  */
46669
- this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
46717
+ this.clearAudioFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56() {
46670
46718
  var message;
46671
- return _regenerator.default.wrap(function _callee55$(_context55) {
46672
- while (1) switch (_context55.prev = _context55.next) {
46719
+ return _regenerator.default.wrap(function _callee56$(_context56) {
46720
+ while (1) switch (_context56.prev = _context56.next) {
46673
46721
  case 0:
46674
46722
  logAnalyticsEvent('clearAudioFilter', 'Attempt');
46675
46723
  if (!(!properties.publishAudio && _this.getAudioFilter())) {
46676
- _context55.next = 5;
46724
+ _context56.next = 5;
46677
46725
  break;
46678
46726
  }
46679
46727
  currentAudioFilter = null;
46680
46728
  logAnalyticsEvent('clearAudioFilter', 'Success');
46681
- return _context55.abrupt("return");
46729
+ return _context56.abrupt("return");
46682
46730
  case 5:
46683
46731
  if (MediaProcessor.isSupported('audio')) {
46684
- _context55.next = 10;
46732
+ _context56.next = 10;
46685
46733
  break;
46686
46734
  }
46687
46735
  message = 'Ignoring. "clearAudioFilter" not supported.';
@@ -46689,10 +46737,10 @@ function PublisherFactory(_ref) {
46689
46737
  message
46690
46738
  });
46691
46739
  logging.warn(message);
46692
- return _context55.abrupt("return");
46740
+ return _context56.abrupt("return");
46693
46741
  case 10:
46694
46742
  if (_this.getAudioFilter()) {
46695
- _context55.next = 15;
46743
+ _context56.next = 15;
46696
46744
  break;
46697
46745
  }
46698
46746
  message = 'Ignoring. No audio filter applied';
@@ -46700,10 +46748,10 @@ function PublisherFactory(_ref) {
46700
46748
  message
46701
46749
  });
46702
46750
  logging.debug(message);
46703
- return _context55.abrupt("return");
46751
+ return _context56.abrupt("return");
46704
46752
  case 15:
46705
46753
  if (webRTCStream) {
46706
- _context55.next = 20;
46754
+ _context56.next = 20;
46707
46755
  break;
46708
46756
  }
46709
46757
  message = 'Ignoring. No mediaStream';
@@ -46711,29 +46759,29 @@ function PublisherFactory(_ref) {
46711
46759
  message
46712
46760
  });
46713
46761
  logging.warn(message);
46714
- return _context55.abrupt("return");
46762
+ return _context56.abrupt("return");
46715
46763
  case 20:
46716
- _context55.prev = 20;
46717
- _context55.next = 23;
46764
+ _context56.prev = 20;
46765
+ _context56.next = 23;
46718
46766
  return _setAudioMediaProcessorConnector(null);
46719
46767
  case 23:
46720
46768
  currentAudioFilter = null;
46721
- _context55.next = 30;
46769
+ _context56.next = 30;
46722
46770
  break;
46723
46771
  case 26:
46724
- _context55.prev = 26;
46725
- _context55.t0 = _context55["catch"](20);
46772
+ _context56.prev = 26;
46773
+ _context56.t0 = _context56["catch"](20);
46726
46774
  logAnalyticsEvent('clearAudioFilter', 'Failure', {
46727
- error: _context55.t0
46775
+ error: _context56.t0
46728
46776
  });
46729
- return _context55.abrupt("return");
46777
+ return _context56.abrupt("return");
46730
46778
  case 30:
46731
46779
  logAnalyticsEvent('clearAudioFilter', 'Success');
46732
46780
  case 31:
46733
46781
  case "end":
46734
- return _context55.stop();
46782
+ return _context56.stop();
46735
46783
  }
46736
- }, _callee55, null, [[20, 26]]);
46784
+ }, _callee56, null, [[20, 26]]);
46737
46785
  }));
46738
46786
 
46739
46787
  /**
@@ -46828,16 +46876,16 @@ function PublisherFactory(_ref) {
46828
46876
  * If there is an error, the promise is rejected and no connector is set.
46829
46877
  */
46830
46878
  this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
46831
- var _ref63 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(mediaProcessorConnector) {
46879
+ var _ref64 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
46832
46880
  var _webRTCStream$getVide3, filteredVideoTrack, videoTrack, _webRTCStream$getVide4, originalVideoTrack, message;
46833
- return _regenerator.default.wrap(function _callee56$(_context56) {
46834
- while (1) switch (_context56.prev = _context56.next) {
46881
+ return _regenerator.default.wrap(function _callee57$(_context57) {
46882
+ while (1) switch (_context57.prev = _context57.next) {
46835
46883
  case 0:
46836
46884
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Attempt', {
46837
46885
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
46838
46886
  });
46839
46887
  if (!_this.getVideoFilter()) {
46840
- _context56.next = 4;
46888
+ _context57.next = 4;
46841
46889
  break;
46842
46890
  }
46843
46891
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
@@ -46846,16 +46894,16 @@ function PublisherFactory(_ref) {
46846
46894
  throw otError(Errors.NOT_SUPPORTED, new Error('setVideoMediaProcessorConnector: Cannot use this method when videoFilter is set.'));
46847
46895
  case 4:
46848
46896
  if (!_videoMediaProcessorConnector) {
46849
- _context56.next = 15;
46897
+ _context57.next = 15;
46850
46898
  break;
46851
46899
  }
46852
46900
  _webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
46853
- _context56.next = 8;
46901
+ _context57.next = 8;
46854
46902
  return getTrackFromDeviceId(currentDeviceId);
46855
46903
  case 8:
46856
- videoTrack = _context56.sent;
46904
+ videoTrack = _context57.sent;
46857
46905
  filteredVideoTrackId = null;
46858
- _context56.next = 12;
46906
+ _context57.next = 12;
46859
46907
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
46860
46908
  case 12:
46861
46909
  _videoMediaProcessorConnector.destroy();
@@ -46863,16 +46911,16 @@ function PublisherFactory(_ref) {
46863
46911
  _videoMediaProcessorConnector = null;
46864
46912
  case 15:
46865
46913
  if (mediaProcessorConnector) {
46866
- _context56.next = 18;
46914
+ _context57.next = 18;
46867
46915
  break;
46868
46916
  }
46869
46917
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
46870
46918
  message: 'clearing the connector'
46871
46919
  });
46872
- return _context56.abrupt("return");
46920
+ return _context57.abrupt("return");
46873
46921
  case 18:
46874
46922
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
46875
- _context56.next = 21;
46923
+ _context57.next = 21;
46876
46924
  break;
46877
46925
  }
46878
46926
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
@@ -46883,7 +46931,7 @@ function PublisherFactory(_ref) {
46883
46931
  _videoMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
46884
46932
  _webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
46885
46933
  if (originalVideoTrack) {
46886
- _context56.next = 29;
46934
+ _context57.next = 29;
46887
46935
  break;
46888
46936
  }
46889
46937
  message = 'Connector not set as no video track is present.';
@@ -46892,38 +46940,38 @@ function PublisherFactory(_ref) {
46892
46940
  });
46893
46941
  logging.warn(`setVideoMediaProcessorConnector: ${message}`);
46894
46942
  _videoMediaProcessorConnector = null;
46895
- return _context56.abrupt("return");
46943
+ return _context57.abrupt("return");
46896
46944
  case 29:
46897
- _context56.prev = 29;
46898
- _context56.next = 32;
46945
+ _context57.prev = 29;
46946
+ _context57.next = 32;
46899
46947
  return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
46900
46948
  case 32:
46901
- filteredVideoTrack = _context56.sent;
46949
+ filteredVideoTrack = _context57.sent;
46902
46950
  filteredVideoTrackId = filteredVideoTrack.id;
46903
- _context56.next = 36;
46951
+ _context57.next = 36;
46904
46952
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
46905
46953
  case 36:
46906
- _context56.next = 44;
46954
+ _context57.next = 44;
46907
46955
  break;
46908
46956
  case 38:
46909
- _context56.prev = 38;
46910
- _context56.t0 = _context56["catch"](29);
46957
+ _context57.prev = 38;
46958
+ _context57.t0 = _context57["catch"](29);
46911
46959
  _videoMediaProcessorConnector = null;
46912
- logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context56.t0}`);
46960
+ logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context57.t0}`);
46913
46961
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
46914
- message: _context56.t0.message
46962
+ message: _context57.t0.message
46915
46963
  });
46916
- throw _context56.t0;
46964
+ throw _context57.t0;
46917
46965
  case 44:
46918
46966
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
46919
46967
  case 45:
46920
46968
  case "end":
46921
- return _context56.stop();
46969
+ return _context57.stop();
46922
46970
  }
46923
- }, _callee56, null, [[29, 38]]);
46971
+ }, _callee57, null, [[29, 38]]);
46924
46972
  }));
46925
- return function (_x45) {
46926
- return _ref63.apply(this, arguments);
46973
+ return function (_x46) {
46974
+ return _ref64.apply(this, arguments);
46927
46975
  };
46928
46976
  }();
46929
46977
 
@@ -46987,71 +47035,71 @@ function PublisherFactory(_ref) {
46987
47035
  * If there is an error, the promise is rejected and no connector is set.
46988
47036
  */
46989
47037
  this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
46990
- var _ref64 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(mediaProcessorConnector) {
46991
- return _regenerator.default.wrap(function _callee57$(_context57) {
46992
- while (1) switch (_context57.prev = _context57.next) {
47038
+ var _ref65 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(mediaProcessorConnector) {
47039
+ return _regenerator.default.wrap(function _callee58$(_context58) {
47040
+ while (1) switch (_context58.prev = _context58.next) {
46993
47041
  case 0:
46994
47042
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Attempt', {
46995
47043
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
46996
47044
  });
46997
- _context57.prev = 1;
46998
- _context57.next = 4;
47045
+ _context58.prev = 1;
47046
+ _context58.next = 4;
46999
47047
  return _setAudioMediaProcessorConnector(mediaProcessorConnector);
47000
47048
  case 4:
47001
47049
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
47002
47050
  message: mediaProcessorConnector ? undefined : 'clearing the connector'
47003
47051
  });
47004
- _context57.next = 11;
47052
+ _context58.next = 11;
47005
47053
  break;
47006
47054
  case 7:
47007
- _context57.prev = 7;
47008
- _context57.t0 = _context57["catch"](1);
47055
+ _context58.prev = 7;
47056
+ _context58.t0 = _context58["catch"](1);
47009
47057
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Failure', {
47010
- message: _context57.t0.message
47058
+ message: _context58.t0.message
47011
47059
  });
47012
- throw _context57.t0;
47060
+ throw _context58.t0;
47013
47061
  case 11:
47014
47062
  case "end":
47015
- return _context57.stop();
47063
+ return _context58.stop();
47016
47064
  }
47017
- }, _callee57, null, [[1, 7]]);
47065
+ }, _callee58, null, [[1, 7]]);
47018
47066
  }));
47019
- return function (_x46) {
47020
- return _ref64.apply(this, arguments);
47067
+ return function (_x47) {
47068
+ return _ref65.apply(this, arguments);
47021
47069
  };
47022
47070
  }();
47023
47071
  const _setAudioMediaProcessorConnector = /*#__PURE__*/function () {
47024
- var _ref65 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(mediaProcessorConnector) {
47072
+ var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(mediaProcessorConnector) {
47025
47073
  var message, _webRTCStream$getAudi, filteredAudioTrack, _webRTCStream$getAudi2, originalAudioTrack;
47026
- return _regenerator.default.wrap(function _callee58$(_context58) {
47027
- while (1) switch (_context58.prev = _context58.next) {
47074
+ return _regenerator.default.wrap(function _callee59$(_context59) {
47075
+ while (1) switch (_context59.prev = _context59.next) {
47028
47076
  case 0:
47029
47077
  if (!(_this.getAudioFilter() && mediaProcessorConnector)) {
47030
- _context58.next = 3;
47078
+ _context59.next = 3;
47031
47079
  break;
47032
47080
  }
47033
47081
  message = 'Tried to set audio MediaProcessorConnector when audio filter applied.';
47034
47082
  throw otError(Errors.NOT_SUPPORTED, new Error(message));
47035
47083
  case 3:
47036
47084
  if (!_audioMediaProcessorConnector) {
47037
- _context58.next = 9;
47085
+ _context59.next = 9;
47038
47086
  break;
47039
47087
  }
47040
47088
  _webRTCStream$getAudi = webRTCStream.getAudioTracks(), filteredAudioTrack = _webRTCStream$getAudi[0];
47041
- _context58.next = 7;
47089
+ _context59.next = 7;
47042
47090
  return replaceAudioTrack(filteredAudioTrack, _audioMediaProcessorConnector.originalTrack);
47043
47091
  case 7:
47044
47092
  _audioMediaProcessorConnector.destroy();
47045
47093
  _audioMediaProcessorConnector = null;
47046
47094
  case 9:
47047
47095
  if (mediaProcessorConnector) {
47048
- _context58.next = 11;
47096
+ _context59.next = 11;
47049
47097
  break;
47050
47098
  }
47051
- return _context58.abrupt("return");
47099
+ return _context59.abrupt("return");
47052
47100
  case 11:
47053
47101
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
47054
- _context58.next = 14;
47102
+ _context59.next = 14;
47055
47103
  break;
47056
47104
  }
47057
47105
  message = 'Invalid MediaProcessorConnector';
@@ -47059,7 +47107,7 @@ function PublisherFactory(_ref) {
47059
47107
  case 14:
47060
47108
  _webRTCStream$getAudi2 = webRTCStream.getAudioTracks(), originalAudioTrack = _webRTCStream$getAudi2[0];
47061
47109
  if (originalAudioTrack) {
47062
- _context58.next = 20;
47110
+ _context59.next = 20;
47063
47111
  break;
47064
47112
  }
47065
47113
  message = 'Connector not set as no audio track is present.';
@@ -47068,30 +47116,30 @@ function PublisherFactory(_ref) {
47068
47116
  throw new Error(message);
47069
47117
  case 20:
47070
47118
  _audioMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
47071
- _context58.prev = 21;
47072
- _context58.next = 24;
47119
+ _context59.prev = 21;
47120
+ _context59.next = 24;
47073
47121
  return _audioMediaProcessorConnector.setTrack(originalAudioTrack);
47074
47122
  case 24:
47075
- filteredAudioTrack = _context58.sent;
47076
- _context58.next = 27;
47123
+ filteredAudioTrack = _context59.sent;
47124
+ _context59.next = 27;
47077
47125
  return replaceAudioTrack(_this._getAudioSource(), filteredAudioTrack);
47078
47126
  case 27:
47079
- _context58.next = 34;
47127
+ _context59.next = 34;
47080
47128
  break;
47081
47129
  case 29:
47082
- _context58.prev = 29;
47083
- _context58.t0 = _context58["catch"](21);
47130
+ _context59.prev = 29;
47131
+ _context59.t0 = _context59["catch"](21);
47084
47132
  _audioMediaProcessorConnector = null;
47085
- logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context58.t0}`);
47086
- throw _context58.t0;
47133
+ logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context59.t0}`);
47134
+ throw _context59.t0;
47087
47135
  case 34:
47088
47136
  case "end":
47089
- return _context58.stop();
47137
+ return _context59.stop();
47090
47138
  }
47091
- }, _callee58, null, [[21, 29]]);
47139
+ }, _callee59, null, [[21, 29]]);
47092
47140
  }));
47093
- return function _setAudioMediaProcessorConnector(_x47) {
47094
- return _ref65.apply(this, arguments);
47141
+ return function _setAudioMediaProcessorConnector(_x48) {
47142
+ return _ref66.apply(this, arguments);
47095
47143
  };
47096
47144
  }();
47097
47145
 
@@ -47112,22 +47160,22 @@ function PublisherFactory(_ref) {
47112
47160
  * @return {Promise} A promise that resolves when the operation completes successfully.
47113
47161
  * If there is an error, the promise is rejected.
47114
47162
  */
47115
- this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59() {
47163
+ this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
47116
47164
  var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, videoTrack;
47117
- return _regenerator.default.wrap(function _callee59$(_context59) {
47118
- while (1) switch (_context59.prev = _context59.next) {
47165
+ return _regenerator.default.wrap(function _callee60$(_context60) {
47166
+ while (1) switch (_context60.prev = _context60.next) {
47119
47167
  case 0:
47120
47168
  logAnalyticsEvent('clearVideoFilter', 'Attempt');
47121
47169
  if (!(!properties.publishVideo && !mediaProcessor.getVideoFilter())) {
47122
- _context59.next = 5;
47170
+ _context60.next = 5;
47123
47171
  break;
47124
47172
  }
47125
47173
  currentVideoFilter = null;
47126
47174
  logAnalyticsEvent('clearVideoFilter', 'Success');
47127
- return _context59.abrupt("return");
47175
+ return _context60.abrupt("return");
47128
47176
  case 5:
47129
47177
  if (!(!mediaProcessor.getVideoFilter() && !currentVideoFilter)) {
47130
- _context59.next = 10;
47178
+ _context60.next = 10;
47131
47179
  break;
47132
47180
  }
47133
47181
  message = 'Ignoring. No video filter applied';
@@ -47135,10 +47183,10 @@ function PublisherFactory(_ref) {
47135
47183
  message
47136
47184
  });
47137
47185
  logging.debug(message);
47138
- return _context59.abrupt("return");
47186
+ return _context60.abrupt("return");
47139
47187
  case 10:
47140
47188
  if (MediaProcessor.isSupported('video')) {
47141
- _context59.next = 15;
47189
+ _context60.next = 15;
47142
47190
  break;
47143
47191
  }
47144
47192
  message = 'Ignoring. "clearVideoFilter" not supported.';
@@ -47146,10 +47194,10 @@ function PublisherFactory(_ref) {
47146
47194
  message
47147
47195
  });
47148
47196
  logging.warn(message);
47149
- return _context59.abrupt("return");
47197
+ return _context60.abrupt("return");
47150
47198
  case 15:
47151
47199
  if (webRTCStream) {
47152
- _context59.next = 20;
47200
+ _context60.next = 20;
47153
47201
  break;
47154
47202
  }
47155
47203
  message = 'Ignoring. No mediaStream';
@@ -47157,44 +47205,44 @@ function PublisherFactory(_ref) {
47157
47205
  message
47158
47206
  });
47159
47207
  logging.warn(message);
47160
- return _context59.abrupt("return");
47208
+ return _context60.abrupt("return");
47161
47209
  case 20:
47162
47210
  oldVideoFilter = currentVideoFilter;
47163
47211
  currentVideoFilter = null;
47164
47212
  _webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0];
47165
- _context59.prev = 23;
47166
- _context59.next = 26;
47213
+ _context60.prev = 23;
47214
+ _context60.next = 26;
47167
47215
  return getTrackFromDeviceId(currentDeviceId);
47168
47216
  case 26:
47169
- videoTrack = _context59.sent;
47170
- _context59.next = 33;
47217
+ videoTrack = _context60.sent;
47218
+ _context60.next = 33;
47171
47219
  break;
47172
47220
  case 29:
47173
- _context59.prev = 29;
47174
- _context59.t0 = _context59["catch"](23);
47175
- logging.error(_context59.t0);
47176
- return _context59.abrupt("return");
47221
+ _context60.prev = 29;
47222
+ _context60.t0 = _context60["catch"](23);
47223
+ logging.error(_context60.t0);
47224
+ return _context60.abrupt("return");
47177
47225
  case 33:
47178
47226
  if (videoTrack) {
47179
- _context59.next = 36;
47227
+ _context60.next = 36;
47180
47228
  break;
47181
47229
  }
47182
47230
  logging.warn('Failed to clear filter because there is no video track.');
47183
- return _context59.abrupt("return");
47231
+ return _context60.abrupt("return");
47184
47232
  case 36:
47185
47233
  filteredVideoTrackId = null;
47186
- _context59.prev = 37;
47187
- _context59.next = 40;
47234
+ _context60.prev = 37;
47235
+ _context60.next = 40;
47188
47236
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
47189
47237
  case 40:
47190
- _context59.next = 42;
47238
+ _context60.next = 42;
47191
47239
  return destroyMediaProcessor();
47192
47240
  case 42:
47193
- _context59.next = 47;
47241
+ _context60.next = 47;
47194
47242
  break;
47195
47243
  case 44:
47196
- _context59.prev = 44;
47197
- _context59.t1 = _context59["catch"](37);
47244
+ _context60.prev = 44;
47245
+ _context60.t1 = _context60["catch"](37);
47198
47246
  // Restore the previous filter since this call has failed. This way, this function can be
47199
47247
  // called again if needed.
47200
47248
  currentVideoFilter = oldVideoFilter;
@@ -47202,29 +47250,29 @@ function PublisherFactory(_ref) {
47202
47250
  logAnalyticsEvent('clearVideoFilter', 'Success');
47203
47251
  case 48:
47204
47252
  case "end":
47205
- return _context59.stop();
47253
+ return _context60.stop();
47206
47254
  }
47207
- }, _callee59, null, [[23, 29], [37, 44]]);
47255
+ }, _callee60, null, [[23, 29], [37, 44]]);
47208
47256
  }));
47209
47257
  const applySetMaxBitrateToPeerConnection = /*#__PURE__*/function () {
47210
- var _ref67 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60(peerConnection) {
47258
+ var _ref68 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(peerConnection) {
47211
47259
  var maxBitrateHasChanged, isPreset;
47212
- return _regenerator.default.wrap(function _callee60$(_context60) {
47213
- while (1) switch (_context60.prev = _context60.next) {
47260
+ return _regenerator.default.wrap(function _callee61$(_context61) {
47261
+ while (1) switch (_context61.prev = _context61.next) {
47214
47262
  case 0:
47215
- _context60.next = 2;
47263
+ _context61.next = 2;
47216
47264
  return peerConnection.setMaxBitrate(_videoMaxBitrateSetting);
47217
47265
  case 2:
47218
- maxBitrateHasChanged = _context60.sent;
47266
+ maxBitrateHasChanged = _context61.sent;
47219
47267
  if (!maxBitrateHasChanged) {
47220
- _context60.next = 8;
47268
+ _context61.next = 8;
47221
47269
  break;
47222
47270
  }
47223
47271
  if (!(_videoMaxBitrateSetting === 0)) {
47224
- _context60.next = 6;
47272
+ _context61.next = 6;
47225
47273
  break;
47226
47274
  }
47227
- return _context60.abrupt("return");
47275
+ return _context61.abrupt("return");
47228
47276
  case 6:
47229
47277
  isPreset = typeof _videoMaxBitrateSetting === 'string';
47230
47278
  if (isPreset) {
@@ -47236,12 +47284,12 @@ function PublisherFactory(_ref) {
47236
47284
  }
47237
47285
  case 8:
47238
47286
  case "end":
47239
- return _context60.stop();
47287
+ return _context61.stop();
47240
47288
  }
47241
- }, _callee60);
47289
+ }, _callee61);
47242
47290
  }));
47243
- return function applySetMaxBitrateToPeerConnection(_x48) {
47244
- return _ref67.apply(this, arguments);
47291
+ return function applySetMaxBitrateToPeerConnection(_x49) {
47292
+ return _ref68.apply(this, arguments);
47245
47293
  };
47246
47294
  }();
47247
47295
 
@@ -47269,16 +47317,16 @@ function PublisherFactory(_ref) {
47269
47317
  */
47270
47318
  this.getVideoBitratePreset = () => properties.videoBitratePreset;
47271
47319
  const setMaxVideoBitrateToPublisher = /*#__PURE__*/function () {
47272
- var _ref68 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(peerConnection) {
47320
+ var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(peerConnection) {
47273
47321
  var logOptions, applyMaxBitrate, peerConnections;
47274
- return _regenerator.default.wrap(function _callee62$(_context62) {
47275
- while (1) switch (_context62.prev = _context62.next) {
47322
+ return _regenerator.default.wrap(function _callee63$(_context63) {
47323
+ while (1) switch (_context63.prev = _context63.next) {
47276
47324
  case 0:
47277
47325
  if (!(_videoMaxBitrateSetting === undefined)) {
47278
- _context62.next = 2;
47326
+ _context63.next = 2;
47279
47327
  break;
47280
47328
  }
47281
- return _context62.abrupt("return");
47329
+ return _context63.abrupt("return");
47282
47330
  case 2:
47283
47331
  if (isNaN(_videoMaxBitrateSetting)) {
47284
47332
  logOptions = {
@@ -47294,57 +47342,57 @@ function PublisherFactory(_ref) {
47294
47342
  logOptions.NearestResolution = (0, _getSpatialResolution.default)(_this.videoWidth(), _this.videoHeight());
47295
47343
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Attempt', {}, logOptions);
47296
47344
  applyMaxBitrate = /*#__PURE__*/function () {
47297
- var _ref69 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(pc) {
47298
- return _regenerator.default.wrap(function _callee61$(_context61) {
47299
- while (1) switch (_context61.prev = _context61.next) {
47345
+ var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(pc) {
47346
+ return _regenerator.default.wrap(function _callee62$(_context62) {
47347
+ while (1) switch (_context62.prev = _context62.next) {
47300
47348
  case 0:
47301
- _context61.prev = 0;
47302
- _context61.next = 3;
47349
+ _context62.prev = 0;
47350
+ _context62.next = 3;
47303
47351
  return applySetMaxBitrateToPeerConnection(pc);
47304
47352
  case 3:
47305
47353
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Success', {}, logOptions);
47306
- _context61.next = 11;
47354
+ _context62.next = 11;
47307
47355
  break;
47308
47356
  case 6:
47309
- _context61.prev = 6;
47310
- _context61.t0 = _context61["catch"](0);
47311
- logOptions.failureReason = _context61.t0.message;
47357
+ _context62.prev = 6;
47358
+ _context62.t0 = _context62["catch"](0);
47359
+ logOptions.failureReason = _context62.t0.message;
47312
47360
  logAnalyticsEvent('SetMaxVideoBitrateOnRtpSender', 'Failure', {}, logOptions);
47313
47361
  throw otError(Errors.UNEXPECTED_ERROR_CODE, new Error('An unexpected error was encountered'));
47314
47362
  case 11:
47315
47363
  case "end":
47316
- return _context61.stop();
47364
+ return _context62.stop();
47317
47365
  }
47318
- }, _callee61, null, [[0, 6]]);
47366
+ }, _callee62, null, [[0, 6]]);
47319
47367
  }));
47320
- return function applyMaxBitrate(_x50) {
47321
- return _ref69.apply(this, arguments);
47368
+ return function applyMaxBitrate(_x51) {
47369
+ return _ref70.apply(this, arguments);
47322
47370
  };
47323
47371
  }();
47324
47372
  if (!peerConnection) {
47325
- _context62.next = 11;
47373
+ _context63.next = 11;
47326
47374
  break;
47327
47375
  }
47328
- _context62.next = 9;
47376
+ _context63.next = 9;
47329
47377
  return applyMaxBitrate(peerConnection);
47330
47378
  case 9:
47331
- _context62.next = 16;
47379
+ _context63.next = 16;
47332
47380
  break;
47333
47381
  case 11:
47334
- _context62.next = 13;
47382
+ _context63.next = 13;
47335
47383
  return getAllPeerConnections();
47336
47384
  case 13:
47337
- peerConnections = _context62.sent;
47338
- _context62.next = 16;
47385
+ peerConnections = _context63.sent;
47386
+ _context63.next = 16;
47339
47387
  return Promise.all(peerConnections.map(applyMaxBitrate));
47340
47388
  case 16:
47341
47389
  case "end":
47342
- return _context62.stop();
47390
+ return _context63.stop();
47343
47391
  }
47344
- }, _callee62);
47392
+ }, _callee63);
47345
47393
  }));
47346
- return function setMaxVideoBitrateToPublisher(_x49) {
47347
- return _ref68.apply(this, arguments);
47394
+ return function setMaxVideoBitrateToPublisher(_x50) {
47395
+ return _ref69.apply(this, arguments);
47348
47396
  };
47349
47397
  }();
47350
47398
  const applyVideoConstraintsTo = track => {
@@ -47400,17 +47448,17 @@ function PublisherFactory(_ref) {
47400
47448
  * @memberOf Publisher
47401
47449
  */
47402
47450
  this.setPreferredResolution = /*#__PURE__*/function () {
47403
- var _ref70 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(preferredResolution) {
47451
+ var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(preferredResolution) {
47404
47452
  var _webRTCStream, _webRTCStream$getVide6, _properties$videoDime3, _properties$videoDime4;
47405
47453
  var message, startingWidth, startingHeight, startingArea, preferredArea, result;
47406
- return _regenerator.default.wrap(function _callee63$(_context63) {
47407
- while (1) switch (_context63.prev = _context63.next) {
47454
+ return _regenerator.default.wrap(function _callee64$(_context64) {
47455
+ while (1) switch (_context64.prev = _context64.next) {
47408
47456
  case 0:
47409
47457
  logAnalyticsEvent('setPreferredResolution', 'Attempt', {
47410
47458
  preferredResolution
47411
47459
  });
47412
47460
  if (!(!properties.publishVideo || !((_webRTCStream = webRTCStream) != null && (_webRTCStream$getVide6 = _webRTCStream.getVideoTracks()) != null && _webRTCStream$getVide6.length))) {
47413
- _context63.next = 5;
47461
+ _context64.next = 5;
47414
47462
  break;
47415
47463
  }
47416
47464
  message = 'setPreferredResolution needs to be called on a video publisher';
@@ -47421,7 +47469,7 @@ function PublisherFactory(_ref) {
47421
47469
  throw new Error(message);
47422
47470
  case 5:
47423
47471
  if (!(!preferredResolution || !Number.isInteger(preferredResolution.width) || preferredResolution.width <= 0 || !Number.isInteger(preferredResolution.height) || preferredResolution.height <= 0)) {
47424
- _context63.next = 9;
47472
+ _context64.next = 9;
47425
47473
  break;
47426
47474
  }
47427
47475
  message = 'preferredResolution must be an object with positive integer width and height properties';
@@ -47436,7 +47484,7 @@ function PublisherFactory(_ref) {
47436
47484
  startingArea = startingWidth * startingHeight;
47437
47485
  preferredArea = preferredResolution.width * preferredResolution.height;
47438
47486
  if (!(preferredArea > startingArea)) {
47439
- _context63.next = 17;
47487
+ _context64.next = 17;
47440
47488
  break;
47441
47489
  }
47442
47490
  message = 'preferredResolution cannot be higher than the initial ' + 'publishing resolution';
@@ -47448,31 +47496,31 @@ function PublisherFactory(_ref) {
47448
47496
  case 17:
47449
47497
  _preferredWidth = preferredResolution.width;
47450
47498
  _preferredHeight = preferredResolution.height;
47451
- _context63.prev = 19;
47452
- _context63.next = 22;
47499
+ _context64.prev = 19;
47500
+ _context64.next = 22;
47453
47501
  return applyVideoConstraints();
47454
47502
  case 22:
47455
- result = _context63.sent;
47503
+ result = _context64.sent;
47456
47504
  logAnalyticsEvent('setPreferredResolution', 'Success', {
47457
47505
  preferredResolution
47458
47506
  });
47459
- return _context63.abrupt("return", result);
47507
+ return _context64.abrupt("return", result);
47460
47508
  case 27:
47461
- _context63.prev = 27;
47462
- _context63.t0 = _context63["catch"](19);
47509
+ _context64.prev = 27;
47510
+ _context64.t0 = _context64["catch"](19);
47463
47511
  logAnalyticsEvent('setPreferredResolution', 'Failure', {
47464
47512
  preferredResolution,
47465
- message: _context63.t0.message
47513
+ message: _context64.t0.message
47466
47514
  });
47467
- throw _context63.t0;
47515
+ throw _context64.t0;
47468
47516
  case 31:
47469
47517
  case "end":
47470
- return _context63.stop();
47518
+ return _context64.stop();
47471
47519
  }
47472
- }, _callee63, null, [[19, 27]]);
47520
+ }, _callee64, null, [[19, 27]]);
47473
47521
  }));
47474
- return function (_x51) {
47475
- return _ref70.apply(this, arguments);
47522
+ return function (_x52) {
47523
+ return _ref71.apply(this, arguments);
47476
47524
  };
47477
47525
  }();
47478
47526
 
@@ -47493,17 +47541,17 @@ function PublisherFactory(_ref) {
47493
47541
  * @memberOf Publisher
47494
47542
  */
47495
47543
  this.setPreferredFrameRate = /*#__PURE__*/function () {
47496
- var _ref71 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64(frameRate) {
47544
+ var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(frameRate) {
47497
47545
  var _webRTCStream2, _webRTCStream2$getVid;
47498
47546
  var message, result;
47499
- return _regenerator.default.wrap(function _callee64$(_context64) {
47500
- while (1) switch (_context64.prev = _context64.next) {
47547
+ return _regenerator.default.wrap(function _callee65$(_context65) {
47548
+ while (1) switch (_context65.prev = _context65.next) {
47501
47549
  case 0:
47502
47550
  logAnalyticsEvent('setPreferredFrameRate', 'Attempt', {
47503
47551
  frameRate
47504
47552
  });
47505
47553
  if (!(!properties.publishVideo || !((_webRTCStream2 = webRTCStream) != null && (_webRTCStream2$getVid = _webRTCStream2.getVideoTracks()) != null && _webRTCStream2$getVid.length))) {
47506
- _context64.next = 5;
47554
+ _context65.next = 5;
47507
47555
  break;
47508
47556
  }
47509
47557
  message = 'setPreferredFrameRate needs to be called on a video publisher';
@@ -47514,7 +47562,7 @@ function PublisherFactory(_ref) {
47514
47562
  throw new Error(message);
47515
47563
  case 5:
47516
47564
  if (!(!Number.isInteger(frameRate) || frameRate < 1)) {
47517
- _context64.next = 9;
47565
+ _context65.next = 9;
47518
47566
  break;
47519
47567
  }
47520
47568
  message = 'Invalid frameRate: must be an integer ≥ 1';
@@ -47525,31 +47573,31 @@ function PublisherFactory(_ref) {
47525
47573
  throw new Error(message);
47526
47574
  case 9:
47527
47575
  _preferredFrameRate = frameRate;
47528
- _context64.prev = 10;
47529
- _context64.next = 13;
47576
+ _context65.prev = 10;
47577
+ _context65.next = 13;
47530
47578
  return applyVideoConstraints();
47531
47579
  case 13:
47532
- result = _context64.sent;
47580
+ result = _context65.sent;
47533
47581
  logAnalyticsEvent('setPreferredFrameRate', 'Success', {
47534
47582
  frameRate
47535
47583
  });
47536
- return _context64.abrupt("return", result);
47584
+ return _context65.abrupt("return", result);
47537
47585
  case 18:
47538
- _context64.prev = 18;
47539
- _context64.t0 = _context64["catch"](10);
47586
+ _context65.prev = 18;
47587
+ _context65.t0 = _context65["catch"](10);
47540
47588
  logAnalyticsEvent('setPreferredFrameRate', 'Failure', {
47541
47589
  frameRate,
47542
- message: _context64.t0.message
47590
+ message: _context65.t0.message
47543
47591
  });
47544
- throw _context64.t0;
47592
+ throw _context65.t0;
47545
47593
  case 22:
47546
47594
  case "end":
47547
- return _context64.stop();
47595
+ return _context65.stop();
47548
47596
  }
47549
- }, _callee64, null, [[10, 18]]);
47597
+ }, _callee65, null, [[10, 18]]);
47550
47598
  }));
47551
- return function (_x52) {
47552
- return _ref71.apply(this, arguments);
47599
+ return function (_x53) {
47600
+ return _ref72.apply(this, arguments);
47553
47601
  };
47554
47602
  }();
47555
47603
 
@@ -47573,44 +47621,44 @@ function PublisherFactory(_ref) {
47573
47621
  * @memberOf Publisher
47574
47622
  */
47575
47623
  this.setMaxVideoBitrate = /*#__PURE__*/function () {
47576
- var _ref72 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65(bitrateBps) {
47624
+ var _ref73 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66(bitrateBps) {
47577
47625
  var bitrate;
47578
- return _regenerator.default.wrap(function _callee65$(_context65) {
47579
- while (1) switch (_context65.prev = _context65.next) {
47626
+ return _regenerator.default.wrap(function _callee66$(_context66) {
47627
+ while (1) switch (_context66.prev = _context66.next) {
47580
47628
  case 0:
47581
47629
  if (!(typeof bitrateBps !== 'number')) {
47582
- _context65.next = 2;
47630
+ _context66.next = 2;
47583
47631
  break;
47584
47632
  }
47585
47633
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
47586
47634
  case 2:
47587
47635
  bitrate = parseInt(bitrateBps, 10);
47588
47636
  if (!(isNaN(bitrate) || bitrate !== 0 && (bitrate < 5000 || bitrate > 10000000))) {
47589
- _context65.next = 5;
47637
+ _context66.next = 5;
47590
47638
  break;
47591
47639
  }
47592
47640
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid bitrate: it must be 0 or any number between 5000 and 10000000'));
47593
47641
  case 5:
47594
47642
  _videoMaxBitrateSetting = bitrate === 0 ? _VideoBitratePreset.default.DEFAULT : bitrate;
47595
47643
  if (isAudioFallbackActive()) {
47596
- _context65.next = 11;
47644
+ _context66.next = 11;
47597
47645
  break;
47598
47646
  }
47599
- _context65.next = 9;
47647
+ _context66.next = 9;
47600
47648
  return setMaxVideoBitrateToPublisher();
47601
47649
  case 9:
47602
- _context65.next = 12;
47650
+ _context66.next = 12;
47603
47651
  break;
47604
47652
  case 11:
47605
47653
  logging.debug('Video is currently inactive, max bitrate will be applied once active.');
47606
47654
  case 12:
47607
47655
  case "end":
47608
- return _context65.stop();
47656
+ return _context66.stop();
47609
47657
  }
47610
- }, _callee65);
47658
+ }, _callee66);
47611
47659
  }));
47612
- return function (_x53) {
47613
- return _ref72.apply(this, arguments);
47660
+ return function (_x54) {
47661
+ return _ref73.apply(this, arguments);
47614
47662
  };
47615
47663
  }();
47616
47664
 
@@ -47632,44 +47680,44 @@ function PublisherFactory(_ref) {
47632
47680
  * @memberOf Publisher
47633
47681
  */
47634
47682
  this.setVideoBitratePreset = /*#__PURE__*/function () {
47635
- var _ref73 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66(preset) {
47683
+ var _ref74 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee67(preset) {
47636
47684
  var filteredPreset;
47637
- return _regenerator.default.wrap(function _callee66$(_context66) {
47638
- while (1) switch (_context66.prev = _context66.next) {
47685
+ return _regenerator.default.wrap(function _callee67$(_context67) {
47686
+ while (1) switch (_context67.prev = _context67.next) {
47639
47687
  case 0:
47640
47688
  if (!(typeof preset !== 'string')) {
47641
- _context66.next = 2;
47689
+ _context67.next = 2;
47642
47690
  break;
47643
47691
  }
47644
47692
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid preset. It must be either "default", "bw_saver", or "extra_bw_saver"'));
47645
47693
  case 2:
47646
47694
  filteredPreset = _VideoBitratePreset.default[preset.toUpperCase()];
47647
47695
  if (!(filteredPreset === undefined)) {
47648
- _context66.next = 5;
47696
+ _context67.next = 5;
47649
47697
  break;
47650
47698
  }
47651
47699
  throw otError(Errors.INVALID_PARAMETER, new Error('Invalid preset. It must be either "default", "bw_saver", or "extra_bw_saver"'));
47652
47700
  case 5:
47653
47701
  _videoMaxBitrateSetting = filteredPreset;
47654
47702
  if (isAudioFallbackActive()) {
47655
- _context66.next = 11;
47703
+ _context67.next = 11;
47656
47704
  break;
47657
47705
  }
47658
- _context66.next = 9;
47706
+ _context67.next = 9;
47659
47707
  return setMaxVideoBitrateToPublisher();
47660
47708
  case 9:
47661
- _context66.next = 12;
47709
+ _context67.next = 12;
47662
47710
  break;
47663
47711
  case 11:
47664
47712
  logging.debug('Video is currently inactive, bitrate preset will be applied once active.');
47665
47713
  case 12:
47666
47714
  case "end":
47667
- return _context66.stop();
47715
+ return _context67.stop();
47668
47716
  }
47669
- }, _callee66);
47717
+ }, _callee67);
47670
47718
  }));
47671
- return function (_x54) {
47672
- return _ref73.apply(this, arguments);
47719
+ return function (_x55) {
47720
+ return _ref74.apply(this, arguments);
47673
47721
  };
47674
47722
  }();
47675
47723
 
@@ -66929,13 +66977,14 @@ function SessionFactory(deps) {
66929
66977
  // If the publisher already has a session attached to it we can
66930
66978
  if ('session' in publisher && publisher.session && 'sessionId' in publisher.session) {
66931
66979
  // send a warning message that we can't publish again.
66980
+ let msg;
66932
66981
  if (publisher.session.sessionId === this.sessionId) {
66933
- _logging.warn(`Cannot publish ${publisher.guid()} again to ${this.sessionId}. Please call session.unpublish(publisher) first.`);
66982
+ msg = `Cannot publish ${publisher.guid()} again to ${this.sessionId}. Please call session.unpublish(publisher) first.`;
66934
66983
  } else {
66935
- _logging.warn(`Cannot publish ${publisher.guid()} publisher already attached to ${publisher.session.sessionId}. Please call session.unpublish(publisher) first.`);
66984
+ msg = `Cannot publish ${publisher.guid()} publisher already attached to ${publisher.session.sessionId}. Please call session.unpublish(publisher) first.`;
66936
66985
  }
66937
- completionHandler(null, publisher);
66938
- return publisher;
66986
+ dispatchOTError(otError(errors.INVALID_PARAMETER, new Error(msg), ExceptionCodes.UNABLE_TO_PUBLISH), completionHandler);
66987
+ return undefined;
66939
66988
  }
66940
66989
  } else if (shouldInitPublisher) {
66941
66990
  // Initiate a new Publisher with the new session credentials
@@ -67840,9 +67889,9 @@ function SessionFactory(deps) {
67840
67889
  customProperties = _ref4.customProperties;
67841
67890
  if (!_socket) {
67842
67891
  _logging.warn('You are disconnected, cannot create stream ', streamId);
67843
- return;
67892
+ return null;
67844
67893
  }
67845
- _socket.streamCreate({
67894
+ return _socket.streamCreate({
67846
67895
  name,
67847
67896
  streamId,
67848
67897
  subscriberAudioFallbackEnabled,