@webex/plugin-meetings 3.0.0-beta.21 → 3.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,10 @@ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/o
7
7
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
8
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
9
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
10
+ var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
11
+ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
12
+ var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
13
+ var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
10
14
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
11
15
  _Object$defineProperty(exports, "__esModule", {
12
16
  value: true
@@ -45,7 +49,7 @@ var _index = _interopRequireDefault(require("../roap/index"));
45
49
  var _media = _interopRequireDefault(require("../media"));
46
50
  var _properties = _interopRequireDefault(require("../media/properties"));
47
51
  var _state = _interopRequireDefault(require("./state"));
48
- var _muteState = _interopRequireDefault(require("./muteState"));
52
+ var _muteState = require("./muteState");
49
53
  var _effectsState = _interopRequireDefault(require("./effectsState"));
50
54
  var _locusInfo = _interopRequireDefault(require("../locus-info"));
51
55
  var _metrics = _interopRequireDefault(require("../metrics"));
@@ -71,11 +75,13 @@ var _browserDetection = _interopRequireDefault(require("../common/browser-detect
71
75
  var _receiveSlotManager = require("../multistream/receiveSlotManager");
72
76
  var _mediaRequestManager = require("../multistream/mediaRequestManager");
73
77
  var _remoteMediaManager = require("../multistream/remoteMediaManager");
74
- var _multistreamMedia = require("../multistream/multistreamMedia");
75
78
  var _breakouts = _interopRequireDefault(require("../breakouts"));
76
79
  var _inMeetingActions = _interopRequireDefault(require("./in-meeting-actions"));
77
80
  var _constants3 = require("../reactions/constants");
78
81
  var _recordingController = _interopRequireDefault(require("../recording-controller"));
82
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
83
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
84
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
79
85
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
80
86
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
81
87
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -464,7 +470,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
464
470
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "keepAliveTimerId", void 0);
465
471
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastVideoLayoutInfo", void 0);
466
472
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusInfo", void 0);
467
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "media", void 0);
468
473
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaProperties", void 0);
469
474
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaRequestManagers", void 0);
470
475
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfoFailureReason", void 0);
@@ -1002,6 +1007,67 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1002
1007
  }
1003
1008
  }
1004
1009
  });
1010
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareTrackEnded", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
1011
+ return _regenerator.default.wrap(function _callee$(_context) {
1012
+ while (1) switch (_context.prev = _context.next) {
1013
+ case 0:
1014
+ if (!_this.wirelessShare) {
1015
+ _context.next = 4;
1016
+ break;
1017
+ }
1018
+ _this.leave({
1019
+ reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
1020
+ });
1021
+ _context.next = 21;
1022
+ break;
1023
+ case 4:
1024
+ if (!_this.isMultistream) {
1025
+ _context.next = 20;
1026
+ break;
1027
+ }
1028
+ _context.prev = 5;
1029
+ if (!_this.mediaProperties.mediaDirection.sendShare) {
1030
+ _context.next = 9;
1031
+ break;
1032
+ }
1033
+ _context.next = 9;
1034
+ return _this.releaseScreenShareFloor();
1035
+ case 9:
1036
+ _context.next = 14;
1037
+ break;
1038
+ case 11:
1039
+ _context.prev = 11;
1040
+ _context.t0 = _context["catch"](5);
1041
+ _loggerProxy.default.logger.log('Meeting:index#handleShareTrackEnded --> Error stopping share: ', _context.t0);
1042
+ case 14:
1043
+ _context.prev = 14;
1044
+ _this.setLocalShareTrack(null);
1045
+ _this.mediaProperties.mediaDirection.sendShare = false;
1046
+ return _context.finish(14);
1047
+ case 18:
1048
+ _context.next = 21;
1049
+ break;
1050
+ case 20:
1051
+ // Skip checking for a stable peerConnection
1052
+ // to allow immediately stopping screenshare
1053
+ _this.stopShare({
1054
+ skipSignalingCheck: true
1055
+ }).catch(function (error) {
1056
+ _loggerProxy.default.logger.log('Meeting:index#handleShareTrackEnded --> Error stopping share: ', error);
1057
+ });
1058
+ case 21:
1059
+ _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
1060
+ file: 'meeting/index',
1061
+ function: 'handleShareTrackEnded'
1062
+ }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
1063
+ type: _constants.EVENT_TYPES.LOCAL_SHARE
1064
+ });
1065
+ case 22:
1066
+ case "end":
1067
+ return _context.stop();
1068
+ }
1069
+ }, _callee, null, [[5, 11, 14, 18]]);
1070
+ })));
1005
1071
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearMeetingData", function () {
1006
1072
  _this.audio = null;
1007
1073
  _this.video = null;
@@ -1612,7 +1678,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1612
1678
  _this.setUpLocusInfoListeners();
1613
1679
  _this.locusInfo.init(attrs.locus ? attrs.locus : {});
1614
1680
  _this.hasJoinedOnce = false;
1615
- _this.media = new _multistreamMedia.MultistreamMedia((0, _assertThisInitialized2.default)(_this));
1616
1681
 
