@webex/plugin-meetings 3.0.0-beta.259 → 3.0.0-beta.260

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.
@@ -4618,177 +4618,240 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4618
4618
  */
4619
4619
  }, {
4620
4620
  key: "join",
4621
- value: function join() {
4622
- var _this32 = this;
4623
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4624
- // @ts-ignore - fix type
4625
- if (!this.webex.meetings.registered) {
4626
- var errorMessage = 'Meeting:index#join --> Device not registered';
4627
- var error = new Error(errorMessage);
4628
- _loggerProxy.default.logger.error(errorMessage);
4629
- return _promise.default.reject(error);
4630
- }
4631
-
4632
- // If a join request is being processed, refer to the deferred promise.
4633
- if (this.deferJoin) {
4634
- return this.deferJoin;
4635
- }
4636
-
4637
- // Scope-up the resolve/reject methods for handling within join().
4638
- var joinFailed;
4639
- var joinSuccess;
4640
-
4641
- // Create a deferred promise for a consistent resolve value from utils.
4642
- // This also prevents redundant API calls.
4643
- this.deferJoin = new _promise.default(function (resolve, reject) {
4644
- joinFailed = reject;
4645
- joinSuccess = resolve;
4646
- });
4647
- if (options.correlationId) {
4648
- this.setCorrelationId(options.correlationId);
4649
- _loggerProxy.default.logger.log("Meeting:index#join --> Using a new correlation id from app ".concat(this.correlationId));
4650
- }
4651
- if (!this.hasJoinedOnce) {
4652
- this.hasJoinedOnce = true;
4653
- } else if (!options.correlationId) {
4654
- _loggerProxy.default.logger.log("Meeting:index#join --> Generating a new correlation id for meeting ".concat(this.id));
4655
- _loggerProxy.default.logger.log("Meeting:index#join --> Previous correlation id ".concat(this.correlationId));
4656
- this.setCorrelationId(_uuid.default.v4());
4657
- _loggerProxy.default.logger.log("Meeting:index#join --> New correlation id ".concat(this.correlationId));
4658
- }
4659
- if (options.rejoin) {
4660
- this.meetingFiniteStateMachine.reset();
4661
- }
4621
+ value: function () {
4622
+ var _join = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
4623
+ var _this32 = this;
4624
+ var options,
4625
+ errorMessage,
4626
+ error,
4627
+ joinFailed,
4628
+ joinSuccess,
4629
+ _errorMessage,
4630
+ _error,
4631
+ _errorMessage2,
4632
+ _error2,
4633
+ _args13 = arguments;
4634
+ return _regenerator.default.wrap(function _callee13$(_context13) {
4635
+ while (1) switch (_context13.prev = _context13.next) {
4636
+ case 0:
4637
+ options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
4638
+ if (this.webex.meetings.registered) {
4639
+ _context13.next = 6;
4640
+ break;
4641
+ }
4642
+ errorMessage = 'Meeting:index#join --> Device not registered';
4643
+ error = new Error(errorMessage);
4644
+ _loggerProxy.default.logger.error(errorMessage);
4645
+ return _context13.abrupt("return", _promise.default.reject(error));
4646
+ case 6:
4647
+ if (!this.deferJoin) {
4648
+ _context13.next = 8;
4649
+ break;
4650
+ }
4651
+ return _context13.abrupt("return", this.deferJoin);
4652
+ case 8:
4653
+ // Create a deferred promise for a consistent resolve value from utils.
4654
+ // This also prevents redundant API calls.
4655
+ this.deferJoin = new _promise.default(function (resolve, reject) {
4656
+ joinFailed = reject;
4657
+ joinSuccess = resolve;
4658
+ });
4659
+ if (options.correlationId) {
4660
+ this.setCorrelationId(options.correlationId);
4661
+ _loggerProxy.default.logger.log("Meeting:index#join --> Using a new correlation id from app ".concat(this.correlationId));
4662
+ }
4663
+ if (!this.hasJoinedOnce) {
4664
+ this.hasJoinedOnce = true;
4665
+ } else if (!options.correlationId) {
4666
+ _loggerProxy.default.logger.log("Meeting:index#join --> Generating a new correlation id for meeting ".concat(this.id));
4667
+ _loggerProxy.default.logger.log("Meeting:index#join --> Previous correlation id ".concat(this.correlationId));
4668
+ this.setCorrelationId(_uuid.default.v4());
4669
+ _loggerProxy.default.logger.log("Meeting:index#join --> New correlation id ".concat(this.correlationId));
4670
+ }
4671
+ if (options.rejoin) {
4672
+ this.meetingFiniteStateMachine.reset();
4673
+ }
4662
4674
 
4663
- // @ts-ignore
4664
- this.webex.internal.newMetrics.submitClientEvent({
4665
- name: 'client.call.initiated',
4666
- payload: {
4667
- trigger: 'user-interaction',
4668
- isRoapCallEnabled: true
4669
- },
4670
- options: {
4671
- meetingId: this.id
4672
- }
4673
- });
4674
- _loggerProxy.default.logger.log('Meeting:index#join --> Joining a meeting');
4675
- if (this.meetingFiniteStateMachine.state === _constants.MEETING_STATE_MACHINE.STATES.ENDED) {
4676
- this.meetingFiniteStateMachine.reset();
4677
- }
4678
- if (this.meetingFiniteStateMachine.state !== _constants.MEETING_STATE_MACHINE.STATES.RINGING) {
4679
- this.meetingFiniteStateMachine.ring(_constants._JOIN_);
4680
- }
4675
+ // @ts-ignore
4676
+ this.webex.internal.newMetrics.submitClientEvent({
4677
+ name: 'client.call.initiated',
4678
+ payload: {
4679
+ trigger: 'user-interaction',
4680
+ isRoapCallEnabled: true
4681
+ },
4682
+ options: {
4683
+ meetingId: this.id
4684
+ }
4685
+ });
4686
+ _loggerProxy.default.logger.log('Meeting:index#join --> Joining a meeting');
4687
+ if (this.meetingFiniteStateMachine.state === _constants.MEETING_STATE_MACHINE.STATES.ENDED) {
4688
+ this.meetingFiniteStateMachine.reset();
4689
+ }
4690
+ if (this.meetingFiniteStateMachine.state !== _constants.MEETING_STATE_MACHINE.STATES.RINGING) {
4691
+ this.meetingFiniteStateMachine.ring(_constants._JOIN_);
4692
+ }
4681
4693
 
4682
- // TODO: does this really need to be here?
4683
- if (options.resourceId && this.destination && options.resourceId === this.destination) {
4684
- this.wirelessShare = true;
4685
- }
4686
- if (options.meetingQuality) {
4687
- if (typeof options.meetingQuality === 'string') {
4688
- if (!_constants.QUALITY_LEVELS[options.meetingQuality]) {
4689
- var _errorMessage = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
4690
- var _error = new Error(_errorMessage);
4691
- _loggerProxy.default.logger.error(_errorMessage);
4692
- joinFailed(_error);
4693
- this.deferJoin = undefined;
4694
- return _promise.default.reject(_error);
4695
- }
4696
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
4697
- }
4698
- if ((0, _typeof2.default)(options.meetingQuality) === 'object') {
4699
- if (!_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
4700
- var _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
4701
- _loggerProxy.default.logger.error(_errorMessage2);
4702
- var _error2 = new Error(_errorMessage2);
4703
- joinFailed(_error2);
4704
- this.deferJoin = undefined;
4705
- return _promise.default.reject(new Error(_errorMessage2));
4706
- }
4707
- if (options.meetingQuality.remote) {
4708
- this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
4709
- }
4710
- }
4711
- }
4712
- this.isMultistream = !!options.enableMultistream;
4713
- return _util.default.joinMeetingOptions(this, options).then(function (join) {
4714
- _this32.meetingFiniteStateMachine.join();
4715
- _loggerProxy.default.logger.log('Meeting:index#join --> Success');
4716
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
4717
- correlation_id: _this32.correlationId
4718
- });
4719
- joinSuccess(join);
4720
- _this32.deferJoin = undefined;
4721
- return join;
4722
- }).catch(function (error) {
4723
- var _this32$meetingInfo, _error$error;
4724
- _this32.meetingFiniteStateMachine.fail(error);
4725
- _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4694
+ // TODO: does this really need to be here?
4695
+ if (options.resourceId && this.destination && options.resourceId === this.destination) {
4696
+ this.wirelessShare = true;
4697
+ }
4698
+ if (!options.meetingQuality) {
4699
+ _context13.next = 36;
4700
+ break;
4701
+ }
4702
+ if (!(typeof options.meetingQuality === 'string')) {
4703
+ _context13.next = 27;
4704
+ break;
4705
+ }
4706
+ if (_constants.QUALITY_LEVELS[options.meetingQuality]) {
4707
+ _context13.next = 26;
4708
+ break;
4709
+ }
4710
+ _errorMessage = "Meeting:index#join --> ".concat(options.meetingQuality, " not defined");
4711
+ _error = new Error(_errorMessage);
4712
+ _loggerProxy.default.logger.error(_errorMessage);
4713
+ joinFailed(_error);
4714
+ this.deferJoin = undefined;
4715
+ return _context13.abrupt("return", _promise.default.reject(_error));
4716
+ case 26:
4717
+ this.mediaProperties.setRemoteQualityLevel(options.meetingQuality);
4718
+ case 27:
4719
+ if (!((0, _typeof2.default)(options.meetingQuality) === 'object')) {
4720
+ _context13.next = 36;
4721
+ break;
4722
+ }
4723
+ if (_constants.QUALITY_LEVELS[options.meetingQuality.remote]) {
4724
+ _context13.next = 35;
4725
+ break;
4726
+ }
4727
+ _errorMessage2 = "Meeting:index#join --> ".concat(options.meetingQuality.remote, " not defined");
4728
+ _loggerProxy.default.logger.error(_errorMessage2);
4729
+ _error2 = new Error(_errorMessage2);
4730
+ joinFailed(_error2);
4731
+ this.deferJoin = undefined;
4732
+ return _context13.abrupt("return", _promise.default.reject(new Error(_errorMessage2)));
4733
+ case 35:
4734
+ if (options.meetingQuality.remote) {
4735
+ this.mediaProperties.setRemoteQualityLevel(options.meetingQuality.remote);
4736
+ }
4737
+ case 36:
4738
+ this.isMultistream = !!options.enableMultistream;
4739
+ _context13.prev = 37;
4740
+ _context13.next = 40;
4741
+ return this.checkAndRefreshPermissionToken(_constants.MEETING_PERMISSION_TOKEN_REFRESH_THRESHOLD_IN_SEC, _constants.MEETING_PERMISSION_TOKEN_REFRESH_REASON);
4742
+ case 40:
4743
+ _context13.next = 51;
4744
+ break;
4745
+ case 42:
4746
+ _context13.prev = 42;
4747
+ _context13.t0 = _context13["catch"](37);
4748
+ _loggerProxy.default.logger.error('Meeting:index#join --> Failed to refresh permission token:', _context13.t0);
4749
+ if (!(_context13.t0 instanceof _captchaError.default || _context13.t0 instanceof _passwordError.default || _context13.t0 instanceof _permission.default)) {
4750
+ _context13.next = 51;
4751
+ break;
4752
+ }
4753
+ this.meetingFiniteStateMachine.fail(_context13.t0);
4726
4754
 
4727
- // @ts-ignore
4728
- _this32.webex.internal.newMetrics.submitClientEvent({
4729
- name: 'client.locus.join.response',
4730
- payload: {
4731
- identifiers: {
4732
- meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
4733
- }
4734
- },
4735
- options: {
4736
- meetingId: _this32.id,
4737
- rawError: error
4738
- }
4739
- });
4755
+ // Upload logs on refreshpermissionToken refresh Failure
4756
+ _triggerProxy.default.trigger(this, {
4757
+ file: 'meeting/index',
4758
+ function: 'join'
4759
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
4760
+ joinFailed(_context13.t0);
4761
+ this.deferJoin = undefined;
4762
+
4763
+ // if refresh permission token requires captcha, password or permission, we are throwing the errors
4764
+ // and bubble it up to client
4765
+ return _context13.abrupt("return", _promise.default.reject(_context13.t0));
4766
+ case 51:
4767
+ return _context13.abrupt("return", _util.default.joinMeetingOptions(this, options).then(function (join) {
4768
+ _this32.meetingFiniteStateMachine.join();
4769
+ _loggerProxy.default.logger.log('Meeting:index#join --> Success');
4770
+ _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
4771
+ correlation_id: _this32.correlationId
4772
+ });
4773
+ joinSuccess(join);
4774
+ _this32.deferJoin = undefined;
4775
+ return join;
4776
+ }).catch(function (error) {
4777
+ var _this32$meetingInfo, _error$error;
4778
+ _this32.meetingFiniteStateMachine.fail(error);
4779
+ _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4740
4780
 
4741
- // TODO: change this to error codes and pre defined dictionary
4742
- _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
4743
- correlation_id: _this32.correlationId,
4744
- reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
4745
- stack: error.stack
4746
- });
4781
+ // @ts-ignore
4782
+ _this32.webex.internal.newMetrics.submitClientEvent({
4783
+ name: 'client.locus.join.response',
4784
+ payload: {
4785
+ identifiers: {
4786
+ meetingLookupUrl: (_this32$meetingInfo = _this32.meetingInfo) === null || _this32$meetingInfo === void 0 ? void 0 : _this32$meetingInfo.meetingLookupUrl
4787
+ }
4788
+ },
4789
+ options: {
4790
+ meetingId: _this32.id,
4791
+ rawError: error
4792
+ }
4793
+ });
4747
4794
 
4748
- // Upload logs on join Failure
4749
- _triggerProxy.default.trigger(_this32, {
4750
- file: 'meeting/index',
4751
- function: 'join'
4752
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
4753
- joinFailed(error);
4754
- _this32.deferJoin = undefined;
4755
- return _promise.default.reject(error);
4756
- }).then(function (join) {
4757
- // @ts-ignore - config coming from registerPlugin
4758
- if (_this32.config.enableAutomaticLLM) {
4759
- _this32.updateLLMConnection().catch(function (error) {
4760
- _loggerProxy.default.logger.error('Meeting:index#join --> Update LLM Connection Failed', error);
4761
- _metrics.default.sendBehavioralMetric(_constants2.default.LLM_CONNECTION_AFTER_JOIN_FAILURE, {
4762
- correlation_id: _this32.correlationId,
4763
- reason: error === null || error === void 0 ? void 0 : error.message,
4764
- stack: error.stack
4765
- });
4766
- });
4767
- }
4768
- return join;
4769
- }).then(function (join) {
4770
- if (isBrowser) {
4771
- // @ts-ignore - config coming from registerPlugin
4772
- if (_this32.config.receiveTranscription || options.receiveTranscription) {
4773
- if (_this32.isTranscriptionSupported()) {
4774
- _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to recieve transcription!');
4775
- _this32.receiveTranscription().catch(function (error) {
4776
- _loggerProxy.default.logger.error('Meeting:index#join --> Receive Transcription Failed', error);
4777
- _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_AFTER_JOIN_FAILURE, {
4795
+ // TODO: change this to error codes and pre defined dictionary
4796
+ _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
4778
4797
  correlation_id: _this32.correlationId,
4779
- reason: error === null || error === void 0 ? void 0 : error.message,
4798
+ reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
4780
4799
  stack: error.stack
4781
4800
  });
4782
- });
4783
- }
4784
- }
4785
- } else {
4786
- _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4787
- }
4788
- return join;
4789
- });
4790
- }
4791
4801
 
4802
+ // Upload logs on join Failure
4803
+ _triggerProxy.default.trigger(_this32, {
4804
+ file: 'meeting/index',
4805
+ function: 'join'
4806
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this32);
4807
+ joinFailed(error);
4808
+ _this32.deferJoin = undefined;
4809
+ return _promise.default.reject(error);
4810
+ }).then(function (join) {
4811
+ // @ts-ignore - config coming from registerPlugin
4812
+ if (_this32.config.enableAutomaticLLM) {
4813
+ _this32.updateLLMConnection().catch(function (error) {
4814
+ _loggerProxy.default.logger.error('Meeting:index#join --> Update LLM Connection Failed', error);
4815
+ _metrics.default.sendBehavioralMetric(_constants2.default.LLM_CONNECTION_AFTER_JOIN_FAILURE, {
4816
+ correlation_id: _this32.correlationId,
4817
+ reason: error === null || error === void 0 ? void 0 : error.message,
4818
+ stack: error.stack
4819
+ });
4820
+ });
4821
+ }
4822
+ return join;
4823
+ }).then(function (join) {
4824
+ if (isBrowser) {
4825
+ // @ts-ignore - config coming from registerPlugin
4826
+ if (_this32.config.receiveTranscription || options.receiveTranscription) {
4827
+ if (_this32.isTranscriptionSupported()) {
4828
+ _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to recieve transcription!');
4829
+ _this32.receiveTranscription().catch(function (error) {
4830
+ _loggerProxy.default.logger.error('Meeting:index#join --> Receive Transcription Failed', error);
4831
+ _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_AFTER_JOIN_FAILURE, {
4832
+ correlation_id: _this32.correlationId,
4833
+ reason: error === null || error === void 0 ? void 0 : error.message,
4834
+ stack: error.stack
4835
+ });
4836
+ });
4837
+ }
4838
+ }
4839
+ } else {
4840
+ _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4841
+ }
4842
+ return join;
4843
+ }));
4844
+ case 52:
4845
+ case "end":
4846
+ return _context13.stop();
4847
+ }
4848
+ }, _callee13, this, [[37, 42]]);
4849
+ }));
4850
+ function join() {
4851
+ return _join.apply(this, arguments);
4852
+ }
4853
+ return join;
4854
+ }()
4792
4855
  /**
4793
4856
  * Connects to low latency mercury and reconnects if the address has changed
4794
4857
  * It will also disconnect if called when the meeting has ended
@@ -4798,38 +4861,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4798
4861
  }, {
4799
4862
  key: "updateLLMConnection",
4800
4863
  value: function () {
4801
- var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
4864
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
4802
4865
  var _this33 = this;
4803
4866
  var _this$locusInfo6, url, _this$locusInfo6$info, _this$locusInfo6$info2, datachannelUrl, isJoined;
4804
- return _regenerator.default.wrap(function _callee13$(_context13) {
4805
- while (1) switch (_context13.prev = _context13.next) {
4867
+ return _regenerator.default.wrap(function _callee14$(_context14) {
4868
+ while (1) switch (_context14.prev = _context14.next) {
4806
4869
  case 0:
4807
4870
  // @ts-ignore - Fix type
4808
4871
  _this$locusInfo6 = this.locusInfo, url = _this$locusInfo6.url, _this$locusInfo6$info = _this$locusInfo6.info, _this$locusInfo6$info2 = _this$locusInfo6$info === void 0 ? {} : _this$locusInfo6$info, datachannelUrl = _this$locusInfo6$info2.datachannelUrl;
4809
4872
  isJoined = this.isJoined(); // @ts-ignore - Fix type
4810
4873
  if (!this.webex.internal.llm.isConnected()) {
4811
- _context13.next = 8;
4874
+ _context14.next = 8;
4812
4875
  break;
4813
4876
  }
4814
4877
  if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
4815
- _context13.next = 5;
4878
+ _context14.next = 5;
4816
4879
  break;
4817
4880
  }
4818
- return _context13.abrupt("return", undefined);
4881
+ return _context14.abrupt("return", undefined);
4819
4882
  case 5:
4820
- _context13.next = 7;
4883
+ _context14.next = 7;
4821
4884
  return this.webex.internal.llm.disconnectLLM();
4822
4885
  case 7:
4823
4886
  // @ts-ignore - Fix type
4824
4887
  this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
4825
4888
  case 8:
4826
4889
  if (isJoined) {
4827
- _context13.next = 10;
4890
+ _context14.next = 10;
4828
4891
  break;
4829
4892
  }
4830
- return _context13.abrupt("return", undefined);
4893
+ return _context14.abrupt("return", undefined);
4831
4894
  case 10:
4832
- return _context13.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl).then(function (registerAndConnectResult) {
4895
+ return _context14.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl).then(function (registerAndConnectResult) {
4833
4896
  // @ts-ignore - Fix type
4834
4897
  _this33.webex.internal.llm.off('event:relay.event', _this33.processRelayEvent);
4835
4898
  // @ts-ignore - Fix type
@@ -4839,9 +4902,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4839
4902
  }));
4840
4903
  case 11:
4841
4904
  case "end":
4842
- return _context13.stop();
4905
+ return _context14.stop();
4843
4906
  }
4844
- }, _callee13, this);
4907
+ }, _callee14, this);
4845
4908
  }));
4846
4909
  function updateLLMConnection() {
4847
4910
  return _updateLLMConnection.apply(this, arguments);
@@ -5012,17 +5075,17 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5012
5075
  meetingId: this.id
5013
5076
  }
5014
5077
  });
5015
- this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
5078
+ this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
5016
5079
  var mediaSettings;
5017
- return _regenerator.default.wrap(function _callee14$(_context14) {
5018
- while (1) switch (_context14.prev = _context14.next) {
5080
+ return _regenerator.default.wrap(function _callee15$(_context15) {
5081
+ while (1) switch (_context15.prev = _context15.next) {
5019
5082
  case 0:
5020
- _context14.prev = 0;
5083
+ _context15.prev = 0;
5021
5084
  if (!(_this36.screenShareFloorState === ScreenShareFloorStatus.GRANTED)) {
5022
- _context14.next = 4;
5085
+ _context15.next = 4;
5023
5086
  break;
5024
5087
  }
5025
- _context14.next = 4;
5088
+ _context15.next = 4;
5026
5089
  return _this36.releaseScreenShareFloor();
5027
5090
  case 4:
5028
5091
  mediaSettings = {
@@ -5042,28 +5105,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5042
5105
  // when a move to is intiated by the client , Locus delets the existing media node from the server as soon the DX answers the meeting
5043
5106
  // once the DX answers we establish connection back the media server with only receiveShare enabled
5044
5107
  // @ts-ignore - reconnectMedia does not accept any argument
5045
- _context14.next = 10;
5108
+ _context15.next = 10;
5046
5109
  return _this36.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
5047
5110
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
5048
5111
  });
5049
5112
  case 10:
5050
- _context14.next = 16;
5113
+ _context15.next = 16;
5051
5114
  break;
5052
5115
  case 12:
5053
- _context14.prev = 12;
5054
- _context14.t0 = _context14["catch"](0);
5055
- _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context14.t0);
5116
+ _context15.prev = 12;
5117
+ _context15.t0 = _context15["catch"](0);
5118
+ _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context15.t0);
5056
5119
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
5057
5120
  correlation_id: _this36.correlationId,
5058
5121
  locus_id: _this36.locusUrl.split('/').pop(),
5059
- reason: _context14.t0.message,
5060
- stack: _context14.t0.stack
5122
+ reason: _context15.t0.message,
5123
+ stack: _context15.t0.stack
5061
5124
  });
5062
5125
  case 16:
5063
5126
  case "end":
5064
- return _context14.stop();
5127
+ return _context15.stop();
5065
5128
  }
5066
- }, _callee14, null, [[0, 12]]);
5129
+ }, _callee15, null, [[0, 12]]);
5067
5130
  })));
5068
5131
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
5069
5132
  return _util.default.joinMeetingOptions(this, {
@@ -5153,10 +5216,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5153
5216
  }, {
5154
5217
  key: "createMediaConnection",
5155
5218
  value: function () {
5156
- var _createMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(turnServerInfo, bundlePolicy) {
5219
+ var _createMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(turnServerInfo, bundlePolicy) {
5157
5220
  var mc, audioEnabled, videoEnabled, shareEnabled;
5158
- return _regenerator.default.wrap(function _callee15$(_context15) {
5159
- while (1) switch (_context15.prev = _context15.next) {
5221
+ return _regenerator.default.wrap(function _callee16$(_context16) {
5222
+ while (1) switch (_context16.prev = _context16.next) {
5160
5223
  case 0:
5161
5224
  mc = _media.default.createMediaConnection(this.isMultistream, this.getMediaConnectionDebugId(),
5162
5225
  // @ts-ignore
@@ -5182,39 +5245,39 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5182
5245
 
5183
5246
  // publish the streams
5184
5247
  if (!this.mediaProperties.audioStream) {
5185
- _context15.next = 7;
5248
+ _context16.next = 7;
5186
5249
  break;
5187
5250
  }
5188
- _context15.next = 7;
5251
+ _context16.next = 7;
5189
5252
  return this.publishStream(_internalMediaCore.MediaType.AudioMain, this.mediaProperties.audioStream);
5190
5253
  case 7:
5191
5254
  if (!this.mediaProperties.videoStream) {
5192
- _context15.next = 10;
5255
+ _context16.next = 10;
5193
5256
  break;
5194
5257
  }
5195
- _context15.next = 10;
5258
+ _context16.next = 10;
5196
5259
  return this.publishStream(_internalMediaCore.MediaType.VideoMain, this.mediaProperties.videoStream);
5197
5260
  case 10:
5198
5261
  if (!this.mediaProperties.shareVideoStream) {
5199
- _context15.next = 13;
5262
+ _context16.next = 13;
5200
5263
  break;
5201
5264
  }
5202
- _context15.next = 13;
5265
+ _context16.next = 13;
5203
5266
  return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
5204
5267
  case 13:
5205
5268
  if (!(this.isMultistream && this.mediaProperties.shareAudioStream)) {
5206
- _context15.next = 16;
5269
+ _context16.next = 16;
5207
5270
  break;
5208
5271
  }
5209
- _context15.next = 16;
5272
+ _context16.next = 16;
5210
5273
  return this.publishStream(_internalMediaCore.MediaType.AudioSlides, this.mediaProperties.shareAudioStream);
5211
5274
  case 16:
5212
- return _context15.abrupt("return", mc);
5275
+ return _context16.abrupt("return", mc);
5213
5276
  case 17:
5214
5277
  case "end":
5215
- return _context15.stop();
5278
+ return _context16.stop();
5216
5279
  }
5217
- }, _callee15, this);
5280
+ }, _callee16, this);
5218
5281
  }));
5219
5282
  function createMediaConnection(_x10, _x11) {
5220
5283
  return _createMediaConnection.apply(this, arguments);
@@ -5362,36 +5425,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5362
5425
  return _promise.default.all(promises).then(function () {
5363
5426
  return _this39.roap.doTurnDiscovery(_this39, false);
5364
5427
  }).then( /*#__PURE__*/function () {
5365
- var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(turnDiscoveryObject) {
5428
+ var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(turnDiscoveryObject) {
5366
5429
  var turnServerInfo, mc;
5367
- return _regenerator.default.wrap(function _callee16$(_context16) {
5368
- while (1) switch (_context16.prev = _context16.next) {
5430
+ return _regenerator.default.wrap(function _callee17$(_context17) {
5431
+ while (1) switch (_context17.prev = _context17.next) {
5369
5432
  case 0:
5370
5433
  turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
5371
5434
  turnServerUsed = !turnDiscoverySkippedReason;
5372
5435
  turnServerInfo = turnDiscoveryObject.turnServerInfo;
5373
- _context16.next = 5;
5436
+ _context17.next = 5;
5374
5437
  return _this39.createMediaConnection(turnServerInfo, bundlePolicy);
5375
5438
  case 5:
5376
- mc = _context16.sent;
5439
+ mc = _context17.sent;
5377
5440
  if (!_this39.isMultistream) {
5378
- _context16.next = 13;
5441
+ _context17.next = 13;
5379
5442
  break;
5380
5443
  }
5381
5444
  _this39.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this39.receiveSlotManager, _this39.mediaRequestManagers, remoteMediaManagerConfig);
5382
5445
  _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5383
5446
  _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
5384
5447
  _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
5385
- _context16.next = 13;
5448
+ _context17.next = 13;
5386
5449
  return _this39.remoteMediaManager.start();
5387
5450
  case 13:
5388
- _context16.next = 15;
5451
+ _context17.next = 15;
5389
5452
  return mc.initiateOffer();
5390
5453
  case 15:
5391
5454
  case "end":
5392
- return _context16.stop();
5455
+ return _context17.stop();
5393
5456
  }
5394
- }, _callee16);
5457
+ }, _callee17);
5395
5458
  }));