1617
1682
  /**
1618
1683
  * helper class for managing remote streams
@@ -1633,38 +1698,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1633
1698
  (0, _createClass2.default)(Meeting, [{
1634
1699
  key: "fetchMeetingInfo",
1635
1700
  value: function () {
1636
- var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref4) {
1637
- var _ref4$password, password, _ref4$captchaCode, captchaCode, captchaInfo, info, _err$body, _err$body2;
1638
- return _regenerator.default.wrap(function _callee$(_context) {
1639
- while (1) switch (_context.prev = _context.next) {
1701
+ var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref5) {
1702
+ var _ref5$password, password, _ref5$captchaCode, captchaCode, captchaInfo, info, _err$body, _err$body2;
1703
+ return _regenerator.default.wrap(function _callee2$(_context2) {
1704
+ while (1) switch (_context2.prev = _context2.next) {
1640
1705
  case 0:
1641
- _ref4$password = _ref4.password, password = _ref4$password === void 0 ? null : _ref4$password, _ref4$captchaCode = _ref4.captchaCode, captchaCode = _ref4$captchaCode === void 0 ? null : _ref4$captchaCode;
1706
+ _ref5$password = _ref5.password, password = _ref5$password === void 0 ? null : _ref5$password, _ref5$captchaCode = _ref5.captchaCode, captchaCode = _ref5$captchaCode === void 0 ? null : _ref5$captchaCode;
1642
1707
  // when fetch meeting info is called directly by the client, we want to clear out the random timer for sdk to do it
1643
1708
  if (this.fetchMeetingInfoTimeoutId) {
1644
1709
  clearTimeout(this.fetchMeetingInfoTimeoutId);
1645
1710
  this.fetchMeetingInfoTimeoutId = undefined;
1646
1711
  }
1647
1712
  if (!(captchaCode && !this.requiredCaptcha)) {
1648
- _context.next = 4;
1713
+ _context2.next = 4;
1649
1714
  break;
1650
1715
  }
1651
- return _context.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with captchaCode when captcha was not required')));
1716
+ return _context2.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with captchaCode when captcha was not required')));
1652
1717
  case 4:
1653
1718
  if (!(password && this.passwordStatus !== _constants.PASSWORD_STATUS.REQUIRED && this.passwordStatus !== _constants.PASSWORD_STATUS.UNKNOWN)) {
1654
- _context.next = 6;
1719
+ _context2.next = 6;
1655
1720
  break;
1656
1721
  }
1657
- return _context.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with password when password was not required')));
1722
+ return _context2.abrupt("return", _promise.default.reject(new Error('fetchMeetingInfo() called with password when password was not required')));
1658
1723
  case 6:
1659
- _context.prev = 6;
1724
+ _context2.prev = 6;
1660
1725
  captchaInfo = captchaCode ? {
1661
1726
  code: captchaCode,
1662
1727
  id: this.requiredCaptcha.captchaId
1663
1728
  } : null;
1664
- _context.next = 10;
1729
+ _context2.next = 10;
1665
1730
  return this.attrs.meetingInfoProvider.fetchMeetingInfo(this.destination, this.destinationType, password, captchaInfo);
1666
1731
  case 10:
1667
- info = _context.sent;
1732
+ info = _context2.sent;
1668
1733
  this.parseMeetingInfo(info, this.destination);
1669
1734
  this.meetingInfo = info ? info.body : null;
1670
1735
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.NONE;
@@ -1678,53 +1743,53 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1678
1743
  file: 'meetings',
1679
1744
  function: 'fetchMeetingInfo'
1680
1745
  }, _constants.EVENT_TRIGGERS.MEETING_INFO_AVAILABLE);
1681
- return _context.abrupt("return", _promise.default.resolve());
1746
+ return _context2.abrupt("return", _promise.default.resolve());
1682
1747
  case 20:
1683
- _context.prev = 20;
1684
- _context.t0 = _context["catch"](6);
1685
- if (!(_context.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
1686
- _context.next = 33;
1748
+ _context2.prev = 20;
1749
+ _context2.t0 = _context2["catch"](6);
1750
+ if (!(_context2.t0 instanceof _meetingInfoV.MeetingInfoV2PasswordError)) {
1751
+ _context2.next = 33;
1687
1752
  break;
1688
1753
  }
1689
1754
  _loggerProxy.default.logger.info( // @ts-ignore
1690
- "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - password required (code=").concat(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_err$body = _context.t0.body) === null || _err$body === void 0 ? void 0 : _err$body.code, ")."));
1755
+ "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - password required (code=").concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_err$body = _context2.t0.body) === null || _err$body === void 0 ? void 0 : _err$body.code, ")."));
1691
1756
 
1692
1757
  // when wbxappapi requires password it still populates partial meeting info in the response
1693
- if (_context.t0.meetingInfo) {
1694
- this.meetingInfo = _context.t0.meetingInfo;
1695
- this.meetingNumber = _context.t0.meetingInfo.meetingNumber;
1758
+ if (_context2.t0.meetingInfo) {
1759
+ this.meetingInfo = _context2.t0.meetingInfo;
1760
+ this.meetingNumber = _context2.t0.meetingInfo.meetingNumber;
1696
1761
  }
1697
1762
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1698
1763
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1699
1764
  if (!this.requiredCaptcha) {
1700
- _context.next = 30;
1765
+ _context2.next = 30;
1701
1766
  break;
1702
1767
  }
1703
- _context.next = 30;
1768
+ _context2.next = 30;
1704
1769
  return this.refreshCaptcha();
1705
1770
  case 30:
1706
1771
  throw new _passwordError.default();
1707
1772
  case 33:
1708
- if (!(_context.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
1709
- _context.next = 41;
1773
+ if (!(_context2.t0 instanceof _meetingInfoV.MeetingInfoV2CaptchaError)) {
1774
+ _context2.next = 41;
1710
1775
  break;
1711
1776
  }
1712
1777
  _loggerProxy.default.logger.info( // @ts-ignore
1713
- "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - captcha required (code=").concat(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_err$body2 = _context.t0.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.code, ")."));
1778
+ "Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ".concat(this.destination, " - captcha required (code=").concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_err$body2 = _context2.t0.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.code, ")."));
1714
1779
  this.meetingInfoFailureReason = this.requiredCaptcha ? _constants.MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA : _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
1715
- if (_context.t0.isPasswordRequired) {
1780
+ if (_context2.t0.isPasswordRequired) {
1716
1781
  this.passwordStatus = _constants.PASSWORD_STATUS.REQUIRED;
1717
1782
  }
1718
- this.requiredCaptcha = _context.t0.captchaInfo;
1783
+ this.requiredCaptcha = _context2.t0.captchaInfo;
1719
1784
  throw new _captchaError.default();
1720
1785
  case 41:
1721
1786
  this.meetingInfoFailureReason = _constants.MEETING_INFO_FAILURE_REASON.OTHER;
1722
- throw _context.t0;
1787
+ throw _context2.t0;
1723
1788
  case 43:
1724
1789
  case "end":
1725
- return _context.stop();
1790
+ return _context2.stop();
1726
1791
  }
1727
- }, _callee, this, [[6, 20]]);
1792
+ }, _callee2, this, [[6, 20]]);
1728
1793
  }));
1729
1794
  function fetchMeetingInfo(_x) {
1730
1795
  return _fetchMeetingInfo.apply(this, arguments);
@@ -2253,10 +2318,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2253
2318
  key: "setupLocusControlsListener",
2254
2319
  value: function setupLocusControlsListener() {
2255
2320
  var _this12 = this;
2256
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref5) {
2257
- var state = _ref5.state,
2258
- modifiedBy = _ref5.modifiedBy,
2259
- lastModified = _ref5.lastModified;
2321
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, function (_ref6) {
2322
+ var state = _ref6.state,
2323
+ modifiedBy = _ref6.modifiedBy,
2324
+ lastModified = _ref6.lastModified;
2260
2325
  var event;
2261
2326
  switch (state) {
2262
2327
  case _constants.RECORDING_STATE.RECORDING:
@@ -2287,8 +2352,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2287
2352
  function: 'setupLocusControlsListener'
2288
2353
  }, event, _this12.recording);
2289
2354
  });
2290
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref6) {
2291
- var meetingContainerUrl = _ref6.meetingContainerUrl;
2355
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_CONTAINER_UPDATED, function (_ref7) {
2356
+ var meetingContainerUrl = _ref7.meetingContainerUrl;
2292
2357
  _triggerProxy.default.trigger(_this12, {
2293
2358
  file: 'meeting/index',
2294
2359
  function: 'setupLocusControlsListener'
@@ -2296,9 +2361,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2296
2361
  meetingContainerUrl: meetingContainerUrl
2297
2362
  });
2298
2363
  });
2299
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIBE_UPDATED, function (_ref7) {
2300
- var caption = _ref7.caption,
2301
- transcribing = _ref7.transcribing;
2364
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIBE_UPDATED, function (_ref8) {
2365
+ var caption = _ref8.caption,
2366
+ transcribing = _ref8.transcribing;
2302
2367
  // @ts-ignore - config coming from registerPlugin
2303
2368
  if (transcribing && _this12.transcription && _this12.config.receiveTranscription) {
2304
2369
  _this12.receiveTranscription();
@@ -2312,16 +2377,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2312
2377
  });
2313
2378
  }
2314
2379
  });
2315
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref8) {
2316
- var breakout = _ref8.breakout;
2380
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED, function (_ref9) {
2381
+ var breakout = _ref9.breakout;
2317
2382
  _this12.breakouts.updateBreakout(breakout);
2318
2383
  _triggerProxy.default.trigger(_this12, {
2319
2384
  file: 'meeting/index',
2320
2385
  function: 'setupLocusControlsListener'
2321
2386
  }, _constants.EVENT_TRIGGERS.MEETING_BREAKOUTS_UPDATE);
2322
2387
  });
2323
- this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref9) {
2324
- var entryExitTone = _ref9.entryExitTone;
2388
+ this.locusInfo.on(_constants.LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED, function (_ref10) {
2389
+ var entryExitTone = _ref10.entryExitTone;
2325
2390
  _triggerProxy.default.trigger(_this12, {
2326
2391
  file: 'meeting/index',
2327
2392
  function: 'setupLocusControlsListener'
@@ -2344,91 +2409,122 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2344
2409
  value: function setUpLocusMediaSharesListener() {
2345
2410
  var _this13 = this;
2346
2411
  // Will get triggered on local and remote share
2347
- this.locusInfo.on(_constants.EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES, function (payload) {
2348
- var _payload$previous, _payload$previous2;
2349
- var _payload$current = payload.current,
2350
- contentShare = _payload$current.content,
2351
- whiteboardShare = _payload$current.whiteboard;
2352
- var previousContentShare = (_payload$previous = payload.previous) === null || _payload$previous === void 0 ? void 0 : _payload$previous.content;
2353
- var previousWhiteboardShare = (_payload$previous2 = payload.previous) === null || _payload$previous2 === void 0 ? void 0 : _payload$previous2.whiteboard;
2354
- if (contentShare.beneficiaryId === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.beneficiaryId) && contentShare.disposition === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.disposition) && whiteboardShare.beneficiaryId === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.beneficiaryId) && whiteboardShare.disposition === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.disposition) && whiteboardShare.resourceUrl === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.resourceUrl)) {
2355
- // nothing changed, so ignore
2356
- // (this happens when we steal presentation from remote)
2357
- return;
2358
- }
2359
- var newShareStatus = _this13.shareStatus;
2360
-
2361
- // REMOTE - check if remote started sharing
2362
- if (_this13.selfId !== contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2363
- // CONTENT - sharing content remote
2364
- newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2365
- }
2366
- // LOCAL - check if we started sharing content
2367
- else if (_this13.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2368
- var _this13$mediaProperti;
2369
- if (((_this13$mediaProperti = _this13.mediaProperties.shareTrack) === null || _this13$mediaProperti === void 0 ? void 0 : _this13$mediaProperti.readyState) === 'ended') {
2370
- _this13.stopShare({
2371
- skipSignalingCheck: true
2372
- }).catch(function (error) {
2373
- _loggerProxy.default.logger.log('Meeting:index#setUpLocusMediaSharesListener --> Error stopping share: ', error);
2374
- });
2375
- } else {
2376
- // CONTENT - sharing content local
2377
- newShareStatus = _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE;
2378
- }
2379
- }
2380
- // If we did not hit the cases above, no one is sharng content, so we check if we are sharing whiteboard
2381
- // There is no concept of local/remote share for whiteboard
2382
- // It does not matter who requested to share the whiteboard, everyone gets the same view
2383
- else if (whiteboardShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2384
- // WHITEBOARD - sharing whiteboard
2385
- newShareStatus = _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE;
2386
- }
2387
- // or if content share is either released or null and whiteboard share is either released or null, no one is sharing
2388
- else if ((previousContentShare && contentShare.disposition === _constants.FLOOR_ACTION.RELEASED || contentShare.disposition === null) && (previousWhiteboardShare && whiteboardShare.disposition === _constants.FLOOR_ACTION.RELEASED || whiteboardShare.disposition === null)) {
2389
- newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
2390
- }
2391
- if (newShareStatus !== _this13.shareStatus) {
2392
- var oldShareStatus = _this13.shareStatus;
2393
-
2394
- // update our state before we send out any notifications
2395
- _this13.shareStatus = newShareStatus;
2396
-
2397
- // send out "stop" notifications for the old state
2398
- switch (oldShareStatus) {
2399
- case _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE:
2400
- _triggerProxy.default.trigger(_this13, {
2401
- file: 'meetings/index',
2402
- function: 'remoteShare'
2403
- }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_REMOTE);
2404
- break;
2405
- case _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE:
2406
- _triggerProxy.default.trigger(_this13, {
2407
- file: 'meeting/index',
2408
- function: 'localShare'
2409
- }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2410
- reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2411
- });
2412
- break;
2413
- case _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE:
2414
- _triggerProxy.default.trigger(_this13, {
2415
- file: 'meeting/index',
2416
- function: 'stopWhiteboardShare'
2417
- }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_WHITEBOARD);
2418
- break;
2419
- case _constants.SHARE_STATUS.NO_SHARE:
2420
- // nothing to do
2421
- break;
2422
- default:
2423
- break;
2424
- }
2412
+ this.locusInfo.on(_constants.EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES, /*#__PURE__*/function () {
2413
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(payload) {
2414
+ var _payload$previous, _payload$previous2;
2415
+ var _payload$current, contentShare, whiteboardShare, previousContentShare, previousWhiteboardShare, newShareStatus, _this13$mediaProperti, oldShareStatus, sendStartedSharingRemote, _this13$mediaProperti2;
2416
+ return _regenerator.default.wrap(function _callee3$(_context3) {
2417
+ while (1) switch (_context3.prev = _context3.next) {
2418
+ case 0:
2419
+ _payload$current = payload.current, contentShare = _payload$current.content, whiteboardShare = _payload$current.whiteboard;
2420
+ previousContentShare = (_payload$previous = payload.previous) === null || _payload$previous === void 0 ? void 0 : _payload$previous.content;
2421
+ previousWhiteboardShare = (_payload$previous2 = payload.previous) === null || _payload$previous2 === void 0 ? void 0 : _payload$previous2.whiteboard;
2422
+ if (!(contentShare.beneficiaryId === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.beneficiaryId) && contentShare.disposition === (previousContentShare === null || previousContentShare === void 0 ? void 0 : previousContentShare.disposition) && whiteboardShare.beneficiaryId === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.beneficiaryId) && whiteboardShare.disposition === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.disposition) && whiteboardShare.resourceUrl === (previousWhiteboardShare === null || previousWhiteboardShare === void 0 ? void 0 : previousWhiteboardShare.resourceUrl))) {
2423
+ _context3.next = 5;
2424
+ break;
2425
+ }
2426
+ return _context3.abrupt("return");
2427
+ case 5:
2428
+ newShareStatus = _this13.shareStatus; // REMOTE - check if remote started sharing
2429
+ if (!(_this13.selfId !== contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED)) {
2430
+ _context3.next = 10;
2431
+ break;
2432
+ }
2433
+ // CONTENT - sharing content remote
2434
+ newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2435
+ _context3.next = 31;
2436
+ break;
2437
+ case 10:
2438
+ if (!(_this13.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED)) {
2439
+ _context3.next = 30;
2440
+ break;
2441
+ }
2442
+ if (!(((_this13$mediaProperti = _this13.mediaProperties.shareTrack) === null || _this13$mediaProperti === void 0 ? void 0 : _this13$mediaProperti.readyState) === 'ended')) {
2443
+ _context3.next = 27;
2444
+ break;
2445
+ }
2446
+ _context3.prev = 12;
2447
+ if (!_this13.isMultistream) {
2448
+ _context3.next = 18;
2449
+ break;
2450
+ }
2451
+ _context3.next = 16;
2452
+ return _this13.unpublishTracks([_this13.mediaProperties.shareTrack]);
2453
+ case 16:
2454
+ _context3.next = 20;
2455
+ break;
2456
+ case 18:
2457
+ _context3.next = 20;
2458
+ return _this13.stopShare({
2459
+ skipSignalingCheck: true
2460
+ });
2461
+ case 20:
2462
+ _context3.next = 25;
2463
+ break;
2464
+ case 22:
2465
+ _context3.prev = 22;
2466
+ _context3.t0 = _context3["catch"](12);
2467
+ _loggerProxy.default.logger.log('Meeting:index#setUpLocusMediaSharesListener --> Error stopping share: ', _context3.t0);
2468
+ case 25:
2469
+ _context3.next = 28;
2470
+ break;
2471
+ case 27:
2472
+ // CONTENT - sharing content local
2473
+ newShareStatus = _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE;
2474
+ case 28:
2475
+ _context3.next = 31;
2476
+ break;
2477
+ case 30:
2478
+ if (whiteboardShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2479
+ // WHITEBOARD - sharing whiteboard
2480
+ newShareStatus = _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE;
2481
+ }
2482
+ // or if content share is either released or null and whiteboard share is either released or null, no one is sharing
2483
+ else if ((previousContentShare && contentShare.disposition === _constants.FLOOR_ACTION.RELEASED || contentShare.disposition === null) && (previousWhiteboardShare && whiteboardShare.disposition === _constants.FLOOR_ACTION.RELEASED || whiteboardShare.disposition === null)) {
2484
+ newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
2485
+ }
2486
+ case 31:
2487
+ if (!(newShareStatus !== _this13.shareStatus)) {
2488
+ _context3.next = 73;
2489
+ break;
2490
+ }
2491
+ oldShareStatus = _this13.shareStatus; // update our state before we send out any notifications
2492
+ _this13.shareStatus = newShareStatus;
2425
2493
 
2426
- // send "start" notifications for the new state
2427
- switch (newShareStatus) {
2428
- case _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE:
2429
- {
2430
- var _this13$mediaProperti2;
2431
- var sendStartedSharingRemote = function sendStartedSharingRemote() {
2494
+ // send out "stop" notifications for the old state
2495
+ _context3.t1 = oldShareStatus;
2496
+ _context3.next = _context3.t1 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 37 : _context3.t1 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 39 : _context3.t1 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 41 : _context3.t1 === _constants.SHARE_STATUS.NO_SHARE ? 43 : 44;
2497
+ break;
2498
+ case 37:
2499
+ _triggerProxy.default.trigger(_this13, {
2500
+ file: 'meetings/index',
2501
+ function: 'remoteShare'
2502
+ }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_REMOTE);
2503
+ return _context3.abrupt("break", 45);
2504
+ case 39:
2505
+ _triggerProxy.default.trigger(_this13, {
2506
+ file: 'meeting/index',
2507
+ function: 'localShare'
2508
+ }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2509
+ reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2510
+ });
2511
+ return _context3.abrupt("break", 45);
2512
+ case 41:
2513
+ _triggerProxy.default.trigger(_this13, {
2514
+ file: 'meeting/index',
2515
+ function: 'stopWhiteboardShare'
2516
+ }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_WHITEBOARD);
2517
+ return _context3.abrupt("break", 45);
2518
+ case 43:
2519
+ return _context3.abrupt("break", 45);
2520
+ case 44:
2521
+ return _context3.abrupt("break", 45);
2522
+ case 45:
2523
+ _context3.t2 = newShareStatus;
2524
+ _context3.next = _context3.t2 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 48 : _context3.t2 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 62 : _context3.t2 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 65 : _context3.t2 === _constants.SHARE_STATUS.NO_SHARE ? 68 : 69;
2525
+ break;
2526
+ case 48:
2527
+ sendStartedSharingRemote = function sendStartedSharingRemote() {
2432
2528
  _triggerProxy.default.trigger(_this13, {
2433
2529
  file: 'meetings/index',
2434
2530
  function: 'remoteShare'
@@ -2436,77 +2532,100 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2436
2532
  memberId: contentShare.beneficiaryId
2437
2533
  });
2438
2534
  };
2439
-
2440
- // if a remote participant is stealing the presentation from us
2441
- if (!((_this13$mediaProperti2 = _this13.mediaProperties.mediaDirection) !== null && _this13$mediaProperti2 !== void 0 && _this13$mediaProperti2.sendShare) || oldShareStatus === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE) {
2442
- sendStartedSharingRemote();
2443
- } else {
2444
- _this13.updateShare({
2445
- sendShare: false,
2446
- receiveShare: _this13.mediaProperties.mediaDirection.receiveShare
2447
- }).finally(function () {
2448
- sendStartedSharingRemote();
2449
- });
2535
+ _context3.prev = 49;
2536
+ if (!((_this13$mediaProperti2 = _this13.mediaProperties.mediaDirection) !== null && _this13$mediaProperti2 !== void 0 && _this13$mediaProperti2.sendShare && oldShareStatus === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE)) {
2537
+ _context3.next = 58;
2538
+ break;
2539
+ }
2540
+ if (!_this13.isMultistream) {
2541
+ _context3.next = 56;
2542
+ break;
2450
2543
  }
2544
+ _context3.next = 54;
2545
+ return _this13.unpublishTracks([_this13.mediaProperties.shareTrack]);
2546
+ case 54:
2547
+ _context3.next = 58;
2451
2548
  break;
2452
- }
2453
- case _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE:
2454
- _triggerProxy.default.trigger(_this13, {
2455
- file: 'meeting/index',
2456
- function: 'share'
2457
- }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_LOCAL);
2458
- _metrics.default.postEvent({
2459
- event: _config.eventType.LOCAL_SHARE_FLOOR_GRANTED,
2460
- meeting: _this13
2461
- });
2462
- break;
2463
- case _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE:
2464
- _triggerProxy.default.trigger(_this13, {
2465
- file: 'meeting/index',
2466
- function: 'startWhiteboardShare'
2467
- }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_WHITEBOARD, {
2468
- resourceUrl: whiteboardShare.resourceUrl,
2469
- memberId: whiteboardShare.beneficiaryId
2470
- });
2471
- _metrics.default.postEvent({
2472
- event: _config.eventType.WHITEBOARD_SHARE_FLOOR_GRANTED,
2473
- meeting: _this13
2474
- });
2475
- break;
2476
- case _constants.SHARE_STATUS.NO_SHARE:
2477
- // nothing to do
2478
- break;
2479
- default:
2480
- break;
2481
- }
2482
- _this13.members.locusMediaSharesUpdate(payload);
2483
- } else if (newShareStatus === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE) {
2484
- // if we got here, then some remote participant has stolen
2485
- // the presentation from another remote participant
2486
- _triggerProxy.default.trigger(_this13, {
2487
- file: 'meetings/index',
2488
- function: 'remoteShare'
2489
- }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2490
- memberId: contentShare.beneficiaryId
2491
- });
2492
- _this13.members.locusMediaSharesUpdate(payload);
2493
- } else if (newShareStatus === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE) {
2494
- // if we got here, then some remote participant has stolen
2495
- // the presentation from another remote participant
2496
- _triggerProxy.default.trigger(_this13, {
2497
- file: 'meeting/index',
2498
- function: 'startWhiteboardShare'
2499
- }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_WHITEBOARD, {
2500
- resourceUrl: whiteboardShare.resourceUrl,
2501
- memberId: whiteboardShare.beneficiaryId
2502
- });
2503
- _metrics.default.postEvent({
2504
- event: _config.eventType.WHITEBOARD_SHARE_FLOOR_GRANTED,
2505
- meeting: _this13
2506
- });
2507
- _this13.members.locusMediaSharesUpdate(payload);
2508
- }
2509
- });
2549
+ case 56:
2550
+ _context3.next = 58;
2551
+ return _this13.updateShare({
2552
+ sendShare: false,
2553
+ receiveShare: _this13.mediaProperties.mediaDirection.receiveShare
2554
+ });
2555
+ case 58:
2556
+ _context3.prev = 58;
2557
+ sendStartedSharingRemote();
2558
+ return _context3.finish(58);
2559
+ case 61:
2560
+ return _context3.abrupt("break", 70);
2561
+ case 62:
2562
+ _triggerProxy.default.trigger(_this13, {
2563
+ file: 'meeting/index',
2564
+ function: 'share'
2565
+ }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_LOCAL);
2566
+ _metrics.default.postEvent({
2567
+ event: _config.eventType.LOCAL_SHARE_FLOOR_GRANTED,
2568
+ meeting: _this13
2569
+ });
2570
+ return _context3.abrupt("break", 70);
2571
+ case 65:
2572
+ _triggerProxy.default.trigger(_this13, {
2573
+ file: 'meeting/index',
2574
+ function: 'startWhiteboardShare'
2575
+ }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_WHITEBOARD, {
2576
+ resourceUrl: whiteboardShare.resourceUrl,
2577
+ memberId: whiteboardShare.beneficiaryId
2578
+ });
2579
+ _metrics.default.postEvent({
2580
+ event: _config.eventType.WHITEBOARD_SHARE_FLOOR_GRANTED,
2581
+ meeting: _this13
2582
+ });
2583
+ return _context3.abrupt("break", 70);
2584
+ case 68:
2585
+ return _context3.abrupt("break", 70);
2586
+ case 69:
2587
+ return _context3.abrupt("break", 70);
2588
+ case 70:
2589
+ _this13.members.locusMediaSharesUpdate(payload);
2590
+ _context3.next = 74;
2591
+ break;
2592
+ case 73:
2593
+ if (newShareStatus === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE) {
2594
+ // if we got here, then some remote participant has stolen
2595
+ // the presentation from another remote participant
2596
+ _triggerProxy.default.trigger(_this13, {
2597
+ file: 'meetings/index',
2598
+ function: 'remoteShare'
2599
+ }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_REMOTE, {
2600
+ memberId: contentShare.beneficiaryId
2601
+ });
2602
+ _this13.members.locusMediaSharesUpdate(payload);
2603
+ } else if (newShareStatus === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE) {
2604
+ // if we got here, then some remote participant has stolen
2605
+ // the presentation from another remote participant
2606
+ _triggerProxy.default.trigger(_this13, {
2607
+ file: 'meeting/index',
2608
+ function: 'startWhiteboardShare'
2609
+ }, _constants.EVENT_TRIGGERS.MEETING_STARTED_SHARING_WHITEBOARD, {
2610
+ resourceUrl: whiteboardShare.resourceUrl,
2611
+ memberId: whiteboardShare.beneficiaryId
2612
+ });
2613
+ _metrics.default.postEvent({
2614
+ event: _config.eventType.WHITEBOARD_SHARE_FLOOR_GRANTED,
2615
+ meeting: _this13
2616
+ });
2617
+ _this13.members.locusMediaSharesUpdate(payload);
2618
+ }
2619
+ case 74:
2620
+ case "end":
2621
+ return _context3.stop();
2622
+ }
2623
+ }, _callee3, null, [[12, 22], [49,, 58, 61]]);
2624
+ }));
2625
+ return function (_x2) {
2626
+ return _ref11.apply(this, arguments);
2627
+ };
2628
+ }());
2510
2629
  }
2511
2630
 
2512
2631
  /**
@@ -3320,6 +3439,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3320
3439
  _loggerProxy.default.logger.log('Meeting:index#setLocalAudioTrack --> Audio settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.audio));
3321
3440
  this.mediaProperties.setLocalAudioTrack(audioTrack);
3322
3441
  if (this.audio) this.audio.applyClientStateLocally(this);
3442
+ } else {
3443
+ this.mediaProperties.setLocalAudioTrack(null);
3323
3444
  }
3324
3445
  if (emitEvent) {
3325
3446
  this.sendLocalMediaReadyEvent();
@@ -3363,6 +3484,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3363
3484
  this.mediaProperties.setVideoDeviceId(deviceId);
3364
3485
  }
3365
3486
  _loggerProxy.default.logger.log('Meeting:index#setLocalVideoTrack --> Video settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.video));
3487
+ } else {
3488
+ this.mediaProperties.setLocalVideoTrack(null);
3366
3489
  }
3367
3490
  if (emitEvent) {
3368
3491
  this.sendLocalMediaReadyEvent();
@@ -3391,41 +3514,38 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3391
3514
 
3392
3515
  /**
3393
3516
  * Sets the local media stream on the class and emits an event to the developer
3394
- * @param {MediaStream} localShare the local media stream
3517
+ * @param {MediaStreamTrack} localShareTrack the local media stream
3395
3518
  * @returns {undefined}
3396
3519
  * @public
3397
3520
  * @memberof Meeting
3398
3521
  */