5396
5459
  return function (_x12) {
5397
5460
  return _ref23.apply(this, arguments);
@@ -5597,35 +5660,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5597
5660
  * @memberof Meeting
5598
5661
  */
5599
5662
  function () {
5600
- var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(options) {
5663
+ var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(options) {
5601
5664
  var audioEnabled, videoEnabled, shareAudioEnabled, shareVideoEnabled;
5602
- return _regenerator.default.wrap(function _callee17$(_context17) {
5603
- while (1) switch (_context17.prev = _context17.next) {
5665
+ return _regenerator.default.wrap(function _callee18$(_context18) {
5666
+ while (1) switch (_context18.prev = _context18.next) {
5604
5667
  case 0:
5605
5668
  this.checkMediaConnection();
5606
5669
  audioEnabled = options.audioEnabled, videoEnabled = options.videoEnabled, shareAudioEnabled = options.shareAudioEnabled, shareVideoEnabled = options.shareVideoEnabled;
5607
5670
  _loggerProxy.default.logger.log("Meeting:index#updateMedia --> called with options=".concat((0, _stringify.default)(options)));
5608
5671
  if (this.canUpdateMedia()) {
5609
- _context17.next = 5;
5672
+ _context18.next = 5;
5610
5673
  break;
5611
5674
  }
5612
- return _context17.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
5675
+ return _context18.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
5613
5676
  case 5:
5614
5677
  if (!this.isMultistream) {
5615
- _context17.next = 10;
5678
+ _context18.next = 10;
5616
5679
  break;
5617
5680
  }
5618
5681
  if (!(shareAudioEnabled !== undefined || shareVideoEnabled !== undefined)) {
5619
- _context17.next = 8;
5682
+ _context18.next = 8;
5620
5683
  break;
5621
5684
  }
5622
5685
  throw new Error('toggling shareAudioEnabled or shareVideoEnabled in a multistream meeting is not supported, to control receiving screen share call meeting.remoteMediaManager.setLayout() with appropriate layout');
5623
5686
  case 8:
5624
- _context17.next = 12;
5687
+ _context18.next = 12;
5625
5688
  break;
5626
5689
  case 10:
5627
5690
  if (!(shareAudioEnabled !== undefined)) {
5628
- _context17.next = 12;
5691
+ _context18.next = 12;
5629
5692
  break;
5630
5693
  }
5631
5694
  throw new Error('toggling shareAudioEnabled in a transcoded meeting is not supported as of now');
@@ -5650,18 +5713,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5650
5713
  this.mediaProperties.mediaDirection.receiveShare = !!(shareAudioEnabled || shareVideoEnabled);
5651
5714
  }
5652
5715
  if (this.isMultistream) {
5653
- _context17.next = 18;
5716
+ _context18.next = 18;
5654
5717
  break;
5655
5718
  }
5656
- _context17.next = 18;
5719
+ _context18.next = 18;
5657
5720
  return this.updateTranscodedMediaConnection();
5658
5721
  case 18:
5659
- return _context17.abrupt("return", undefined);
5722
+ return _context18.abrupt("return", undefined);
5660
5723
  case 19:
5661
5724
  case "end":
5662
- return _context17.stop();
5725
+ return _context18.stop();
5663
5726
  }
5664
- }, _callee17, this);
5727
+ }, _callee18, this);
5665
5728
  }));
5666
5729
  function updateMedia(_x13) {
5667
5730
  return _updateMedia.apply(this, arguments);
@@ -6572,37 +6635,37 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6572
6635
  }, {
6573
6636
  key: "enableMusicMode",
6574
6637
  value: function () {
6575
- var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(shouldEnableMusicMode) {
6576
- return _regenerator.default.wrap(function _callee18$(_context18) {
6577
- while (1) switch (_context18.prev = _context18.next) {
6638
+ var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(shouldEnableMusicMode) {
6639
+ return _regenerator.default.wrap(function _callee19$(_context19) {
6640
+ while (1) switch (_context19.prev = _context19.next) {
6578
6641
  case 0:
6579
6642
  this.checkMediaConnection();
6580
6643
  if (this.isMultistream) {
6581
- _context18.next = 3;
6644
+ _context19.next = 3;
6582
6645
  break;
6583
6646
  }
6584
6647
  throw new Error('enableMusicMode() only supported with multistream');
6585
6648
  case 3:
6586
6649
  if (!shouldEnableMusicMode) {
6587
- _context18.next = 8;
6650
+ _context19.next = 8;
6588
6651
  break;
6589
6652
  }
6590
- _context18.next = 6;
6653
+ _context19.next = 6;
6591
6654
  return this.sendSlotManager.setCodecParameters(_internalMediaCore.MediaType.AudioMain, {
6592
6655
  maxaveragebitrate: '64000',
6593
6656
  maxplaybackrate: '48000'
6594
6657
  });
6595
6658
  case 6:
6596
- _context18.next = 10;
6659
+ _context19.next = 10;
6597
6660
  break;
6598
6661
  case 8:
6599
- _context18.next = 10;
6662
+ _context19.next = 10;
6600
6663
  return this.sendSlotManager.deleteCodecParameters(_internalMediaCore.MediaType.AudioMain, ['maxaveragebitrate', 'maxplaybackrate']);
6601
6664
  case 10:
6602
6665
  case "end":
6603
- return _context18.stop();
6666
+ return _context19.stop();
6604
6667
  }
6605
- }, _callee18, this);
6668
+ }, _callee19, this);
6606
6669
  }));
6607
6670
  function enableMusicMode(_x14) {
6608
6671
  return _enableMusicMode.apply(this, arguments);
@@ -6664,25 +6727,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6664
6727
  }, {
6665
6728
  key: "publishStream",
6666
6729
  value: function () {
6667
- var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(mediaType, stream) {
6668
- return _regenerator.default.wrap(function _callee19$(_context19) {
6669
- while (1) switch (_context19.prev = _context19.next) {
6730
+ var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(mediaType, stream) {
6731
+ return _regenerator.default.wrap(function _callee20$(_context20) {
6732
+ while (1) switch (_context20.prev = _context20.next) {
6670
6733
  case 0:
6671
6734
  if (stream) {
6672
- _context19.next = 2;
6735
+ _context20.next = 2;
6673
6736
  break;
6674
6737
  }
6675
- return _context19.abrupt("return");
6738
+ return _context20.abrupt("return");
6676
6739
  case 2:
6677
6740
  if (!this.mediaProperties.webrtcMediaConnection) {
6678
- _context19.next = 7;
6741
+ _context20.next = 7;
6679
6742
  break;
6680
6743
  }
6681
6744
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6682
- _context19.next = 6;
6745
+ _context20.next = 6;
6683
6746
  break;
6684
6747
  }
6685
- _context19.next = 6;
6748
+ _context20.next = 6;
6686
6749
  return this.sendSlotManager.publishStream(mediaType, stream);
6687
6750
  case 6:
6688
6751
  this.emitPublishStateChangeEvent({
@@ -6693,9 +6756,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6693
6756
  });
6694
6757
  case 7:
6695
6758
  case "end":
6696
- return _context19.stop();
6759
+ return _context20.stop();
6697
6760
  }
6698
- }, _callee19, this);
6761
+ }, _callee20, this);
6699
6762
  }));
6700
6763
  function publishStream(_x15, _x16) {
6701
6764
  return _publishStream.apply(this, arguments);
@@ -6712,21 +6775,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6712
6775
  }, {
6713
6776
  key: "unpublishStream",
6714
6777
  value: function () {
6715
- var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(mediaType, stream) {
6716
- return _regenerator.default.wrap(function _callee20$(_context20) {
6717
- while (1) switch (_context20.prev = _context20.next) {
6778
+ var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(mediaType, stream) {
6779
+ return _regenerator.default.wrap(function _callee21$(_context21) {
6780
+ while (1) switch (_context21.prev = _context21.next) {
6718
6781
  case 0:
6719
6782
  if (stream) {
6720
- _context20.next = 2;
6783
+ _context21.next = 2;
6721
6784
  break;
6722
6785
  }
6723
- return _context20.abrupt("return");
6786
+ return _context21.abrupt("return");
6724
6787
  case 2:
6725
6788
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6726
- _context20.next = 5;
6789
+ _context21.next = 5;
6727
6790
  break;
6728
6791
  }
6729
- _context20.next = 5;
6792
+ _context21.next = 5;
6730
6793
  return this.sendSlotManager.unpublishStream(mediaType);
6731
6794
  case 5:
6732
6795
  this.emitPublishStateChangeEvent({
@@ -6737,9 +6800,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6737
6800
  });
6738
6801
  case 6:
6739
6802
  case "end":
6740
- return _context20.stop();
6803
+ return _context21.stop();
6741
6804
  }
6742
- }, _callee20, this);
6805
+ }, _callee21, this);
6743
6806
  }));
6744
6807
  function unpublishStream(_x17, _x18) {
6745
6808
  return _unpublishStream.apply(this, arguments);
@@ -6755,70 +6818,70 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6755
6818
  }, {
6756
6819
  key: "publishStreams",
6757
6820
  value: function () {
6758
- var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(streams) {
6821
+ var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(streams) {
6759
6822
  var _streams$screenShare, _streams$screenShare2, _streams$screenShare3, _streams$screenShare4;
6760
6823
  var floorRequestNeeded, _streams$screenShare5;
6761
- return _regenerator.default.wrap(function _callee21$(_context21) {
6762
- while (1) switch (_context21.prev = _context21.next) {
6824
+ return _regenerator.default.wrap(function _callee22$(_context22) {
6825
+ while (1) switch (_context22.prev = _context22.next) {
6763
6826
  case 0:
6764
6827
  this.checkMediaConnection();
6765
6828
  if (!(!streams.microphone && !streams.camera && !((_streams$screenShare = streams.screenShare) !== null && _streams$screenShare !== void 0 && _streams$screenShare.audio) && !((_streams$screenShare2 = streams.screenShare) !== null && _streams$screenShare2 !== void 0 && _streams$screenShare2.video))) {
6766
- _context21.next = 3;
6829
+ _context22.next = 3;
6767
6830
  break;
6768
6831
  }
6769
- return _context21.abrupt("return");
6832
+ return _context22.abrupt("return");
6770
6833
  case 3:
6771
6834
  floorRequestNeeded = false; // Screenshare Audio is supported only in multi stream. So we check for screenshare audio presence only if it's a multi stream meeting
6772
6835
  if (!(this.isMultistream && (_streams$screenShare3 = streams.screenShare) !== null && _streams$screenShare3 !== void 0 && _streams$screenShare3.audio)) {
6773
- _context21.next = 8;
6836
+ _context22.next = 8;
6774
6837
  break;
6775
6838
  }
6776
- _context21.next = 7;
6839
+ _context22.next = 7;
6777
6840
  return this.setLocalShareAudioStream(streams.screenShare.audio);
6778
6841
  case 7:
6779
6842
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6780
6843
  case 8:
6781
6844
  if (!((_streams$screenShare4 = streams.screenShare) !== null && _streams$screenShare4 !== void 0 && _streams$screenShare4.video)) {
6782
- _context21.next = 12;
6845
+ _context22.next = 12;
6783
6846
  break;
6784
6847
  }
6785
- _context21.next = 11;
6848
+ _context22.next = 11;
6786
6849
  return this.setLocalShareVideoStream((_streams$screenShare5 = streams.screenShare) === null || _streams$screenShare5 === void 0 ? void 0 : _streams$screenShare5.video);
6787
6850
  case 11:
6788
6851
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6789
6852
  case 12:
6790
6853
  if (!streams.microphone) {
6791
- _context21.next = 15;
6854
+ _context22.next = 15;
6792
6855
  break;
6793
6856
  }
6794
- _context21.next = 15;
6857
+ _context22.next = 15;
6795
6858
  return this.setLocalAudioStream(streams.microphone);
6796
6859
  case 15:
6797
6860
  if (!streams.camera) {
6798
- _context21.next = 18;
6861
+ _context22.next = 18;
6799
6862
  break;
6800
6863
  }
6801
- _context21.next = 18;
6864
+ _context22.next = 18;
6802
6865
  return this.setLocalVideoStream(streams.camera);
6803
6866
  case 18:
6804
6867
  if (this.isMultistream) {
6805
- _context21.next = 21;
6868
+ _context22.next = 21;
6806
6869
  break;
6807
6870
  }
6808
- _context21.next = 21;
6871
+ _context22.next = 21;
6809
6872
  return this.updateTranscodedMediaConnection();
6810
6873
  case 21:
6811
6874
  if (!floorRequestNeeded) {
6812
- _context21.next = 24;
6875
+ _context22.next = 24;
6813
6876
  break;
6814
6877
  }
6815
- _context21.next = 24;
6878
+ _context22.next = 24;
6816
6879
  return this.enqueueScreenShareFloorRequest();
6817
6880
  case 24:
6818
6881
  case "end":
6819
- return _context21.stop();
6882
+ return _context22.stop();
6820
6883
  }
6821
- }, _callee21, this);
6884
+ }, _callee22, this);
6822
6885
  }));
6823
6886
  function publishStreams(_x19) {
6824
6887
  return _publishStreams.apply(this, arguments);
@@ -6834,10 +6897,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6834
6897
  }, {
6835
6898
  key: "unpublishStreams",
6836
6899
  value: function () {
6837
- var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(streams) {
6900
+ var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(streams) {
6838
6901
  var promises, _iterator, _step, stream;
6839
- return _regenerator.default.wrap(function _callee22$(_context22) {
6840
- while (1) switch (_context22.prev = _context22.next) {
6902
+ return _regenerator.default.wrap(function _callee23$(_context23) {
6903
+ while (1) switch (_context23.prev = _context23.next) {
6841
6904
  case 0:
6842
6905
  this.checkMediaConnection();
6843
6906
  promises = [];
@@ -6868,7 +6931,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6868
6931
  if (!this.isMultistream) {
6869
6932
  promises.push(this.updateTranscodedMediaConnection());
6870
6933
  }
6871
- _context22.next = 7;
6934
+ _context23.next = 7;
6872
6935
  return _promise.default.all(promises);
6873
6936
  case 7:
6874
6937
  // we're allowing for the SDK to support just audio share as well
@@ -6883,9 +6946,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6883
6946
  }
6884
6947
  case 8:
6885
6948
  case "end":
6886
- return _context22.stop();
6949
+ return _context23.stop();
6887
6950
  }
6888
- }, _callee22, this);
6951
+ }, _callee23, this);
6889
6952
  }));
6890
6953
  function unpublishStreams(_x20) {
6891
6954
  return _unpublishStreams.apply(this, arguments);
@@ -6914,6 +6977,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6914
6977
  // (permissionTokenExp is a epoch timestamp, not a time to live duration)
6915
6978
  return (permissionTokenExpValue - now) / 1000;
6916
6979
  }
6980
+
6981
+ /**
6982
+ * Check if there is enough time left till the permission token expires
6983
+ * If not - refresh the permission token
6984
+ *
6985
+ * @param {number} threshold - time in seconds
6986
+ * @param {string} reason - reason for refreshing the permission token
6987
+ * @returns {Promise<void>}
6988
+ */
6989
+ }, {
6990
+ key: "checkAndRefreshPermissionToken",
6991
+ value: function checkAndRefreshPermissionToken(threshold, reason) {
6992
+ var permissionTokenTimeLeft = this.getPermissionTokenTimeLeftInSec();
6993
+ if (permissionTokenTimeLeft !== undefined && permissionTokenTimeLeft <= threshold) {
6994
+ return this.refreshPermissionToken(reason);
6995
+ }
6996
+ return _promise.default.resolve();
6997
+ }
6917
6998
  }]);
6918
6999
  return Meeting;
6919
7000
  }(_webexCore.StatelessWebexPlugin);