3399
3522
  }, {
3400
3523
  key: "setLocalShareTrack",
3401
- value: function setLocalShareTrack(localShare) {
3402
- var _this23 = this;
3524
+ value: function setLocalShareTrack(localShareTrack) {
3403
3525
  var settings = null;
3404
- if (localShare) {
3405
- this.mediaProperties.setLocalShareTrack(_util.default.getTrack(localShare).videoTrack);
3406
- var contentTracks = this.mediaProperties.shareTrack;
3407
- if (contentTracks) {
3408
- settings = contentTracks.getSettings();
3409
- this.mediaProperties.setMediaSettings('screen', {
3410
- aspectRatio: settings.aspectRatio,
3411
- frameRate: settings.frameRate,
3412
- height: settings.height,
3413
- width: settings.width,
3414
- displaySurface: settings.displaySurface,
3415
- cursor: settings.cursor
3416
- });
3417
- _loggerProxy.default.logger.log('Meeting:index#setLocalShareTrack --> Screen settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.screen));
3418
- }
3419
- contentTracks.onended = function () {
3420
- return _this23.handleShareTrackEnded(localShare);
3421
- };
3526
+ if (localShareTrack) {
3527
+ this.mediaProperties.setLocalShareTrack(localShareTrack);
3528
+ settings = localShareTrack.getSettings();
3529
+ this.mediaProperties.setMediaSettings('screen', {
3530
+ aspectRatio: settings.aspectRatio,
3531
+ frameRate: settings.frameRate,
3532
+ height: settings.height,
3533
+ width: settings.width,
3534
+ displaySurface: settings.displaySurface,
3535
+ cursor: settings.cursor
3536
+ });
3537
+ _loggerProxy.default.logger.log('Meeting:index#setLocalShareTrack --> Screen settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.screen));
3538
+ localShareTrack.addEventListener('ended', this.handleShareTrackEnded);
3422
3539
  _triggerProxy.default.trigger(this, {
3423
3540
  file: 'meeting/index',
3424
3541
  function: 'setLocalShareTrack'
3425
3542
  }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
3426
3543
  type: _constants.EVENT_TYPES.LOCAL_SHARE,
3427
- stream: localShare
3544
+ track: localShareTrack
3428
3545
  });
3546
+ } else if (this.mediaProperties.shareTrack) {
3547
+ this.mediaProperties.shareTrack.removeEventListener('ended', this.handleShareTrackEnded);
3548
+ this.mediaProperties.setLocalShareTrack(null);
3429
3549
  }
3430
3550
  }
3431
3551
 
@@ -3439,7 +3559,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3439
3559
  }, {
3440
3560
  key: "closeLocalStream",
3441
3561
  value: function closeLocalStream() {
3442
- var _this24 = this;
3562
+ var _this23 = this;
3443
3563
  var _this$mediaProperties2 = this.mediaProperties,
3444
3564
  audioTrack = _this$mediaProperties2.audioTrack,
3445
3565
  videoTrack = _this$mediaProperties2.videoTrack;
@@ -3451,7 +3571,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3451
3571
 
3452
3572
  // triggers event for audio and video stop , sometime either audio or video one of them exists
3453
3573
  if (audioStopped || videoStopped) {
3454
- _triggerProxy.default.trigger(_this24, {
3574
+ _triggerProxy.default.trigger(_this23, {
3455
3575
  file: 'meeting/index',
3456
3576
  function: 'closeLocalStream'
3457
3577
  }, _constants.EVENT_TRIGGERS.MEDIA_STOPPED, {
@@ -3473,11 +3593,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3473
3593
  }, {
3474
3594
  key: "closeLocalShare",
3475
3595
  value: function closeLocalShare() {
3476
- var _this25 = this;
3596
+ var _this24 = this;
3477
3597
  var track = this.mediaProperties.shareTrack;
3478
3598
  return _media.default.stopTracks(track).then(function () {
3479
3599
  if (track && track.readyState === _constants.ENDED) {
3480
- _triggerProxy.default.trigger(_this25, {
3600
+ _triggerProxy.default.trigger(_this24, {
3481
3601
  file: 'meeting/index',
3482
3602
  function: 'closeLocalShare'
3483
3603
  }, _constants.EVENT_TRIGGERS.MEDIA_STOPPED, {
@@ -3523,7 +3643,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3523
3643
  }, {
3524
3644
  key: "setMercuryListener",
3525
3645
  value: function setMercuryListener() {
3526
- var _this26 = this;
3646
+ var _this25 = this;
3527
3647
  // Client will have a socket manager and handle reconnecting to mercury, when we reconnect to mercury
3528
3648
  // if the meeting has active peer connections, it should try to reconnect.
3529
3649
  // @ts-ignore
@@ -3531,16 +3651,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3531
3651
  _loggerProxy.default.logger.info('Meeting:index#setMercuryListener --> Web socket online');
3532
3652
 
3533
3653
  // Only send restore event when it was disconnected before and for connected later
3534
- if (!_this26.hasWebsocketConnected) {
3654
+ if (!_this25.hasWebsocketConnected) {
3535
3655
  _metrics.default.postEvent({
3536
3656
  event: _config.eventType.MERCURY_CONNECTION_RESTORED,
3537
- meeting: _this26
3657
+ meeting: _this25
3538
3658
  });
3539
3659
  _metrics.default.sendBehavioralMetric(_constants2.default.MERCURY_CONNECTION_RESTORED, {
3540
- correlation_id: _this26.correlationId
3660
+ correlation_id: _this25.correlationId
3541
3661
  });
3542
3662
  }
3543
- _this26.hasWebsocketConnected = true;
3663
+ _this25.hasWebsocketConnected = true;
3544
3664
  });
3545
3665
 
3546
3666
  // @ts-ignore
@@ -3548,10 +3668,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3548
3668
  _loggerProxy.default.logger.error('Meeting:index#setMercuryListener --> Web socket offline');
3549
3669
  _metrics.default.postEvent({
3550
3670
  event: _config.eventType.MERCURY_CONNECTION_LOST,
3551
- meeting: _this26
3671
+ meeting: _this25
3552
3672
  });
3553
3673
  _metrics.default.sendBehavioralMetric(_constants2.default.MERCURY_CONNECTION_FAILURE, {
3554
- correlation_id: _this26.correlationId
3674
+ correlation_id: _this25.correlationId
3555
3675
  });
3556
3676
  });
3557
3677
  }
@@ -3621,7 +3741,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3621
3741
  }, {
3622
3742
  key: "muteAudio",
3623
3743
  value: function muteAudio() {
3624
- var _this27 = this;
3744
+ var _this26 = this;
3625
3745
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3626
3746
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3627
3747
  }
@@ -3638,10 +3758,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3638
3758
 
3639
3759
  // First, stop sending the local audio media
3640
3760
  return logRequest(this.audio.handleClientRequest(this, true).then(function () {
3641
- _util.default.handleAudioLogging(_this27.mediaProperties.audioTrack);
3761
+ _util.default.handleAudioLogging(_this26.mediaProperties.audioTrack);
3642
3762
  _metrics.default.postEvent({
3643
3763
  event: _config.eventType.MUTED,
3644
- meeting: _this27,
3764
+ meeting: _this26,
3645
3765
  data: {
3646
3766
  trigger: _config.trigger.USER_INTERACTION,
3647
3767
  mediaType: _config.mediaType.AUDIO
@@ -3649,8 +3769,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3649
3769
  });
3650
3770
  }).catch(function (error) {
3651
3771
  _metrics.default.sendBehavioralMetric(_constants2.default.MUTE_AUDIO_FAILURE, {
3652
- correlation_id: _this27.correlationId,
3653
- locus_id: _this27.locusUrl.split('/').pop(),
3772
+ correlation_id: _this26.correlationId,
3773
+ locus_id: _this26.locusUrl.split('/').pop(),
3654
3774
  reason: error.message,
3655
3775
  stack: error.stack
3656
3776
  });
@@ -3671,7 +3791,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3671
3791
  }, {
3672
3792
  key: "unmuteAudio",
3673
3793
  value: function unmuteAudio() {
3674
- var _this28 = this;
3794
+ var _this27 = this;
3675
3795
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3676
3796
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3677
3797
  }
@@ -3688,10 +3808,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3688
3808
 
3689
3809
  // First, send the control to unmute the participant on the server
3690
3810
  return logRequest(this.audio.handleClientRequest(this, false).then(function () {
3691
- _util.default.handleAudioLogging(_this28.mediaProperties.audioTrack);
3811
+ _util.default.handleAudioLogging(_this27.mediaProperties.audioTrack);
3692
3812
  _metrics.default.postEvent({
3693
3813
  event: _config.eventType.UNMUTED,
3694
- meeting: _this28,
3814
+ meeting: _this27,
3695
3815
  data: {
3696
3816
  trigger: _config.trigger.USER_INTERACTION,
3697
3817
  mediaType: _config.mediaType.AUDIO
@@ -3699,8 +3819,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3699
3819
  });
3700
3820
  }).catch(function (error) {
3701
3821
  _metrics.default.sendBehavioralMetric(_constants2.default.UNMUTE_AUDIO_FAILURE, {
3702
- correlation_id: _this28.correlationId,
3703
- locus_id: _this28.locusUrl.split('/').pop(),
3822
+ correlation_id: _this27.correlationId,
3823
+ locus_id: _this27.locusUrl.split('/').pop(),
3704
3824
  reason: error.message,
3705
3825
  stack: error.stack
3706
3826
  });
@@ -3721,7 +3841,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3721
3841
  }, {
3722
3842
  key: "muteVideo",
3723
3843
  value: function muteVideo() {
3724
- var _this29 = this;
3844
+ var _this28 = this;
3725
3845
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3726
3846
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3727
3847
  }
@@ -3736,10 +3856,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3736
3856
  }
3737
3857
  var LOG_HEADER = 'Meeting:index#muteVideo -->';
3738
3858
  return logRequest(this.video.handleClientRequest(this, true).then(function () {
3739
- _util.default.handleVideoLogging(_this29.mediaProperties.videoTrack);
3859
+ _util.default.handleVideoLogging(_this28.mediaProperties.videoTrack);
3740
3860
  _metrics.default.postEvent({
3741
3861
  event: _config.eventType.MUTED,
3742
- meeting: _this29,
3862
+ meeting: _this28,
3743
3863
  data: {
3744
3864
  trigger: _config.trigger.USER_INTERACTION,
3745
3865
  mediaType: _config.mediaType.VIDEO
@@ -3747,8 +3867,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3747
3867
  });
3748
3868
  }).catch(function (error) {
3749
3869
  _metrics.default.sendBehavioralMetric(_constants2.default.MUTE_VIDEO_FAILURE, {
3750
- correlation_id: _this29.correlationId,
3751
- locus_id: _this29.locusUrl.split('/').pop(),
3870
+ correlation_id: _this28.correlationId,
3871
+ locus_id: _this28.locusUrl.split('/').pop(),
3752
3872
  reason: error.message,
3753
3873
  stack: error.stack
3754
3874
  });
@@ -3769,7 +3889,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3769
3889
  }, {
3770
3890
  key: "unmuteVideo",
3771
3891
  value: function unmuteVideo() {
3772
- var _this30 = this;
3892
+ var _this29 = this;
3773
3893
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3774
3894
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3775
3895
  }
@@ -3784,10 +3904,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3784
3904
  }
3785
3905
  var LOG_HEADER = 'Meeting:index#unmuteVideo -->';
3786
3906
  return logRequest(this.video.handleClientRequest(this, false).then(function () {
3787
- _util.default.handleVideoLogging(_this30.mediaProperties.videoTrack);
3907
+ _util.default.handleVideoLogging(_this29.mediaProperties.videoTrack);
3788
3908
  _metrics.default.postEvent({
3789
3909
  event: _config.eventType.UNMUTED,
3790
- meeting: _this30,
3910
+ meeting: _this29,
3791
3911
  data: {
3792
3912
  trigger: _config.trigger.USER_INTERACTION,
3793
3913
  mediaType: _config.mediaType.VIDEO
@@ -3795,8 +3915,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3795
3915
  });
3796
3916
  }).catch(function (error) {
3797
3917
  _metrics.default.sendBehavioralMetric(_constants2.default.UNMUTE_VIDEO_FAILURE, {
3798
- correlation_id: _this30.correlationId,
3799
- locus_id: _this30.locusUrl.split('/').pop(),
3918
+ correlation_id: _this29.correlationId,
3919
+ locus_id: _this29.locusUrl.split('/').pop(),
3800
3920
  reason: error.message,
3801
3921
  stack: error.stack
3802
3922
  });
@@ -3836,18 +3956,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3836
3956
  }, {
3837
3957
  key: "joinWithMedia",
3838
3958
  value: function joinWithMedia() {
3839
- var _this31 = this;
3959
+ var _this30 = this;
3840
3960
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3841
3961
  // TODO: add validations for parameters
3842
3962
  var mediaSettings = options.mediaSettings,
3843
3963
  joinOptions = options.joinOptions,
3844
3964
  audioVideoOptions = options.audioVideoOptions;
3845
3965
  return this.join(joinOptions).then(function (joinResponse) {
3846
- return _this31.getMediaStreams(mediaSettings, audioVideoOptions).then(function (_ref10) {
3847
- var _ref11 = (0, _slicedToArray2.default)(_ref10, 2),
3848
- localStream = _ref11[0],
3849
- localShare = _ref11[1];
3850
- return _this31.addMedia({
3966
+ return _this30.getMediaStreams(mediaSettings, audioVideoOptions).then(function (_ref12) {
3967
+ var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
3968
+ localStream = _ref13[0],
3969
+ localShare = _ref13[1];
3970
+ return _this30.addMedia({
3851
3971
  mediaSettings: mediaSettings,
3852
3972
  localShare: localShare,
3853
3973
  localStream: localStream
@@ -3862,8 +3982,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3862
3982
  }).catch(function (error) {
3863
3983
  _loggerProxy.default.logger.error('Meeting:index#joinWithMedia --> ', error);
3864
3984
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_WITH_MEDIA_FAILURE, {
3865
- correlation_id: _this31.correlationId,
3866
- locus_id: _this31.locusUrl.split('/').pop(),
3985
+ correlation_id: _this30.correlationId,
3986
+ locus_id: _this30.locusUrl.split('/').pop(),
3867
3987
  reason: error.message,
3868
3988
  stack: error.stack
3869
3989
  }, {
@@ -3884,7 +4004,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3884
4004
  }, {
3885
4005
  key: "reconnect",
3886
4006
  value: function reconnect(options) {
3887
- var _this32 = this;
4007
+ var _this31 = this;
3888
4008
  _loggerProxy.default.logger.log("Meeting:index#reconnect --> attempting to reconnect meeting ".concat(this.id));
3889
4009
  if (!this.reconnectionManager || !this.reconnectionManager.reconnect) {
3890
4010
  return _promise.default.reject(new _parameter.default('Cannot reconnect, ReconnectionManager must first be defined.'));
@@ -3912,13 +4032,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3912
4032
  function: 'reconnect'
3913
4033
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_STARTING);
3914
4034
  return this.reconnectionManager.reconnect(options).then(function () {
3915
- _triggerProxy.default.trigger(_this32, {
4035
+ _triggerProxy.default.trigger(_this31, {
3916
4036
  file: 'meeting/index',
3917
4037
  function: 'reconnect'
3918
4038
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_SUCCESS);
3919
4039
  _loggerProxy.default.logger.log('Meeting:index#reconnect --> Meeting reconnect success');
3920
4040
  }).catch(function (error) {
3921
- _triggerProxy.default.trigger(_this32, {
4041
+ _triggerProxy.default.trigger(_this31, {
3922
4042
  file: 'meeting/index',
3923
4043
  function: 'reconnect'
3924
4044
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_FAILURE, {
@@ -3926,18 +4046,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3926
4046
  });
3927
4047
  _loggerProxy.default.logger.error('Meeting:index#reconnect --> Meeting reconnect failed', error);
3928
4048
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_RECONNECT_FAILURE, {
3929
- correlation_id: _this32.correlationId,
3930
- locus_id: _this32.locusUrl.split('/').pop(),
4049
+ correlation_id: _this31.correlationId,
4050
+ locus_id: _this31.locusUrl.split('/').pop(),
3931
4051
  reason: error.message,
3932
4052
  stack: error.stack
3933
4053
  });
3934
- _this32.uploadLogs({
4054
+ _this31.uploadLogs({
3935
4055
  file: 'meeting/index',
3936
4056
  function: 'reconnect'
3937
4057
  });
3938
4058
  return _promise.default.reject(new _reconnection.default('Reconnection failure event', error));
3939
4059
  }).finally(function () {
3940
- _this32.reconnectionManager.reset();
4060
+ _this31.reconnectionManager.reset();
3941
4061
  });
3942
4062
  }
3943
4063
 
@@ -3980,16 +4100,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3980
4100
  }, {
3981
4101
  key: "monitorTranscriptionSocketConnection",
3982
4102
  value: function monitorTranscriptionSocketConnection() {
3983
- var _this33 = this;
4103
+ var _this32 = this;
3984
4104
  this.transcription.onCloseSocket(function (event) {
3985
4105
  _loggerProxy.default.logger.info("Meeting:index#onCloseSocket -->\n unable to continue receiving transcription;\n low-latency mercury web socket connection is closed now.\n ".concat(event));
3986
- _this33.triggerStopReceivingTranscriptionEvent();
4106
+ _this32.triggerStopReceivingTranscriptionEvent();
3987
4107
  });
3988
4108
  this.transcription.onErrorSocket(function (event) {
3989
4109
  _loggerProxy.default.logger.error("Meeting:index#onErrorSocket -->\n unable to continue receiving transcription;\n low-latency mercury web socket connection error had occured.\n ".concat(event));
3990
- _this33.triggerStopReceivingTranscriptionEvent();
4110
+ _this32.triggerStopReceivingTranscriptionEvent();
3991
4111
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
3992
- correlation_id: _this33.correlationId,
4112
+ correlation_id: _this32.correlationId,
3993
4113
  reason: 'unexpected error: transcription LLM web socket connection error had occured.',
3994
4114
  event: event
3995
4115
  });
@@ -4004,16 +4124,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4004
4124
  }, {
4005
4125
  key: "receiveTranscription",
4006
4126
  value: function () {
4007
- var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
4008
- var _this34 = this;
4127
+ var _receiveTranscription = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
4128
+ var _this33 = this;
4009
4129
  var datachannelUrl, _yield$this$request, webSocketUrl;
4010
- return _regenerator.default.wrap(function _callee2$(_context2) {
4011
- while (1) switch (_context2.prev = _context2.next) {
4130
+ return _regenerator.default.wrap(function _callee4$(_context4) {
4131
+ while (1) switch (_context4.prev = _context4.next) {
4012
4132
  case 0:
4013
4133
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Attempting to generate a web socket url.");
4014
- _context2.prev = 1;
4134
+ _context4.prev = 1;
4015
4135
  datachannelUrl = this.locusInfo.info.datachannelUrl; // @ts-ignore - fix type
4016
- _context2.next = 5;
4136
+ _context4.next = 5;
4017
4137
  return this.request({
4018
4138
  method: _constants.HTTP_VERBS.POST,
4019
4139
  uri: datachannelUrl,
@@ -4022,7 +4142,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4022
4142
  }
4023
4143
  });
4024
4144
  case 5:
4025
- _yield$this$request = _context2.sent;
4145
+ _yield$this$request = _context4.sent;
4026
4146
  webSocketUrl = _yield$this$request.body.webSocketUrl;
4027
4147
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Generated web socket url succesfully.");
4028
4148
  this.transcription = new _transcription.default(webSocketUrl,
@@ -4032,7 +4152,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4032
4152
 
4033
4153
  // retrieve and pass the payload
4034
4154
  this.transcription.subscribe(function (payload) {
4035
- _triggerProxy.default.trigger(_this34, {
4155
+ _triggerProxy.default.trigger(_this33, {
4036
4156
  file: 'meeting/index',
4037
4157
  function: 'join'
4038
4158
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, payload);
@@ -4040,22 +4160,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4040
4160
  this.monitorTranscriptionSocketConnection();
4041
4161
  // @ts-ignore - fix type
4042
4162
  this.transcription.connect(this.webex.credentials.supertoken.access_token);
4043
- _context2.next = 19;
4163
+ _context4.next = 19;
4044
4164
  break;
4045
4165
  case 15:
4046
- _context2.prev = 15;
4047
- _context2.t0 = _context2["catch"](1);
4048
- _loggerProxy.default.logger.error("Meeting:index#receiveTranscription --> ".concat(_context2.t0));
4166
+ _context4.prev = 15;
4167
+ _context4.t0 = _context4["catch"](1);
4168
+ _loggerProxy.default.logger.error("Meeting:index#receiveTranscription --> ".concat(_context4.t0));
4049
4169
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_FAILURE, {
4050
4170
  correlation_id: this.correlationId,
4051
- reason: _context2.t0.message,
4052
- stack: _context2.t0.stack
4171
+ reason: _context4.t0.message,
4172
+ stack: _context4.t0.stack
4053
4173
  });
4054
4174
  case 19:
4055
4175
  case "end":
4056
- return _context2.stop();
4176
+ return _context4.stop();
4057
4177
  }
4058
- }, _callee2, this, [[1, 15]]);
4178
+ }, _callee4, this, [[1, 15]]);
4059
4179
  }));
4060
4180
  function receiveTranscription() {
4061
4181
  return _receiveTranscription.apply(this, arguments);
@@ -4113,7 +4233,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4113
4233
  }, {
4114
4234
  key: "join",
4115
4235
  value: function join() {
4116
- var _this35 = this;
4236
+ var _this34 = this;
4117
4237
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4118
4238
  // @ts-ignore - fix type
4119
4239
  if (!this.webex.meetings.registered) {
@@ -4201,87 +4321,87 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4201
4321
  }
4202
4322
  this.isMultistream = !!options.enableMultistream;
4203
4323
  return _util.default.joinMeetingOptions(this, options).then(function (join) {
4204
- _this35.meetingFiniteStateMachine.join();
4324
+ _this34.meetingFiniteStateMachine.join();
4205
4325
  _loggerProxy.default.logger.log('Meeting:index#join --> Success');
4206
4326
  return join;
4207
4327
  }).then(function (join) {
4208
4328
  joinSuccess(join);
4209
- _this35.deferJoin = undefined;
4329
+ _this34.deferJoin = undefined;
4210
4330
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_SUCCESS, {
4211
- correlation_id: _this35.correlationId
4331
+ correlation_id: _this34.correlationId
4212
4332
  });
4213
4333
  return join;
4214
4334
  }).then( /*#__PURE__*/function () {
4215
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(join) {
4216
- return _regenerator.default.wrap(function _callee3$(_context3) {
4217
- while (1) switch (_context3.prev = _context3.next) {
4335
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(join) {
4336
+ return _regenerator.default.wrap(function _callee5$(_context5) {
4337
+ while (1) switch (_context5.prev = _context5.next) {
4218
4338
  case 0:
4219
- if (!_this35.config.enableAutomaticLLM) {
4220
- _context3.next = 5;
4339
+ if (!_this34.config.enableAutomaticLLM) {
4340
+ _context5.next = 5;
4221
4341
  break;
4222
4342
  }
4223
- _context3.next = 3;
4224
- return _this35.updateLLMConnection();
4343
+ _context5.next = 3;
4344
+ return _this34.updateLLMConnection();
4225
4345
  case 3:
4226
4346
  // @ts-ignore - Fix type
4227
- _this35.webex.internal.llm.on('event:relay.event', _this35.processRelayEvent);
4347
+ _this34.webex.internal.llm.on('event:relay.event', _this34.processRelayEvent);
4228
4348
  _loggerProxy.default.logger.info('Meeting:index#join --> enabled to receive relay events!');
4229
4349
  case 5:
4230
- return _context3.abrupt("return", join);
4350
+ return _context5.abrupt("return", join);
4231
4351
  case 6:
4232
4352
  case "end":
4233
- return _context3.stop();
4353
+ return _context5.stop();
4234
4354
  }
4235
- }, _callee3);
4355
+ }, _callee5);
4236
4356
  }));
4237
- return function (_x2) {
4238
- return _ref12.apply(this, arguments);
4357
+ return function (_x3) {
4358
+ return _ref14.apply(this, arguments);
4239
4359
  };
4240
4360
  }()).then( /*#__PURE__*/function () {
4241
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(join) {
4242
- return _regenerator.default.wrap(function _callee4$(_context4) {
4243
- while (1) switch (_context4.prev = _context4.next) {
4361
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(join) {
4362
+ return _regenerator.default.wrap(function _callee6$(_context6) {
4363
+ while (1) switch (_context6.prev = _context6.next) {
4244
4364
  case 0:
4245
4365
  if (!isBrowser) {
4246
- _context4.next = 8;
4366
+ _context6.next = 8;
4247
4367
  break;
4248
4368
  }
4249
- if (!(_this35.config.receiveTranscription || options.receiveTranscription)) {
4250
- _context4.next = 6;
4369
+ if (!(_this34.config.receiveTranscription || options.receiveTranscription)) {
4370
+ _context6.next = 6;
4251
4371
  break;
4252
4372
  }
4253
- if (!_this35.isTranscriptionSupported()) {
4254
- _context4.next = 6;
4373
+ if (!_this34.isTranscriptionSupported()) {
4374
+ _context6.next = 6;
4255
4375
  break;
4256
4376
  }
4257
- _context4.next = 5;
4258
- return _this35.receiveTranscription();
4377
+ _context6.next = 5;
4378
+ return _this34.receiveTranscription();
4259
4379
  case 5:
4260
4380
  _loggerProxy.default.logger.info('Meeting:index#join --> enabled to recieve transcription!');
4261
4381
  case 6:
4262
- _context4.next = 9;
4382
+ _context6.next = 9;
4263
4383
  break;
4264
4384
  case 8:
4265
4385
  _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4266
4386
  case 9:
4267
- return _context4.abrupt("return", join);
4387
+ return _context6.abrupt("return", join);
4268
4388
  case 10:
4269
4389
  case "end":
4270
- return _context4.stop();
4390
+ return _context6.stop();
4271
4391
  }
4272
- }, _callee4);
4392
+ }, _callee6);
4273
4393
  }));
4274
- return function (_x3) {
4275
- return _ref13.apply(this, arguments);
4394
+ return function (_x4) {
4395
+ return _ref15.apply(this, arguments);
4276
4396
  };
4277
4397
  }()).catch(function (error) {
4278
4398
  var _error$error;
4279
- _this35.meetingFiniteStateMachine.fail(error);
4399
+ _this34.meetingFiniteStateMachine.fail(error);
4280
4400
  _loggerProxy.default.logger.error('Meeting:index#join --> Failed', error);
4281
4401
  _metrics.default.postEvent({
4282
4402
  event: _config.eventType.LOCUS_JOIN_RESPONSE,
4283
- meeting: _this35,
4284
- meetingId: _this35.id,
4403
+ meeting: _this34,
4404
+ meetingId: _this34.id,
4285
4405
  data: {
4286
4406
  errors: [_metrics.default.parseLocusError(error.error, true)]
4287
4407
  }
@@ -4289,18 +4409,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4289
4409
 
4290
4410
  // TODO: change this to error codes and pre defined dictionary
4291
4411
  _metrics.default.sendBehavioralMetric(_constants2.default.JOIN_FAILURE, {
4292
- correlation_id: _this35.correlationId,
4412
+ correlation_id: _this34.correlationId,
4293
4413
  reason: (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message,
4294
4414
  stack: error.stack
4295
4415
  });
4296
4416
 
4297
4417
  // Upload logs on join Failure
4298
- _triggerProxy.default.trigger(_this35, {
4418
+ _triggerProxy.default.trigger(_this34, {
4299
4419
  file: 'meeting/index',
4300
4420
  function: 'join'
4301
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this35);
4421
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this34);
4302
4422
  joinFailed(error);
4303
- _this35.deferJoin = undefined;
4423
+ _this34.deferJoin = undefined;
4304
4424
  return _promise.default.reject(error);
4305
4425
  });
4306
4426
  }
@@ -4314,42 +4434,42 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4314
4434
  }, {
4315
4435
  key: "updateLLMConnection",
4316
4436
  value: function () {
4317
- var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
4437
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
4318
4438
  var _this$locusInfo5, url, _this$locusInfo5$info, _this$locusInfo5$info2, datachannelUrl, isJoined;
4319
- return _regenerator.default.wrap(function _callee5$(_context5) {
4320
- while (1) switch (_context5.prev = _context5.next) {
4439
+ return _regenerator.default.wrap(function _callee7$(_context7) {
4440
+ while (1) switch (_context7.prev = _context7.next) {
4321
4441
  case 0:
4322
4442
  // @ts-ignore - Fix type
4323
4443
  _this$locusInfo5 = this.locusInfo, url = _this$locusInfo5.url, _this$locusInfo5$info = _this$locusInfo5.info, _this$locusInfo5$info2 = _this$locusInfo5$info === void 0 ? {} : _this$locusInfo5$info, datachannelUrl = _this$locusInfo5$info2.datachannelUrl;
4324
4444
  isJoined = this.joinedWith && this.joinedWith.state === 'JOINED'; // @ts-ignore - Fix type
4325
4445
  if (!this.webex.internal.llm.isConnected()) {
4326
- _context5.next = 8;
4446
+ _context7.next = 8;
4327
4447
  break;
4328
4448
  }
4329
4449
  if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
4330
- _context5.next = 5;
4450
+ _context7.next = 5;
4331
4451
  break;
4332
4452
  }
4333
- return _context5.abrupt("return", undefined);
4453
+ return _context7.abrupt("return", undefined);
4334
4454
  case 5:
4335
- _context5.next = 7;
4455
+ _context7.next = 7;
4336
4456
  return this.webex.internal.llm.disconnectLLM();
4337
4457
  case 7:
4338
4458
  // @ts-ignore - Fix type
4339
4459
  this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
4340
4460
  case 8:
4341
4461
  if (isJoined) {
4342
- _context5.next = 10;
4462
+ _context7.next = 10;
4343
4463
  break;
4344
4464
  }
4345
- return _context5.abrupt("return", undefined);
4465
+ return _context7.abrupt("return", undefined);
4346
4466
  case 10:
4347
- return _context5.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl));
4467
+ return _context7.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl));
4348
4468
  case 11:
4349
4469
  case "end":
4350
- return _context5.stop();
4470
+ return _context7.stop();
4351
4471
  }
4352
- }, _callee5, this);
4472
+ }, _callee7, this);
4353
4473
  }));
4354
4474
  function updateLLMConnection() {
4355
4475
  return _updateLLMConnection.apply(this, arguments);
@@ -4394,7 +4514,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4394
4514
  }, {
4395
4515
  key: "dialInPstn",
4396
4516
  value: function dialInPstn() {
4397
- var _this36 = this;
4517
+ var _this35 = this;
4398
4518
  if (this.isPhoneProvisioned(this.dialInDeviceStatus)) return _promise.default.resolve(); // prevent multiple dial in devices from being provisioned
4399
4519
 
4400
4520
  var correlationId = this.correlationId,
@@ -4408,14 +4528,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4408
4528
  locusUrl: locusUrl,
4409
4529
  clientUrl: this.deviceUrl
4410
4530
  }).then(function (res) {
4411
- _this36.locusInfo.onFullLocus(res.body.locus);
4531
+ _this35.locusInfo.onFullLocus(res.body.locus);
4412
4532
  }).catch(function (error) {
4413
4533
  var _error$error2;
4414
4534
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_DIAL_IN_FAILURE, {
4415
- correlation_id: _this36.correlationId,
4416
- dial_in_url: _this36.dialInUrl,
4535
+ correlation_id: _this35.correlationId,
4536
+ dial_in_url: _this35.dialInUrl,
4417
4537
  locus_id: locusUrl.split('/').pop(),
4418
- client_url: _this36.deviceUrl,
4538
+ client_url: _this35.deviceUrl,
4419
4539
  reason: (_error$error2 = error.error) === null || _error$error2 === void 0 ? void 0 : _error$error2.message,
4420
4540
  stack: error.stack
4421
4541
  });
@@ -4433,7 +4553,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4433
4553
  }, {
4434
4554
  key: "dialOutPstn",
4435
4555
  value: function dialOutPstn(phoneNumber) {
4436
- var _this37 = this;
4556
+ var _this36 = this;
4437
4557
  if (this.isPhoneProvisioned(this.dialOutDeviceStatus)) return _promise.default.resolve(); // prevent multiple dial out devices from being provisioned
4438
4558
 
4439
4559
  var correlationId = this.correlationId,
@@ -4448,14 +4568,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4448
4568
  locusUrl: locusUrl,
4449
4569
  clientUrl: this.deviceUrl
4450
4570
  }).then(function (res) {
4451
- _this37.locusInfo.onFullLocus(res.body.locus);
4571
+ _this36.locusInfo.onFullLocus(res.body.locus);
4452
4572
  }).catch(function (error) {
4453
4573
  var _error$error3;
4454
4574
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_DIAL_OUT_FAILURE, {
4455
- correlation_id: _this37.correlationId,
4456
- dial_out_url: _this37.dialOutUrl,
4575
+ correlation_id: _this36.correlationId,
4576
+ dial_out_url: _this36.dialOutUrl,
4457
4577
  locus_id: locusUrl.split('/').pop(),
4458
- client_url: _this37.deviceUrl,
4578
+ client_url: _this36.deviceUrl,
4459
4579
  reason: (_error$error3 = error.error) === null || _error$error3 === void 0 ? void 0 : _error$error3.message,
4460
4580
  stack: error.stack
4461
4581
  });
@@ -4486,7 +4606,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4486
4606
  }, {
4487
4607
  key: "moveTo",
4488
4608
  value: function moveTo(resourceId) {
4489
- var _this38 = this;
4609
+ var _this37 = this;
4490
4610
  if (!resourceId) {
4491
4611
  throw new _parameter.default('Cannot move call without a resourceId.');
4492
4612
  }
@@ -4516,18 +4636,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4516
4636
  event: _config.eventType.MOVE_MEDIA,
4517
4637
  meeting: this
4518
4638
  });
4519
- this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
4639
+ this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
4520
4640
  var mediaSettings;
4521
- return _regenerator.default.wrap(function _callee6$(_context6) {
4522
- while (1) switch (_context6.prev = _context6.next) {
4641
+ return _regenerator.default.wrap(function _callee8$(_context8) {
4642
+ while (1) switch (_context8.prev = _context8.next) {
4523
4643
  case 0:
4524
- _context6.prev = 0;
4525
- if (!_this38.isSharing) {
4526
- _context6.next = 4;
4644
+ _context8.prev = 0;
4645
+ if (!_this37.isSharing) {
4646
+ _context8.next = 4;
4527
4647
  break;
4528
4648
  }
4529
- _context6.next = 4;
4530
- return _this38.releaseScreenShareFloor();
4649
+ _context8.next = 4;
4650
+ return _this37.releaseScreenShareFloor();
4531
4651
  case 4:
4532
4652
  mediaSettings = {
4533
4653
  mediaDirection: {
@@ -4539,54 +4659,54 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4539
4659
  receiveShare: true
4540
4660
  }
4541
4661
  }; // clean up the local tracks
4542
- _this38.mediaProperties.setMediaDirection(mediaSettings.mediaDirection);
4662
+ _this37.mediaProperties.setMediaDirection(mediaSettings.mediaDirection);
4543
4663
 
4544
4664
  // close the existing local tracks
4545
- _context6.next = 8;
4546
- return _this38.closeLocalStream();
4665
+ _context8.next = 8;
4666
+ return _this37.closeLocalStream();
4547
4667
  case 8:
4548
- _context6.next = 10;
4549
- return _this38.closeLocalShare();
4668
+ _context8.next = 10;
4669
+ return _this37.closeLocalShare();
4550
4670
  case 10:
4551
- _this38.mediaProperties.unsetMediaTracks();
4671
+ _this37.mediaProperties.unsetMediaTracks();
4552
4672
 
4553
4673
  // 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
4554
4674
  // once the DX answers we establish connection back the media server with only receiveShare enabled
4555
4675
  // @ts-ignore - reconnectMedia does not accept any argument
4556
- _context6.next = 13;
4557
- return _this38.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
4676
+ _context8.next = 13;
4677
+ return _this37.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
4558
4678
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
4559
4679
  });
4560
4680
  case 13:
4561
- _context6.next = 19;
4681
+ _context8.next = 19;
4562
4682
  break;
4563
4683
  case 15:
4564
- _context6.prev = 15;
4565
- _context6.t0 = _context6["catch"](0);
4566
- _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context6.t0);
4684
+ _context8.prev = 15;
4685
+ _context8.t0 = _context8["catch"](0);
4686
+ _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context8.t0);
4567
4687
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
4568
- correlation_id: _this38.correlationId,
4569
- locus_id: _this38.locusUrl.split('/').pop(),
4570
- reason: _context6.t0.message,
4571
- stack: _context6.t0.stack
4688
+ correlation_id: _this37.correlationId,
4689
+ locus_id: _this37.locusUrl.split('/').pop(),
4690
+ reason: _context8.t0.message,
4691
+ stack: _context8.t0.stack
4572
4692
  });
4573
4693
  case 19:
4574
4694
  case "end":
4575
- return _context6.stop();
4695
+ return _context8.stop();
4576
4696
  }
4577
- }, _callee6, null, [[0, 15]]);
4697
+ }, _callee8, null, [[0, 15]]);
4578
4698
  })));
4579
4699
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
4580
4700
  return _util.default.joinMeetingOptions(this, {
4581
4701
  resourceId: resourceId,
4582
4702
  moveToResource: true
4583
4703
  }).then(function () {
4584
- _this38.meetingFiniteStateMachine.join();
4704
+ _this37.meetingFiniteStateMachine.join();
4585
4705
  }).catch(function (error) {
4586
- _this38.meetingFiniteStateMachine.fail(error);
4706
+ _this37.meetingFiniteStateMachine.fail(error);
4587
4707
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
4588
- correlation_id: _this38.correlationId,
4589
- locus_id: _this38.locusUrl.split('/').pop(),
4708
+ correlation_id: _this37.correlationId,
4709
+ locus_id: _this37.locusUrl.split('/').pop(),
4590
4710
  reason: error.message,
4591
4711
  stack: error.stack
4592
4712
  });
@@ -4605,7 +4725,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4605
4725
  }, {
4606
4726
  key: "moveFrom",
4607
4727
  value: function moveFrom(resourceId) {
4608
- var _this39 = this;
4728
+ var _this38 = this;
4609
4729
  // On moveFrom ask the developer to re capture it moveFrom then updateMedia
4610
4730
  if (!resourceId) {
4611
4731
  throw new _parameter.default('Cannot move call without a resourceId.');
@@ -4616,19 +4736,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4616
4736
  meeting: this
4617
4737
  });
4618
4738
  return _util.default.joinMeetingOptions(this).then(function () {
4619
- return _util.default.leaveMeeting(_this39, {
4739
+ return _util.default.leaveMeeting(_this38, {
4620
4740
  resourceId: resourceId,
4621
4741
  correlationId: oldCorrelationId,
4622
4742
  moveMeeting: true
4623
4743
  }).then(function () {
4624
- _this39.resourceId = '';
4744
+ _this38.resourceId = '';
4625
4745
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_FROM_SUCCESS);
4626
4746
  });
4627
4747
  }).catch(function (error) {
4628
- _this39.meetingFiniteStateMachine.fail(error);
4748
+ _this38.meetingFiniteStateMachine.fail(error);
4629
4749
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_FROM_FAILURE, {
4630
- correlation_id: _this39.correlationId,
4631
- locus_id: _this39.locusUrl.split('/').pop(),
4750
+ correlation_id: _this38.correlationId,
4751
+ locus_id: _this38.locusUrl.split('/').pop(),
4632
4752
  reason: error.message,
4633
4753
  stack: error.stack
4634
4754
  });
@@ -4684,9 +4804,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4684
4804
  }, {
4685
4805
  key: "forwardEvent",
4686
4806
  value: function forwardEvent(eventEmitter, eventTypeToForward, meetingEventType) {
4687
- var _this40 = this;
4807
+ var _this39 = this;
4688
4808
  eventEmitter.on(eventTypeToForward, function (data) {
4689
- return _triggerProxy.default.trigger(_this40, {
4809
+ return _triggerProxy.default.trigger(_this39, {
4690
4810
  file: 'meetings',
4691
4811
  function: 'addMedia'
4692
4812
  }, meetingEventType, data);
@@ -4708,7 +4828,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4708
4828
  }, {
4709
4829
  key: "addMedia",
4710
4830
  value: function addMedia() {
4711
- var _this41 = this;
4831
+ var _this40 = this;
4712
4832
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4713
4833
  var LOG_HEADER = 'Meeting:index#addMedia -->';
4714
4834
  var turnDiscoverySkippedReason;
@@ -4752,41 +4872,41 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4752
4872
  }
4753
4873
  });
4754
4874
  return _util.default.validateOptions(options).then(function () {
4755
- return _this41.roap.doTurnDiscovery(_this41, false);
4875
+ return _this40.roap.doTurnDiscovery(_this40, false);
4756
4876
  }).then(function (turnDiscoveryObject) {
4757
4877
  turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
4758
4878
  turnServerUsed = !turnDiscoverySkippedReason;
4759
4879
  var turnServerInfo = turnDiscoveryObject.turnServerInfo;
4760
- _this41.preMedia(localStream, localShare, mediaSettings);
4761
- var mc = _this41.createMediaConnection(turnServerInfo);
4762
- if (_this41.isMultistream) {
4763
- _this41.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this41.receiveSlotManager, _this41.mediaRequestManagers, remoteMediaManagerConfig);
4764
- _this41.forwardEvent(_this41.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
4765
- _this41.forwardEvent(_this41.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
4766
- _this41.forwardEvent(_this41.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
4767
- return _this41.remoteMediaManager.start().then(function () {
4880
+ _this40.preMedia(localStream, localShare, mediaSettings);
4881
+ var mc = _this40.createMediaConnection(turnServerInfo);
4882
+ if (_this40.isMultistream) {
4883
+ _this40.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this40.receiveSlotManager, _this40.mediaRequestManagers, remoteMediaManagerConfig);
4884
+ _this40.forwardEvent(_this40.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
4885
+ _this40.forwardEvent(_this40.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
4886
+ _this40.forwardEvent(_this40.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
4887
+ return _this40.remoteMediaManager.start().then(function () {
4768
4888
  return mc.initiateOffer();
4769
4889
  });
4770
4890
  }
4771
4891
  return mc.initiateOffer();
4772
4892
  }).then(function () {
4773
- _this41.setMercuryListener();
4893
+ _this40.setMercuryListener();
4774
4894
  }).then(function () {
4775
- return _this41.getDevices().then(function (devices) {
4895
+ return _this40.getDevices().then(function (devices) {
4776
4896
  _util.default.handleDeviceLogging(devices);
4777
4897
  });
4778
4898
  }).then(function () {
4779
- _this41.handleMediaLogging(_this41.mediaProperties);
4899
+ _this40.handleMediaLogging(_this40.mediaProperties);
4780
4900
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
4781
4901
 
4782
4902
  // @ts-ignore - config coming from registerPlugin
4783
- if (_this41.config.stats.enableStatsAnalyzer) {
4903
+ if (_this40.config.stats.enableStatsAnalyzer) {
4784
4904
  // @ts-ignore - config coming from registerPlugin
4785
- _this41.networkQualityMonitor = new _networkQualityMonitor.default(_this41.config.stats);
4905
+ _this40.networkQualityMonitor = new _networkQualityMonitor.default(_this40.config.stats);
4786
4906
  // @ts-ignore - config coming from registerPlugin
4787
- _this41.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(_this41.config.stats, _this41.networkQualityMonitor);
4788
- _this41.setupStatsAnalyzerEventHandlers();
4789
- _this41.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this41.sendNetworkQualityEvent.bind(_this41));
4907
+ _this40.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(_this40.config.stats, _this40.networkQualityMonitor);
4908
+ _this40.setupStatsAnalyzerEventHandlers();
4909
+ _this40.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this40.sendNetworkQualityEvent.bind(_this40));
4790
4910
  }
4791
4911
  }).catch(function (error) {
4792
4912
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media , setting up peerconnection, "), error);
@@ -4797,12 +4917,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4797
4917
 
4798
4918
  // eslint-disable-next-line func-names
4799
4919
  // eslint-disable-next-line prefer-arrow-callback
4800
- if (_this41.type === _constants._CALL_) {
4920
+ if (_this40.type === _constants._CALL_) {
4801
4921
  resolve();
4802
4922
  }
4803
4923
  var joiningTimer = setInterval(function () {
4804
4924
  timerCount += 1;
4805
- if (_this41.meetingState === _constants.FULL_STATE.ACTIVE) {
4925
+ if (_this40.meetingState === _constants.FULL_STATE.ACTIVE) {
4806
4926
  clearInterval(joiningTimer);
4807
4927
  resolve();
4808
4928
  }
@@ -4813,41 +4933,41 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4813
4933
  }, 1000);
4814
4934
  });
4815
4935
  }).then(function () {
4816
- return _this41.mediaProperties.waitForMediaConnectionConnected().catch(function () {
4936
+ return _this40.mediaProperties.waitForMediaConnectionConnected().catch(function () {
4817
4937
  throw (0, _webexErrors.createMeetingsError)(30202, 'Meeting connection failed');
4818
4938
  });
4819
4939
  }).then(function () {
4820
4940
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " PeerConnection CONNECTED"));
4821
4941
  if (mediaSettings && mediaSettings.sendShare && localShare) {
4822
- if (_this41.state === _constants.MEETING_STATE.STATES.JOINED) {
4823
- return _this41.requestScreenShareFloor();
4942
+ if (_this40.state === _constants.MEETING_STATE.STATES.JOINED) {
4943
+ return _this40.requestScreenShareFloor();
4824
4944
  }
4825
4945
 
4826
4946
  // When the self state changes to JOINED then request the floor
4827
- _this41.floorGrantPending = true;
4947
+ _this40.floorGrantPending = true;
4828
4948
  }
4829
4949
  return {};
4830
4950
  }).then(function () {
4831
- return _this41.mediaProperties.getCurrentConnectionType();
4951
+ return _this40.mediaProperties.getCurrentConnectionType();
4832
4952
  }).then(function (connectionType) {
4833
4953
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, {
4834
- correlation_id: _this41.correlationId,
4835
- locus_id: _this41.locusUrl.split('/').pop(),
4954
+ correlation_id: _this40.correlationId,
4955
+ locus_id: _this40.locusUrl.split('/').pop(),
4836
4956
  connectionType: connectionType
4837
4957
  });
4838
4958
  }).catch(function (error) {
4839
4959
  // Clean up stats analyzer, peer connection, and turn off listeners
4840
- var stopStatsAnalyzer = _this41.statsAnalyzer ? _this41.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
4960
+ var stopStatsAnalyzer = _this40.statsAnalyzer ? _this40.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
4841
4961
  return stopStatsAnalyzer.then(function () {
4842
- _this41.statsAnalyzer = null;
4843
- if (_this41.mediaProperties.webrtcMediaConnection) {
4844
- _this41.closePeerConnections();
4845
- _this41.unsetPeerConnections();
4962
+ _this40.statsAnalyzer = null;
4963
+ if (_this40.mediaProperties.webrtcMediaConnection) {
4964
+ _this40.closePeerConnections();
4965
+ _this40.unsetPeerConnections();
4846
4966
  }
4847
4967
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media failed to initiate PC and send request, "), error);
4848
4968
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, {
4849
- correlation_id: _this41.correlationId,
4850
- locus_id: _this41.locusUrl.split('/').pop(),
4969
+ correlation_id: _this40.correlationId,
4970
+ locus_id: _this40.locusUrl.split('/').pop(),
4851
4971
  reason: error.message,
4852
4972
  stack: error.stack,
4853
4973
  code: error.code,
@@ -4856,12 +4976,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4856
4976
  });
4857
4977
 
4858
4978
  // Upload logs on error while adding media
4859
- _triggerProxy.default.trigger(_this41, {
4979
+ _triggerProxy.default.trigger(_this40, {
4860
4980
  file: 'meeting/index',
4861
4981
  function: 'addMedia'
4862
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this41);
4982
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this40);
4863
4983
  if (error instanceof _internalMediaCore.Errors.SdpError) {
4864
- _this41.leave({
4984
+ _this40.leave({
4865
4985
  reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
4866
4986
  });
4867
4987
  }
@@ -4894,7 +5014,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4894
5014
  }, {
4895
5015
  key: "enqueueMediaUpdate",
4896
5016
  value: function enqueueMediaUpdate(mediaUpdateType, options) {
4897
- var _this42 = this;
5017
+ var _this41 = this;
4898
5018
  if (mediaUpdateType === MEDIA_UPDATE_TYPE.LAMBDA && typeof (options === null || options === void 0 ? void 0 : options.lambda) !== 'function') {
4899
5019
  return _promise.default.reject(new Error('lambda must be specified when enqueuing MEDIA_UPDATE_TYPE.LAMBDA'));
4900
5020
  }
@@ -4907,9 +5027,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4907
5027
  options: options
4908
5028
  };
4909
5029
  _loggerProxy.default.logger.log("Meeting:index#enqueueMediaUpdate --> enqueuing media update type=".concat(mediaUpdateType));
4910
- _this42.queuedMediaUpdates.push(queueItem);
5030
+ _this41.queuedMediaUpdates.push(queueItem);
4911
5031
  if (canUpdateMediaNow) {
4912
- _this42.processNextQueuedMediaUpdate();
5032
+ _this41.processNextQueuedMediaUpdate();
4913
5033
  }
4914
5034
  });
4915
5035
  }
@@ -4935,7 +5055,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4935
5055
  * @memberof Meeting
4936
5056
  */
4937
5057
  function updateMedia() {
4938
- var _this43 = this;
5058
+ var _this42 = this;
4939
5059
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4940
5060
  var LOG_HEADER = 'Meeting:index#updateMedia -->';
4941
5061
  if (!this.canUpdateMedia()) {
@@ -4949,27 +5069,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4949
5069
  return _promise.default.reject(new Error('media connection not established, call addMedia() first'));
4950
5070
  }
4951
5071
  return _util.default.validateOptions(options).then(function () {
4952
- return _this43.preMedia(localStream, localShare, mediaSettings);
5072
+ return _this42.preMedia(localStream, localShare, mediaSettings);
4953
5073
  }).then(function () {
4954
- return _this43.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5074
+ return _this42.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
4955
5075
  send: {
4956
- audio: _this43.mediaProperties.mediaDirection.sendAudio ? _this43.mediaProperties.audioTrack : null,
4957
- video: _this43.mediaProperties.mediaDirection.sendVideo ? _this43.mediaProperties.videoTrack : null,
4958
- screenShareVideo: _this43.mediaProperties.mediaDirection.sendShare ? _this43.mediaProperties.shareTrack : null
5076
+ audio: _this42.mediaProperties.mediaDirection.sendAudio ? _this42.mediaProperties.audioTrack : null,
5077
+ video: _this42.mediaProperties.mediaDirection.sendVideo ? _this42.mediaProperties.videoTrack : null,
5078
+ screenShareVideo: _this42.mediaProperties.mediaDirection.sendShare ? _this42.mediaProperties.shareTrack : null
4959
5079
  },
4960
5080
  receive: {
4961
- audio: _this43.mediaProperties.mediaDirection.receiveAudio,
4962
- video: _this43.mediaProperties.mediaDirection.receiveVideo,
4963
- screenShareVideo: _this43.mediaProperties.mediaDirection.receiveShare,
4964
- remoteQualityLevel: _this43.mediaProperties.remoteQualityLevel
5081
+ audio: _this42.mediaProperties.mediaDirection.receiveAudio,
5082
+ video: _this42.mediaProperties.mediaDirection.receiveVideo,
5083
+ screenShareVideo: _this42.mediaProperties.mediaDirection.receiveShare,
5084
+ remoteQualityLevel: _this42.mediaProperties.remoteQualityLevel
4965
5085
  }
4966
5086
  }).then(function () {
4967
5087
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " webrtcMediaConnection.updateSendReceiveOptions done"));
4968
5088
  }).catch(function (error) {
4969
5089
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error updatedMedia, "), error);
4970
5090
  _metrics.default.sendBehavioralMetric(_constants2.default.UPDATE_MEDIA_FAILURE, {
4971
- correlation_id: _this43.correlationId,
4972
- locus_id: _this43.locusUrl.split('/').pop(),
5091
+ correlation_id: _this42.correlationId,
5092
+ locus_id: _this42.locusUrl.split('/').pop(),
4973
5093
  reason: error.message,
4974
5094
  stack: error.stack
4975
5095
  });
@@ -4980,16 +5100,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4980
5100
  // if not, ensure it's called after (now it's called after roap message is sent out, but we're not
4981
5101
  // waiting for sendRoapMediaRequest() to be resolved)
4982
5102
  .then(function () {
4983
- return _this43.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.LAMBDA, {
5103
+ return _this42.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.LAMBDA, {
4984
5104
  lambda: function lambda() {
4985
5105
  return _promise.default.resolve().then(function () {
4986
- return _this43.checkForStopShare(mediaSettings.sendShare, previousSendShareStatus);
5106
+ return _this42.checkForStopShare(mediaSettings.sendShare, previousSendShareStatus);
4987
5107
  }).then(function (startShare) {
4988
5108
  // This is a special case if we do an /floor grant followed by /media
4989
5109
  // we actually get a OFFER from the server and a GLAR condition happens
4990
5110
  if (startShare) {
4991
5111
  // We are assuming that the clients are connected when doing an update
4992
- return _this43.requestScreenShareFloor();
5112
+ return _this42.requestScreenShareFloor();
4993
5113
  }
4994
5114
  return _promise.default.resolve();
4995
5115
  });
@@ -5015,79 +5135,79 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5015
5135
  }, {
5016
5136
  key: "updateAudio",
5017
5137
  value: function () {
5018
- var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(options) {
5019
- var _this44 = this;
5138
+ var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(options) {
5139
+ var _this43 = this;
5020
5140
  var sendAudio, receiveAudio, stream, track, bnrEnabled;
5021
- return _regenerator.default.wrap(function _callee7$(_context7) {
5022
- while (1) switch (_context7.prev = _context7.next) {
5141
+ return _regenerator.default.wrap(function _callee9$(_context9) {
5142
+ while (1) switch (_context9.prev = _context9.next) {
5023
5143
  case 0:
5024
5144
  if (this.canUpdateMedia()) {
5025
- _context7.next = 2;
5145
+ _context9.next = 2;
5026
5146
  break;
5027
5147
  }
5028
- return _context7.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
5148
+ return _context9.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
5029
5149
  case 2:
5030
5150
  sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream;
5031
5151
  track = _util.default.getTrack(stream).audioTrack;
5032
5152
  if (!(typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean')) {
5033
- _context7.next = 6;
5153
+ _context9.next = 6;
5034
5154
  break;
5035
5155
  }
5036
- return _context7.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
5156
+ return _context9.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
5037
5157
  case 6:
5038
5158
  if (this.mediaProperties.webrtcMediaConnection) {
5039
- _context7.next = 8;
5159
+ _context9.next = 8;
5040
5160
  break;
5041
5161
  }
5042
- return _context7.abrupt("return", _promise.default.reject(new Error('media connection not established, call addMedia() first')));
5162
+ return _context9.abrupt("return", _promise.default.reject(new Error('media connection not established, call addMedia() first')));
5043
5163
  case 8:
5044
5164
  if (!(this.effects && this.effects.state)) {
5045
- _context7.next = 16;
5165
+ _context9.next = 16;
5046
5166
  break;
5047
5167
  }
5048
5168
  bnrEnabled = this.effects.state.bnr.enabled;
5049
5169
  if (!(sendAudio && !this.isAudioMuted() && (bnrEnabled === _constants.BNR_STATUS.ENABLED || bnrEnabled === _constants.BNR_STATUS.SHOULD_ENABLE))) {
5050
- _context7.next = 16;
5170
+ _context9.next = 16;
5051
5171
  break;
5052
5172
  }
5053
5173
  _loggerProxy.default.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
5054
- _context7.next = 14;
5174
+ _context9.next = 14;
5055
5175
  return this.internal_enableBNR(track);
5056
5176
  case 14:
5057
- track = _context7.sent;
5177
+ track = _context9.sent;
5058
5178
  _loggerProxy.default.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
5059
5179
  case 16:
5060
- return _context7.abrupt("return", _util.default.validateOptions({
5180
+ return _context9.abrupt("return", _util.default.validateOptions({
5061
5181
  sendAudio: sendAudio,
5062
5182
  localStream: stream
5063
5183
  }).then(function () {
5064
- return _this44.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5184
+ return _this43.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5065
5185
  send: {
5066
5186
  audio: track
5067
5187
  },
5068
5188
  receive: {
5069
5189
  audio: options.receiveAudio,
5070
- video: _this44.mediaProperties.mediaDirection.receiveVideo,
5071
- screenShareVideo: _this44.mediaProperties.mediaDirection.receiveShare,
5072
- remoteQualityLevel: _this44.mediaProperties.remoteQualityLevel
5190
+ video: _this43.mediaProperties.mediaDirection.receiveVideo,
5191
+ screenShareVideo: _this43.mediaProperties.mediaDirection.receiveShare,
5192
+ remoteQualityLevel: _this43.mediaProperties.remoteQualityLevel
5073
5193
  }
5074
5194
  });
5075
5195
  }).then(function () {
5076
- _this44.setLocalAudioTrack(track);
5196
+ _this43.setLocalAudioTrack(track);
5077
5197
  // todo: maybe this.mediaProperties.mediaDirection could be removed? it's duplicating stuff from webrtcMediaConnection
5078
- _this44.mediaProperties.mediaDirection.sendAudio = sendAudio;
5079
- _this44.mediaProperties.mediaDirection.receiveAudio = receiveAudio;
5198
+ _this43.mediaProperties.mediaDirection.sendAudio = sendAudio;
5199
+ _this43.mediaProperties.mediaDirection.receiveAudio = receiveAudio;
5080
5200
 
5081
5201
  // audio state could be undefined if you have not sent audio before
5082
- _this44.audio = _this44.audio || (0, _muteState.default)(_constants.AUDIO, _this44, _this44.mediaProperties.mediaDirection);
5202
+ _this43.audio = _this43.audio || (0, _muteState.createMuteState)(_constants.AUDIO, _this43, _this43.mediaProperties.mediaDirection);
5083
5203
  }));
5084
5204
  case 17:
5085
5205
  case "end":
5086
- return _context7.stop();
5206
+ return _context9.stop();
5087
5207
  }
5088
- }, _callee7, this);
5208
+ }, _callee9, this);
5089
5209
  }));
5090
- function updateAudio(_x4) {
5210
+ function updateAudio(_x5) {
5091
5211
  return _updateAudio.apply(this, arguments);
5092
5212
  }
5093
5213
  return updateAudio;
@@ -5108,7 +5228,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5108
5228
  }, {
5109
5229
  key: "updateVideo",
5110
5230
  value: function updateVideo(options) {
5111
- var _this45 = this;
5231
+ var _this44 = this;
5112
5232
  if (!this.canUpdateMedia()) {
5113
5233
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.VIDEO, options);
5114
5234
  }
@@ -5126,24 +5246,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5126
5246
  sendVideo: sendVideo,
5127
5247
  localStream: stream
5128
5248
  }).then(function () {
5129
- return _this45.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5249
+ return _this44.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5130
5250
  send: {
5131
5251
  video: track
5132
5252
  },
5133
5253
  receive: {
5134
- audio: _this45.mediaProperties.mediaDirection.receiveAudio,
5254
+ audio: _this44.mediaProperties.mediaDirection.receiveAudio,
5135
5255
  video: options.receiveVideo,
5136
- screenShareVideo: _this45.mediaProperties.mediaDirection.receiveShare,
5137
- remoteQualityLevel: _this45.mediaProperties.remoteQualityLevel
5256
+ screenShareVideo: _this44.mediaProperties.mediaDirection.receiveShare,
5257
+ remoteQualityLevel: _this44.mediaProperties.remoteQualityLevel
5138
5258
  }
5139
5259
  });
5140
5260
  }).then(function () {
5141
- _this45.setLocalVideoTrack(track);
5142
- _this45.mediaProperties.mediaDirection.sendVideo = sendVideo;
5143
- _this45.mediaProperties.mediaDirection.receiveVideo = receiveVideo;
5261
+ _this44.setLocalVideoTrack(track);
5262
+ _this44.mediaProperties.mediaDirection.sendVideo = sendVideo;
5263
+ _this44.mediaProperties.mediaDirection.receiveVideo = receiveVideo;
5144
5264
 
5145
5265
  // video state could be undefined if you have not sent video before
5146
- _this45.video = _this45.video || (0, _muteState.default)(_constants.VIDEO, _this45, _this45.mediaProperties.mediaDirection);
5266
+ _this44.video = _this44.video || (0, _muteState.createMuteState)(_constants.VIDEO, _this44, _this44.mediaProperties.mediaDirection);
5147
5267
  });
5148
5268
  }
5149
5269
 
@@ -5186,7 +5306,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5186
5306
  }, {
5187
5307
  key: "updateShare",
5188
5308
  value: function updateShare(options) {
5189
- var _this46 = this;
5309
+ var _this45 = this;
5190
5310
  if (!options.skipSignalingCheck && !this.canUpdateMedia()) {
5191
5311
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.SHARE, options);
5192
5312
  }
@@ -5201,42 +5321,42 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5201
5321
  return _promise.default.reject(new Error('media connection not established, call addMedia() first'));
5202
5322
  }
5203
5323
  var previousSendShareStatus = this.mediaProperties.mediaDirection.sendShare;
5204
- this.setLocalShareTrack(stream);
5324
+ this.setLocalShareTrack(track);
5205
5325
  return _util.default.validateOptions({
5206
5326
  sendShare: sendShare,
5207
5327
  localShare: stream
5208
5328
  }).then(function () {
5209
- return _this46.checkForStopShare(sendShare, previousSendShareStatus);
5329
+ return _this45.checkForStopShare(sendShare, previousSendShareStatus);
5210
5330
  }).then(function (startShare) {
5211
- return _this46.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5331
+ return _this45.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5212
5332
  send: {
5213
5333
  screenShareVideo: track
5214
5334
  },
5215
5335
  receive: {
5216
- audio: _this46.mediaProperties.mediaDirection.receiveAudio,
5217
- video: _this46.mediaProperties.mediaDirection.receiveVideo,
5336
+ audio: _this45.mediaProperties.mediaDirection.receiveAudio,
5337
+ video: _this45.mediaProperties.mediaDirection.receiveVideo,
5218
5338
  screenShareVideo: options.receiveShare,
5219
- remoteQualityLevel: _this46.mediaProperties.remoteQualityLevel
5339
+ remoteQualityLevel: _this45.mediaProperties.remoteQualityLevel
5220
5340
  }
5221
5341
  }).then(function () {
5222
- return _this46.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.LAMBDA, {
5342
+ return _this45.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.LAMBDA, {
5223
5343
  lambda: function () {
5224
- var _lambda = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
5225
- return _regenerator.default.wrap(function _callee8$(_context8) {
5226
- while (1) switch (_context8.prev = _context8.next) {
5344
+ var _lambda = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
5345
+ return _regenerator.default.wrap(function _callee10$(_context10) {
5346
+ while (1) switch (_context10.prev = _context10.next) {
5227
5347
  case 0:
5228
5348
  if (!startShare) {
5229
- _context8.next = 2;
5349
+ _context10.next = 2;
5230
5350
  break;
5231
5351
  }
5232
- return _context8.abrupt("return", _this46.requestScreenShareFloor());
5352
+ return _context10.abrupt("return", _this45.requestScreenShareFloor());
5233
5353
  case 2:
5234
- return _context8.abrupt("return", undefined);
5354
+ return _context10.abrupt("return", undefined);
5235
5355
  case 3:
5236
5356
  case "end":
5237
- return _context8.stop();
5357
+ return _context10.stop();
5238
5358
  }
5239
- }, _callee8);
5359
+ }, _callee10);
5240
5360
  }));
5241
5361
  function lambda() {
5242
5362
  return _lambda.apply(this, arguments);
@@ -5246,10 +5366,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5246
5366
  });
5247
5367
  });
5248
5368
  }).then(function () {
5249
- _this46.mediaProperties.mediaDirection.sendShare = sendShare;
5250
- _this46.mediaProperties.mediaDirection.receiveShare = receiveShare;
5369
+ _this45.mediaProperties.mediaDirection.sendShare = sendShare;
5370
+ _this45.mediaProperties.mediaDirection.receiveShare = receiveShare;
5251
5371
  }).catch(function (error) {
5252
- _this46.unsetLocalShareTrack();
5372
+ _this45.unsetLocalShareTrack();
5253
5373
  throw error;
5254
5374
  });
5255
5375
  }
@@ -5272,11 +5392,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5272
5392
  this.mediaProperties.setMediaDirection((0, _assign.default)(this.config.mediaSettings, mediaSettings));
5273
5393
  // add a setup a function move the create and setup media in future
5274
5394
  // TODO: delete old audio and video if stale
5275
- this.audio = this.audio || (0, _muteState.default)(_constants.AUDIO, this, this.mediaProperties.mediaDirection);
5276
- this.video = this.video || (0, _muteState.default)(_constants.VIDEO, this, this.mediaProperties.mediaDirection);
5395
+ this.audio = this.audio || (0, _muteState.createMuteState)(_constants.AUDIO, this, this.mediaProperties.mediaDirection);
5396
+ this.video = this.video || (0, _muteState.createMuteState)(_constants.VIDEO, this, this.mediaProperties.mediaDirection);
5277
5397
  // Validation is already done in addMedia so no need to check if the lenght is greater then 0
5278
5398
  this.setLocalTracks(localStream);
5279
- this.setLocalShareTrack(localShare);
5399
+ this.setLocalShareTrack(_util.default.getTrack(localShare).videoTrack);
5280
5400
  }
5281
5401
 
5282
5402
  /**
@@ -5289,7 +5409,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5289
5409
  }, {
5290
5410
  key: "acknowledge",
5291
5411
  value: function acknowledge(type) {
5292
- var _this47 = this;
5412
+ var _this46 = this;
5293
5413
  if (!type) {
5294
5414
  return _promise.default.reject(new _parameter.default('Type must be set to acknowledge the meeting.'));
5295
5415
  }
@@ -5301,10 +5421,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5301
5421
  }).then(function (response) {
5302
5422
  return _promise.default.resolve(response);
5303
5423
  }).then(function (response) {
5304
- _this47.meetingFiniteStateMachine.ring(type);
5424
+ _this46.meetingFiniteStateMachine.ring(type);
5305
5425
  _metrics.default.postEvent({
5306
5426
  event: _config.eventType.ALERT_DISPLAYED,
5307
- meeting: _this47
5427
+ meeting: _this46
5308
5428
  });
5309
5429
  return _promise.default.resolve({
5310
5430
  response: response
@@ -5328,12 +5448,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5328
5448
  }, {
5329
5449
  key: "decline",
5330
5450
  value: function decline(reason) {
5331
- var _this48 = this;
5451
+ var _this47 = this;
5332
5452
  return _util.default.declineMeeting(this, reason).then(function (decline) {
5333
- _this48.meetingFiniteStateMachine.decline();
5453
+ _this47.meetingFiniteStateMachine.decline();
5334
5454
  return _promise.default.resolve(decline);
5335
5455
  }).catch(function (error) {
5336
- _this48.meetingFiniteStateMachine.fail(error);
5456
+ _this47.meetingFiniteStateMachine.fail(error);
5337
5457
  return _promise.default.reject(error);
5338
5458
  });
5339
5459
  }
@@ -5349,7 +5469,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5349
5469
  }, {
5350
5470
  key: "leave",
5351
5471
  value: function leave() {
5352
- var _this49 = this;
5472
+ var _this48 = this;
5353
5473
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5354
5474
  _metrics.default.postEvent({
5355
5475
  event: _config.eventType.LEAVE,
@@ -5362,39 +5482,39 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5362
5482
  var leaveReason = options.reason || _constants.MEETING_REMOVED_REASON.CLIENT_LEAVE_REQUEST;
5363
5483
  _loggerProxy.default.logger.log('Meeting:index#leave --> Leaving a meeting');
5364
5484
  return _util.default.leaveMeeting(this, options).then(function (leave) {
5365
- _this49.meetingFiniteStateMachine.leave();
5366
- _this49.clearMeetingData();
5485
+ _this48.meetingFiniteStateMachine.leave();
5486
+ _this48.clearMeetingData();
5367
5487
 
5368
5488
  // upload logs on leave irrespective of meeting delete
5369
- _triggerProxy.default.trigger(_this49, {
5489
+ _triggerProxy.default.trigger(_this48, {
5370
5490
  file: 'meeting/index',
5371
5491
  function: 'leave'
5372
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
5492
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this48);
5373
5493
 
5374
5494
  // TODO: more testing before we remove this code, we are not sure the scenarios for destroy here
5375
- if (_this49.wirelessShare || _this49.guest) {
5495
+ if (_this48.wirelessShare || _this48.guest) {
5376
5496
  // If screen sharing clean the meeting object
5377
- _triggerProxy.default.trigger(_this49, {
5497
+ _triggerProxy.default.trigger(_this48, {
5378
5498
  file: 'meeting/index',
5379
5499
  function: 'leave'
5380
5500
  }, _constants.EVENTS.DESTROY_MEETING, {
5381
5501
  reason: options.reason,
5382
- meetingId: _this49.id
5502
+ meetingId: _this48.id
5383
5503
  });
5384
5504
  }
5385
5505
  _loggerProxy.default.logger.log('Meeting:index#leave --> LEAVE REASON ', leaveReason);
5386
5506
  return leave;
5387
5507
  }).catch(function (error) {
5388
- _this49.meetingFiniteStateMachine.fail(error);
5508
+ _this48.meetingFiniteStateMachine.fail(error);
5389
5509
  _loggerProxy.default.logger.error('Meeting:index#leave --> Failed to leave ', error);
5390
5510
  // upload logs on leave irrespective of meeting delete
5391
- _triggerProxy.default.trigger(_this49, {
5511
+ _triggerProxy.default.trigger(_this48, {
5392
5512
  file: 'meeting/index',
5393
5513
  function: 'leave'
5394
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this49);
5514
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this48);
5395
5515
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_LEAVE_FAILURE, {
5396
- correlation_id: _this49.correlationId,
5397
- locus_id: _this49.locusUrl.split('/').pop(),
5516
+ correlation_id: _this48.correlationId,
5517
+ locus_id: _this48.locusUrl.split('/').pop(),
5398
5518
  reason: error.message,
5399
5519
  stack: error.stack,
5400
5520
  code: error.code
@@ -5414,7 +5534,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5414
5534
  }, {
5415
5535
  key: "startWhiteboardShare",
5416
5536
  value: function startWhiteboardShare(channelUrl, resourceToken) {
5417
- var _this50 = this;
5537
+ var _this49 = this;
5418
5538
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
5419
5539
  return element.name === 'whiteboard';
5420
5540
  });
@@ -5437,13 +5557,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5437
5557
  body.resourceToken = resourceToken;
5438
5558
  }
5439
5559
  return this.meetingRequest.changeMeetingFloor(body).then(function () {
5440
- _this50.isSharing = false;
5560
+ _this49.isSharing = false;
5441
5561
  return _promise.default.resolve();
5442
5562
  }).catch(function (error) {
5443
5563
  _loggerProxy.default.logger.error('Meeting:index#startWhiteboardShare --> Error ', error);
5444
5564
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_START_WHITEBOARD_SHARE_FAILURE, {
5445
- correlation_id: _this50.correlationId,
5446
- locus_id: _this50.locusUrl.split('/').pop(),
5565
+ correlation_id: _this49.correlationId,
5566
+ locus_id: _this49.locusUrl.split('/').pop(),
5447
5567
  reason: error.message,
5448
5568
  stack: error.stack,
5449
5569
  board: {
@@ -5466,7 +5586,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5466
5586
  }, {
5467
5587
  key: "stopWhiteboardShare",
5468
5588
  value: function stopWhiteboardShare(channelUrl) {
5469
- var _this51 = this;
5589
+ var _this50 = this;
5470
5590
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
5471
5591
  return element.name === 'whiteboard';
5472
5592
  });
@@ -5485,8 +5605,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5485
5605
  _metrics.default.sendBehavioralMetric(
5486
5606
  // @ts-ignore - check if STOP_WHITEBOARD_SHARE_FAILURE exists
5487
5607
  _constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
5488
- correlation_id: _this51.correlationId,
5489
- locus_id: _this51.locusUrl.split('/').pop(),
5608
+ correlation_id: _this50.correlationId,
5609
+ locus_id: _this50.locusUrl.split('/').pop(),
5490
5610
  reason: error.message,
5491
5611
  stack: error.stack,
5492
5612
  board: {
@@ -5508,7 +5628,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5508
5628
  }, {
5509
5629
  key: "requestScreenShareFloor",
5510
5630
  value: function requestScreenShareFloor() {
5511
- var _this52 = this;
5631
+ var _this51 = this;
5512
5632
  var content = this.locusInfo.mediaShares.find(function (element) {
5513
5633
  return element.name === _constants.CONTENT;
5514
5634
  });
@@ -5524,13 +5644,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5524
5644
  uri: content.url,
5525
5645
  resourceUrl: this.resourceUrl
5526
5646
  }).then(function () {
5527
- _this52.isSharing = true;
5647
+ _this51.isSharing = true;
5528
5648
  return _promise.default.resolve();
5529
5649
  }).catch(function (error) {
5530
5650
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
5531
5651
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_FAILURE, {
5532
- correlation_id: _this52.correlationId,
5533
- locus_id: _this52.locusUrl.split('/').pop(),
5652
+ correlation_id: _this51.correlationId,
5653
+ locus_id: _this51.locusUrl.split('/').pop(),
5534
5654
  reason: error.message,
5535
5655
  stack: error.stack
5536
5656
  });
@@ -5567,7 +5687,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5567
5687
  }, {
5568
5688
  key: "releaseScreenShareFloor",
5569
5689
  value: function releaseScreenShareFloor() {
5570
- var _this53 = this;
5690
+ var _this52 = this;
5571
5691
  var content = this.locusInfo.mediaShares.find(function (element) {
5572
5692
  return element.name === _constants.CONTENT;
5573
5693
  });
@@ -5591,14 +5711,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5591
5711
  }).catch(function (error) {
5592
5712
  _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
5593
5713
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
5594
- correlation_id: _this53.correlationId,
5595
- locus_id: _this53.locusUrl.split('/').pop(),
5714
+ correlation_id: _this52.correlationId,
5715
+ locus_id: _this52.locusUrl.split('/').pop(),
5596
5716
  reason: error.message,
5597
5717
  stack: error.stack
5598
5718
  });
5599
5719
  return _promise.default.reject(error);
5600
5720
  }).finally(function () {
5601
- _this53.isSharing = false;
5721
+ _this52.isSharing = false;
5602
5722
  });
5603
5723
  }
5604
5724
  return _promise.default.reject(new _parameter.default('Cannot stop share without content'));
@@ -5730,7 +5850,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5730
5850
  }, {
5731
5851
  key: "changeVideoLayout",
5732
5852
  value: function changeVideoLayout(layoutType) {
5733
- var _this54 = this;
5853
+ var _this53 = this;
5734
5854
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5735
5855
  var main = renderInfo.main,
5736
5856
  content = renderInfo.content;
@@ -5784,7 +5904,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5784
5904
  }
5785
5905
  this.lastVideoLayoutInfo = (0, _cloneDeep2.default)(layoutInfo);
5786
5906
  this.locusInfo.once(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_LAYOUT_UPDATED, function (envelope) {
5787
- _triggerProxy.default.trigger(_this54, {
5907
+ _triggerProxy.default.trigger(_this53, {
5788
5908
  file: 'meeting/index',
5789
5909
  function: 'changeVideoLayout'
5790
5910
  }, _constants.EVENT_TRIGGERS.MEETING_CONTROLS_LAYOUT_UPDATE, {
@@ -5799,7 +5919,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5799
5919
  content: layoutInfo.content
5800
5920
  }).then(function (response) {
5801
5921
  if (response && response.body && response.body.locus) {
5802
- _this54.locusInfo.onFullLocus(response.body.locus);
5922
+ _this53.locusInfo.onFullLocus(response.body.locus);
5803
5923
  }
5804
5924
  }).catch(function (error) {
5805
5925
  _loggerProxy.default.logger.error('Meeting:index#changeVideoLayout --> Error ', error);
@@ -5815,7 +5935,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5815
5935
  }, {
5816
5936
  key: "setLocalVideoQuality",
5817
5937
  value: function setLocalVideoQuality(level) {
5818
- var _this55 = this;
5938
+ var _this54 = this;
5819
5939
  _loggerProxy.default.logger.log("Meeting:index#setLocalVideoQuality --> Setting quality to ".concat(level));
5820
5940
  if (!_constants.VIDEO_RESOLUTIONS[level]) {
5821
5941
  return this.rejectWithErrorLog("Meeting:index#setLocalVideoQuality --> ".concat(level, " not defined"));
@@ -5844,28 +5964,28 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5844
5964
  // open bug link: https://bugs.chromium.org/p/chromium/issues/detail?id=943469
5845
5965
  if (isBrowser('chrome') && this.mediaProperties.videoTrack) _media.default.stopTracks(this.mediaProperties.videoTrack);
5846
5966
  return this.getMediaStreams(mediaDirection, _constants.VIDEO_RESOLUTIONS[level]).then( /*#__PURE__*/function () {
5847
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(_ref15) {
5848
- var _ref17, localStream;
5849
- return _regenerator.default.wrap(function _callee9$(_context9) {
5850
- while (1) switch (_context9.prev = _context9.next) {
5967
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(_ref17) {
5968
+ var _ref19, localStream;
5969
+ return _regenerator.default.wrap(function _callee11$(_context11) {
5970
+ while (1) switch (_context11.prev = _context11.next) {
5851
5971
  case 0:
5852
- _ref17 = (0, _slicedToArray2.default)(_ref15, 1), localStream = _ref17[0];
5853
- _context9.next = 3;
5854
- return _this55.updateVideo({
5972
+ _ref19 = (0, _slicedToArray2.default)(_ref17, 1), localStream = _ref19[0];
5973
+ _context11.next = 3;
5974
+ return _this54.updateVideo({
5855
5975
  sendVideo: true,
5856
5976
  receiveVideo: true,
5857
5977
  stream: localStream
5858
5978
  });
5859
5979
  case 3:
5860
- return _context9.abrupt("return", localStream);
5980
+ return _context11.abrupt("return", localStream);
5861
5981
  case 4:
5862
5982
  case "end":
5863
- return _context9.stop();
5983
+ return _context11.stop();
5864
5984
  }
5865
- }, _callee9);
5985
+ }, _callee11);
5866
5986
  }));
5867
- return function (_x5) {
5868
- return _ref16.apply(this, arguments);
5987
+ return function (_x6) {
5988
+ return _ref18.apply(this, arguments);
5869
5989
  };
5870
5990
  }());
5871
5991
  }
@@ -5908,7 +6028,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5908
6028
  }, {
5909
6029
  key: "setMeetingQuality",
5910
6030
  value: function setMeetingQuality(level) {
5911
- var _this56 = this;
6031
+ var _this55 = this;
5912
6032
  _loggerProxy.default.logger.log("Meeting:index#setMeetingQuality --> Setting quality to ".concat(level));
5913
6033
  if (!_constants.QUALITY_LEVELS[level]) {
5914
6034
  return this.rejectWithErrorLog("Meeting:index#setMeetingQuality --> ".concat(level, " not defined"));
@@ -5930,15 +6050,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5930
6050
  receiveVideo = _this$mediaProperties4.receiveVideo,
5931
6051
  sendVideo = _this$mediaProperties4.sendVideo;
5932
6052
  return (sendVideo ? this.setLocalVideoQuality(level) : _promise.default.resolve()).then(function () {
5933
- return receiveAudio || receiveVideo ? _this56.setRemoteQualityLevel(level) : _promise.default.resolve();
6053
+ return receiveAudio || receiveVideo ? _this55.setRemoteQualityLevel(level) : _promise.default.resolve();
5934
6054
  }).catch(function (error) {
5935
6055
  // From troubleshooting it seems that the stream itself doesn't change the max-fs if the peer connection isn't stable
5936
- _this56.mediaProperties.setLocalQualityLevel(previousLevel.local);
5937
- _this56.mediaProperties.setRemoteQualityLevel(previousLevel.remote);
6056
+ _this55.mediaProperties.setLocalQualityLevel(previousLevel.local);
6057
+ _this55.mediaProperties.setRemoteQualityLevel(previousLevel.remote);
5938
6058
  _loggerProxy.default.logger.error("Meeting:index#setMeetingQuality --> ".concat(error.message));
5939
6059
  _metrics.default.sendBehavioralMetric(_constants2.default.SET_MEETING_QUALITY_FAILURE, {
5940
- correlation_id: _this56.correlationId,
5941
- locus_id: _this56.locusUrl.split('/').pop(),
6060
+ correlation_id: _this55.correlationId,
6061
+ locus_id: _this55.locusUrl.split('/').pop(),
5942
6062
  reason: error.message,
5943
6063
  stack: error.stack
5944
6064
  }, {
@@ -5964,7 +6084,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5964
6084
  }, {
5965
6085
  key: "shareScreen",
5966
6086
  value: function shareScreen() {
5967
- var _this57 = this;
6087
+ var _this56 = this;
5968
6088
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5969
6089
  _loggerProxy.default.logger.log('Meeting:index#shareScreen --> Getting local share');
5970
6090
  var shareConstraints = _objectSpread({
@@ -5974,9 +6094,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5974
6094
 
5975
6095
  // @ts-ignore - config coming from registerPlugin
5976
6096
  return _media.default.getDisplayMedia(shareConstraints, this.config).then(function (shareStream) {
5977
- return _this57.updateShare({
6097
+ return _this56.updateShare({
5978
6098
  sendShare: true,
5979
- receiveShare: _this57.mediaProperties.mediaDirection.receiveShare,
6099
+ receiveShare: _this56.mediaProperties.mediaDirection.receiveShare,
5980
6100
  stream: shareStream
5981
6101
  });
5982
6102
  }).catch(function (error) {
@@ -5989,8 +6109,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5989
6109
  // TODO: The getDisplayMedia errors need to be moved inside `media.getDisplayMedia`
5990
6110
  var metricName = _constants2.default.GET_DISPLAY_MEDIA_FAILURE;
5991
6111
  var data = {
5992
- correlation_id: _this57.correlationId,
5993
- locus_id: _this57.locusUrl.split('/').pop(),
6112
+ correlation_id: _this56.correlationId,
6113
+ locus_id: _this56.locusUrl.split('/').pop(),
5994
6114
  reason: error.message,
5995
6115
  stack: error.stack
5996
6116
  };
@@ -6010,30 +6130,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6010
6130
  * @returns {undefined}
6011
6131
  */
6012
6132
  }, {
6013
- key: "handleShareTrackEnded",
6014
- value: function handleShareTrackEnded(localShare) {
6015
- if (this.wirelessShare) {
6016
- this.leave({
6017
- reason: _constants.MEETING_REMOVED_REASON.USER_ENDED_SHARE_STREAMS
6018
- });
6019
- } else {
6020
- // Skip checking for a stable peerConnection
6021
- // to allow immediately stopping screenshare
6022
- this.stopShare({
6023
- skipSignalingCheck: true
6024
- }).catch(function (error) {
6025
- _loggerProxy.default.logger.log('Meeting:index#handleShareTrackEnded --> Error stopping share: ', error);
6026
- });
6027
- }
6028
- _triggerProxy.default.trigger(this, {
6029
- file: 'meeting/index',
6030
- function: 'handleShareTrackEnded'
6031
- }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
6032
- type: _constants.EVENT_TYPES.LOCAL_SHARE,
6033
- stream: localShare
6034
- });
6035
- }
6036
-
6133
+ key: "sendNetworkQualityEvent",
6134
+ value:
6037
6135
  /**
6038
6136
  * Emits the 'network:quality' event
6039
6137
  * 1 indicates an acceptable uplink network.
@@ -6045,9 +6143,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6045
6143
  * @private
6046
6144
  * @memberof Meeting
6047
6145
  */
6048
- }, {
6049
- key: "sendNetworkQualityEvent",
6050
- value: function sendNetworkQualityEvent(res) {
6146
+ function sendNetworkQualityEvent(res) {
6051
6147
  _triggerProxy.default.trigger(this, {
6052
6148
  file: 'meeting/index',
6053
6149
  function: 'addMedia'
@@ -6066,9 +6162,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6066
6162
  */
6067
6163
  }, {
6068
6164
  key: "handleMediaLogging",
6069
- value: function handleMediaLogging(_ref18) {
6070
- var audioTrack = _ref18.audioTrack,
6071
- videoTrack = _ref18.videoTrack;
6165
+ value: function handleMediaLogging(_ref20) {
6166
+ var audioTrack = _ref20.audioTrack,
6167
+ videoTrack = _ref20.videoTrack;
6072
6168
  _util.default.handleVideoLogging(videoTrack);
6073
6169
  _util.default.handleAudioLogging(audioTrack);
6074
6170
  }
@@ -6275,7 +6371,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6275
6371
  }, {
6276
6372
  key: "endMeetingForAll",
6277
6373
  value: function endMeetingForAll() {
6278
- var _this58 = this;
6374
+ var _this57 = this;
6279
6375
  _metrics.default.postEvent({
6280
6376
  event: _config.eventType.LEAVE,
6281
6377
  meeting: this,
@@ -6290,25 +6386,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6290
6386
  locus_id: this.locusId
6291
6387
  });
6292
6388
  return _util.default.endMeetingForAll(this).then(function (end) {
6293
- _this58.meetingFiniteStateMachine.end();
6294
- _this58.clearMeetingData();
6389
+ _this57.meetingFiniteStateMachine.end();
6390
+ _this57.clearMeetingData();
6295
6391
  // upload logs on leave irrespective of meeting delete
6296
- _triggerProxy.default.trigger(_this58, {
6392
+ _triggerProxy.default.trigger(_this57, {
6297
6393
  file: 'meeting/index',
6298
6394
  function: 'endMeetingForAll'
6299
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this58);
6395
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this57);
6300
6396
  return end;
6301
6397
  }).catch(function (error) {
6302
- _this58.meetingFiniteStateMachine.fail(error);
6398
+ _this57.meetingFiniteStateMachine.fail(error);
6303
6399
  _loggerProxy.default.logger.error('Meeting:index#endMeetingForAll --> Failed to end meeting ', error);
6304
6400
  // upload logs on leave irrespective of meeting delete
6305
- _triggerProxy.default.trigger(_this58, {
6401
+ _triggerProxy.default.trigger(_this57, {
6306
6402
  file: 'meeting/index',
6307
6403
  function: 'endMeetingForAll'
6308
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this58);
6404
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this57);
6309
6405
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_END_ALL_FAILURE, {
6310
- correlation_id: _this58.correlationId,
6311
- locus_id: _this58.locusUrl.split('/').pop(),
6406
+ correlation_id: _this57.correlationId,
6407
+ locus_id: _this57.locusUrl.split('/').pop(),
6312
6408
  reason: error.message,
6313
6409
  stack: error.stack,
6314
6410
  code: error.code
@@ -6346,31 +6442,31 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6346
6442
  }, {
6347
6443
  key: "internal_enableBNR",
6348
6444
  value: function () {
6349
- var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(audioTrack) {
6445
+ var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(audioTrack) {
6350
6446
  var bnrAudioTrack;
6351
- return _regenerator.default.wrap(function _callee10$(_context10) {
6352
- while (1) switch (_context10.prev = _context10.next) {
6447
+ return _regenerator.default.wrap(function _callee12$(_context12) {
6448
+ while (1) switch (_context12.prev = _context12.next) {
6353
6449
  case 0:
6354
- _context10.prev = 0;
6450
+ _context12.prev = 0;
6355
6451
  _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
6356
- _context10.next = 4;
6452
+ _context12.next = 4;
6357
6453
  return _internalMediaCore.Media.Effects.BNR.enableBNR(audioTrack);
6358
6454
  case 4:
6359
- bnrAudioTrack = _context10.sent;
6455
+ bnrAudioTrack = _context12.sent;
6360
6456
  _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
6361
- return _context10.abrupt("return", bnrAudioTrack);
6457
+ return _context12.abrupt("return", bnrAudioTrack);
6362
6458
  case 9:
6363
- _context10.prev = 9;
6364
- _context10.t0 = _context10["catch"](0);
6365
- _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context10.t0);
6366
- throw _context10.t0;
6459
+ _context12.prev = 9;
6460
+ _context12.t0 = _context12["catch"](0);
6461
+ _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context12.t0);
6462
+ throw _context12.t0;
6367
6463
  case 13:
6368
6464
  case "end":
6369
- return _context10.stop();
6465
+ return _context12.stop();
6370
6466
  }
6371
- }, _callee10, null, [[0, 9]]);
6467
+ }, _callee12, null, [[0, 9]]);
6372
6468
  }));
6373
- function internal_enableBNR(_x6) {
6469
+ function internal_enableBNR(_x7) {
6374
6470
  return _internal_enableBNR.apply(this, arguments);
6375
6471
  }
6376
6472
  return internal_enableBNR;
@@ -6495,6 +6591,139 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6495
6591
  requestingParticipantId: this.members.selfId
6496
6592
  });
6497
6593
  }
6594
+
6595
+ /**
6596
+ * Throws if we don't have a media connection created
6597
+ *
6598
+ * @returns {void}
6599
+ */
6600
+ }, {
6601
+ key: "checkMediaConnection",
6602
+ value: function checkMediaConnection() {
6603
+ var _this$mediaProperties5;
6604
+ if ((_this$mediaProperties5 = this.mediaProperties) !== null && _this$mediaProperties5 !== void 0 && _this$mediaProperties5.webrtcMediaConnection) {
6605
+ return;
6606
+ }
6607
+ throw new Error('Webrtc media connection is missing, call addMedia() first');
6608
+ }
6609
+
6610
+ /**
6611
+ * Publishes specified local tracks in the meeting
6612
+ *
6613
+ * @param {Object} tracks
6614
+ * @returns {Promise}
6615
+ */
6616
+ }, {
6617
+ key: "publishTracks",
6618
+ value: function () {
6619
+ var _publishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(tracks) {
6620
+ var _tracks$screenShare;
6621
+ return _regenerator.default.wrap(function _callee13$(_context13) {
6622
+ while (1) switch (_context13.prev = _context13.next) {
6623
+ case 0:
6624
+ this.checkMediaConnection();
6625
+ if (!((_tracks$screenShare = tracks.screenShare) !== null && _tracks$screenShare !== void 0 && _tracks$screenShare.video)) {
6626
+ _context13.next = 8;
6627
+ break;
6628
+ }
6629
+ // we are starting a screen share
6630
+ this.setLocalShareTrack(tracks.screenShare.video);
6631
+ _context13.next = 5;
6632
+ return this.requestScreenShareFloor();
6633
+ case 5:
6634
+ this.mediaProperties.mediaDirection.sendShare = true;
6635
+ _context13.next = 8;
6636
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.screenShare.video, 'slides');
6637
+ case 8:
6638
+ if (!tracks.microphone) {
6639
+ _context13.next = 14;
6640
+ break;
6641
+ }
6642
+ this.setLocalAudioTrack(tracks.microphone);
6643
+ this.mediaProperties.mediaDirection.sendAudio = true;
6644
+
6645
+ // audio mute state could be undefined if you have not sent audio before
6646
+ this.audio = this.audio || (0, _muteState.createMuteState)(_constants.AUDIO, this, this.mediaProperties.mediaDirection);
6647
+ _context13.next = 14;
6648
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.microphone, 'main');
6649
+ case 14:
6650
+ if (!tracks.camera) {
6651
+ _context13.next = 20;
6652
+ break;
6653
+ }
6654
+ this.setLocalVideoTrack(tracks.camera);
6655
+ this.mediaProperties.mediaDirection.sendVideo = true;
6656
+
6657
+ // video state could be undefined if you have not sent video before
6658
+ this.video = this.video || (0, _muteState.createMuteState)(_constants.VIDEO, this, this.mediaProperties.mediaDirection);
6659
+ _context13.next = 20;
6660
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.camera, 'main');
6661
+ case 20:
6662
+ case "end":
6663
+ return _context13.stop();
6664
+ }
6665
+ }, _callee13, this);
6666
+ }));
6667
+ function publishTracks(_x8) {
6668
+ return _publishTracks.apply(this, arguments);
6669
+ }
6670
+ return publishTracks;
6671
+ }()
6672
+ /**
6673
+ * Un-publishes specified local tracks in the meeting
6674
+ *
6675
+ * @param {Array<MediaStreamTrack>} tracks
6676
+ * @returns {Promise}
6677
+ */
6678
+ }, {
6679
+ key: "unpublishTracks",
6680
+ value: function () {
6681
+ var _unpublishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(tracks) {
6682
+ var unpublishPromises, _iterator, _step, track;
6683
+ return _regenerator.default.wrap(function _callee14$(_context14) {
6684
+ while (1) switch (_context14.prev = _context14.next) {
6685
+ case 0:
6686
+ this.checkMediaConnection();
6687
+ unpublishPromises = [];
6688
+ _iterator = _createForOfIteratorHelper(tracks);
6689
+ try {
6690
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6691
+ track = _step.value;
6692
+ if (track === this.mediaProperties.shareTrack) {
6693
+ this.setLocalShareTrack(null);
6694
+ this.releaseScreenShareFloor(); // we ignore the returned promise here on purpose
6695
+ this.mediaProperties.mediaDirection.sendShare = false;
6696
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'slides'));
6697
+ }
6698
+ if (track === this.mediaProperties.audioTrack) {
6699
+ this.setLocalAudioTrack(null);
6700
+ this.mediaProperties.mediaDirection.sendAudio = false;
6701
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'main'));
6702
+ }
6703
+ if (track === this.mediaProperties.videoTrack) {
6704
+ this.setLocalVideoTrack(null);
6705
+ this.mediaProperties.mediaDirection.sendVideo = false;
6706
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'main'));
6707
+ }
6708
+ }
6709
+ } catch (err) {
6710
+ _iterator.e(err);
6711
+ } finally {
6712
+ _iterator.f();
6713
+ }
6714
+ _context14.next = 6;
6715
+ return _promise.default.all(unpublishPromises);
6716
+ case 6:
6717
+ case "end":
6718
+ return _context14.stop();
6719
+ }
6720
+ }, _callee14, this);
6721
+ }));
6722
+ function unpublishTracks(_x9) {
6723
+ return _unpublishTracks.apply(this, arguments);
6724
+ }
6725
+ return unpublishTracks;
6726
+ }()
6498
6727
  }]);
6499
6728
  return Meeting;
6500
6729
  }(_webexCore.StatelessWebexPlugin);