@webex/plugin-meetings 3.0.0-beta.1 → 3.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/dist/common/browser-detection.js.map +1 -1
  2. package/dist/common/collection.js.map +1 -1
  3. package/dist/common/config.js.map +1 -1
  4. package/dist/common/errors/captcha-error.js +7 -0
  5. package/dist/common/errors/captcha-error.js.map +1 -1
  6. package/dist/common/errors/intent-to-join.js +8 -0
  7. package/dist/common/errors/intent-to-join.js.map +1 -1
  8. package/dist/common/errors/join-meeting.js +8 -0
  9. package/dist/common/errors/join-meeting.js.map +1 -1
  10. package/dist/common/errors/media.js +7 -0
  11. package/dist/common/errors/media.js.map +1 -1
  12. package/dist/common/errors/parameter.js.map +1 -1
  13. package/dist/common/errors/password-error.js +7 -0
  14. package/dist/common/errors/password-error.js.map +1 -1
  15. package/dist/common/errors/permission.js +7 -0
  16. package/dist/common/errors/permission.js.map +1 -1
  17. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  18. package/dist/common/errors/reconnection.js +7 -0
  19. package/dist/common/errors/reconnection.js.map +1 -1
  20. package/dist/common/errors/stats.js +7 -0
  21. package/dist/common/errors/stats.js.map +1 -1
  22. package/dist/common/errors/webex-errors.js +5 -29
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/errors/webex-meetings-error.js +5 -2
  25. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  26. package/dist/common/events/events-scope.js.map +1 -1
  27. package/dist/common/events/events.js.map +1 -1
  28. package/dist/common/events/trigger-proxy.js.map +1 -1
  29. package/dist/common/events/util.js.map +1 -1
  30. package/dist/common/logs/logger-config.js.map +1 -1
  31. package/dist/common/logs/logger-proxy.js.map +1 -1
  32. package/dist/common/logs/request.js +3 -0
  33. package/dist/common/logs/request.js.map +1 -1
  34. package/dist/common/queue.js.map +1 -1
  35. package/dist/config.js +1 -0
  36. package/dist/config.js.map +1 -1
  37. package/dist/constants.js +15 -74
  38. package/dist/constants.js.map +1 -1
  39. package/dist/locus-info/controlsUtils.js.map +1 -1
  40. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  41. package/dist/locus-info/fullState.js.map +1 -1
  42. package/dist/locus-info/hostUtils.js.map +1 -1
  43. package/dist/locus-info/index.js +43 -5
  44. package/dist/locus-info/index.js.map +1 -1
  45. package/dist/locus-info/infoUtils.js +4 -0
  46. package/dist/locus-info/infoUtils.js.map +1 -1
  47. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  48. package/dist/locus-info/parser.js +12 -3
  49. package/dist/locus-info/parser.js.map +1 -1
  50. package/dist/locus-info/selfUtils.js.map +1 -1
  51. package/dist/media/index.js +71 -210
  52. package/dist/media/index.js.map +1 -1
  53. package/dist/media/internal-media-core-wrapper.js +22 -0
  54. package/dist/media/internal-media-core-wrapper.js.map +1 -0
  55. package/dist/media/properties.js +32 -25
  56. package/dist/media/properties.js.map +1 -1
  57. package/dist/media/util.js +0 -27
  58. package/dist/media/util.js.map +1 -1
  59. package/dist/mediaQualityMetrics/config.js.map +1 -1
  60. package/dist/meeting/effectsState.js +8 -1
  61. package/dist/meeting/effectsState.js.map +1 -1
  62. package/dist/meeting/index.js +1116 -613
  63. package/dist/meeting/index.js.map +1 -1
  64. package/dist/meeting/muteState.js +6 -0
  65. package/dist/meeting/muteState.js.map +1 -1
  66. package/dist/meeting/request.js +55 -24
  67. package/dist/meeting/request.js.map +1 -1
  68. package/dist/meeting/state.js.map +1 -1
  69. package/dist/meeting/util.js +5 -44
  70. package/dist/meeting/util.js.map +1 -1
  71. package/dist/meeting-info/collection.js +4 -1
  72. package/dist/meeting-info/collection.js.map +1 -1
  73. package/dist/meeting-info/index.js +5 -0
  74. package/dist/meeting-info/index.js.map +1 -1
  75. package/dist/meeting-info/meeting-info-v2.js +14 -2
  76. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  77. package/dist/meeting-info/request.js +3 -0
  78. package/dist/meeting-info/request.js.map +1 -1
  79. package/dist/meeting-info/util.js.map +1 -1
  80. package/dist/meeting-info/utilv2.js.map +1 -1
  81. package/dist/meetings/collection.js +4 -1
  82. package/dist/meetings/collection.js.map +1 -1
  83. package/dist/meetings/index.js +136 -25
  84. package/dist/meetings/index.js.map +1 -1
  85. package/dist/meetings/request.js +4 -0
  86. package/dist/meetings/request.js.map +1 -1
  87. package/dist/meetings/util.js +24 -1
  88. package/dist/meetings/util.js.map +1 -1
  89. package/dist/member/index.js +30 -7
  90. package/dist/member/index.js.map +1 -1
  91. package/dist/member/util.js +2 -1
  92. package/dist/member/util.js.map +1 -1
  93. package/dist/members/collection.js +1 -0
  94. package/dist/members/collection.js.map +1 -1
  95. package/dist/members/index.js +82 -1
  96. package/dist/members/index.js.map +1 -1
  97. package/dist/members/request.js +19 -9
  98. package/dist/members/request.js.map +1 -1
  99. package/dist/members/util.js.map +1 -1
  100. package/dist/metrics/config.js.map +1 -1
  101. package/dist/metrics/constants.js.map +1 -1
  102. package/dist/metrics/index.js +8 -0
  103. package/dist/metrics/index.js.map +1 -1
  104. package/dist/multistream/mediaRequestManager.js +133 -0
  105. package/dist/multistream/mediaRequestManager.js.map +1 -0
  106. package/dist/multistream/multistreamMedia.js +116 -0
  107. package/dist/multistream/multistreamMedia.js.map +1 -0
  108. package/dist/multistream/receiveSlot.js +209 -0
  109. package/dist/multistream/receiveSlot.js.map +1 -0
  110. package/dist/multistream/receiveSlotManager.js +195 -0
  111. package/dist/multistream/receiveSlotManager.js.map +1 -0
  112. package/dist/multistream/remoteMedia.js +289 -0
  113. package/dist/multistream/remoteMedia.js.map +1 -0
  114. package/dist/multistream/remoteMediaGroup.js +243 -0
  115. package/dist/multistream/remoteMediaGroup.js.map +1 -0
  116. package/dist/multistream/remoteMediaManager.js +1113 -0
  117. package/dist/multistream/remoteMediaManager.js.map +1 -0
  118. package/dist/networkQualityMonitor/index.js +10 -2
  119. package/dist/networkQualityMonitor/index.js.map +1 -1
  120. package/dist/personal-meeting-room/index.js +11 -0
  121. package/dist/personal-meeting-room/index.js.map +1 -1
  122. package/dist/personal-meeting-room/request.js +2 -1
  123. package/dist/personal-meeting-room/request.js.map +1 -1
  124. package/dist/personal-meeting-room/util.js.map +1 -1
  125. package/dist/reachability/index.js +17 -7
  126. package/dist/reachability/index.js.map +1 -1
  127. package/dist/reachability/request.js +1 -0
  128. package/dist/reachability/request.js.map +1 -1
  129. package/dist/reconnection-manager/index.js +130 -132
  130. package/dist/reconnection-manager/index.js.map +1 -1
  131. package/dist/roap/index.js +58 -231
  132. package/dist/roap/index.js.map +1 -1
  133. package/dist/roap/request.js +7 -116
  134. package/dist/roap/request.js.map +1 -1
  135. package/dist/roap/turnDiscovery.js +20 -6
  136. package/dist/roap/turnDiscovery.js.map +1 -1
  137. package/dist/statsAnalyzer/global.js +2 -0
  138. package/dist/statsAnalyzer/global.js.map +1 -1
  139. package/dist/statsAnalyzer/index.js +58 -37
  140. package/dist/statsAnalyzer/index.js.map +1 -1
  141. package/dist/statsAnalyzer/mqaUtil.js +9 -3
  142. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  143. package/dist/transcription/index.js +10 -3
  144. package/dist/transcription/index.js.map +1 -1
  145. package/package.json +21 -20
  146. package/src/common/{browser-detection.js → browser-detection.ts} +1 -1
  147. package/src/common/collection.ts +6 -6
  148. package/src/common/{config.js → config.ts} +1 -1
  149. package/src/common/errors/{captcha-error.js → captcha-error.ts} +5 -1
  150. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +6 -1
  151. package/src/common/errors/{join-meeting.js → join-meeting.ts} +6 -1
  152. package/src/common/errors/{media.js → media.ts} +5 -1
  153. package/src/common/errors/parameter.ts +3 -2
  154. package/src/common/errors/{password-error.js → password-error.ts} +5 -1
  155. package/src/common/errors/{permission.js → permission.ts} +5 -1
  156. package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
  157. package/src/common/errors/{reconnection.js → reconnection.ts} +5 -1
  158. package/src/common/errors/{stats.js → stats.ts} +5 -1
  159. package/src/common/errors/{webex-errors.js → webex-errors.ts} +1 -20
  160. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +3 -1
  161. package/src/common/events/{events-scope.js → events-scope.ts} +1 -1
  162. package/src/common/events/{events.js → events.ts} +0 -0
  163. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +1 -2
  164. package/src/common/events/{util.js → util.ts} +1 -1
  165. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  166. package/src/common/logs/{logger-proxy.js → logger-proxy.ts} +1 -1
  167. package/src/common/logs/{request.js → request.ts} +12 -2
  168. package/src/common/queue.ts +1 -2
  169. package/src/{config.js → config.ts} +2 -0
  170. package/src/constants.ts +139 -179
  171. package/src/locus-info/{controlsUtils.js → controlsUtils.ts} +4 -4
  172. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  173. package/src/locus-info/{fullState.js → fullState.ts} +1 -1
  174. package/src/locus-info/{hostUtils.js → hostUtils.ts} +5 -5
  175. package/src/locus-info/{index.js → index.ts} +67 -32
  176. package/src/locus-info/{infoUtils.js → infoUtils.ts} +7 -4
  177. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +13 -13
  178. package/src/locus-info/{parser.js → parser.ts} +22 -12
  179. package/src/locus-info/{selfUtils.js → selfUtils.ts} +17 -19
  180. package/src/media/{index.js → index.ts} +130 -205
  181. package/src/media/internal-media-core-wrapper.ts +9 -0
  182. package/src/media/{properties.js → properties.ts} +35 -29
  183. package/src/media/util.ts +16 -0
  184. package/src/mediaQualityMetrics/{config.js → config.ts} +1 -1
  185. package/src/meeting/{effectsState.js → effectsState.ts} +12 -6
  186. package/src/meeting/{index.js → index.ts} +961 -474
  187. package/src/meeting/{muteState.js → muteState.ts} +16 -11
  188. package/src/meeting/{request.js → request.ts} +125 -36
  189. package/src/meeting/{state.js → state.ts} +6 -6
  190. package/src/meeting/{util.js → util.ts} +9 -51
  191. package/src/meeting-info/{collection.js → collection.ts} +4 -1
  192. package/src/meeting-info/{index.js → index.ts} +10 -6
  193. package/src/meeting-info/{meeting-info-v2.js → meeting-info-v2.ts} +28 -10
  194. package/src/meeting-info/{request.js → request.ts} +6 -2
  195. package/src/meeting-info/{util.js → util.ts} +6 -5
  196. package/src/meeting-info/{utilv2.js → utilv2.ts} +8 -7
  197. package/src/meetings/{collection.js → collection.ts} +5 -2
  198. package/src/meetings/{index.js → index.ts} +118 -22
  199. package/src/meetings/{request.js → request.ts} +6 -1
  200. package/src/meetings/{util.js → util.ts} +28 -5
  201. package/src/member/{index.js → index.ts} +46 -15
  202. package/src/member/{util.js → util.ts} +17 -16
  203. package/src/members/{collection.js → collection.ts} +2 -1
  204. package/src/members/{index.js → index.ts} +94 -26
  205. package/src/members/{request.js → request.ts} +16 -5
  206. package/src/members/{util.js → util.ts} +7 -7
  207. package/src/metrics/{config.js → config.ts} +0 -2
  208. package/src/metrics/{constants.js → constants.ts} +0 -0
  209. package/src/metrics/{index.js → index.ts} +27 -8
  210. package/src/multistream/mediaRequestManager.ts +166 -0
  211. package/src/multistream/multistreamMedia.ts +92 -0
  212. package/src/multistream/receiveSlot.ts +141 -0
  213. package/src/multistream/receiveSlotManager.ts +142 -0
  214. package/src/multistream/remoteMedia.ts +228 -0
  215. package/src/multistream/remoteMediaGroup.ts +224 -0
  216. package/src/multistream/remoteMediaManager.ts +911 -0
  217. package/src/networkQualityMonitor/{index.js → index.ts} +18 -3
  218. package/src/personal-meeting-room/{index.js → index.ts} +17 -4
  219. package/src/personal-meeting-room/{request.js → request.ts} +3 -1
  220. package/src/personal-meeting-room/{util.js → util.ts} +1 -1
  221. package/src/reachability/{index.js → index.ts} +28 -17
  222. package/src/reachability/request.ts +4 -2
  223. package/src/reconnection-manager/{index.js → index.ts} +81 -65
  224. package/src/roap/index.ts +229 -0
  225. package/src/roap/{request.js → request.ts} +15 -74
  226. package/src/roap/turnDiscovery.ts +26 -11
  227. package/src/statsAnalyzer/{global.js → global.ts} +2 -0
  228. package/src/statsAnalyzer/{index.js → index.ts} +66 -61
  229. package/src/statsAnalyzer/{mqaUtil.js → mqaUtil.ts} +6 -1
  230. package/src/transcription/{index.js → index.ts} +16 -11
  231. package/test/integration/spec/journey.js +1 -1
  232. package/test/integration/spec/space-meeting.js +1 -2
  233. package/test/unit/spec/locus-info/infoUtils.js +17 -1
  234. package/test/unit/spec/media/index.ts +207 -0
  235. package/test/unit/spec/media/properties.ts +73 -82
  236. package/test/unit/spec/meeting/effectsState.js +1 -3
  237. package/test/unit/spec/meeting/index.js +585 -245
  238. package/test/unit/spec/meeting/muteState.js +7 -0
  239. package/test/unit/spec/meeting/utils.js +63 -2
  240. package/test/unit/spec/meetings/index.js +0 -4
  241. package/test/unit/spec/members/index.js +164 -2
  242. package/test/unit/spec/multistream/mediaRequestManager.ts +515 -0
  243. package/test/unit/spec/multistream/receiveSlot.ts +104 -0
  244. package/test/unit/spec/multistream/receiveSlotManager.ts +173 -0
  245. package/test/unit/spec/multistream/remoteMedia.ts +225 -0
  246. package/test/unit/spec/multistream/remoteMediaGroup.ts +396 -0
  247. package/test/unit/spec/multistream/remoteMediaManager.ts +1309 -0
  248. package/test/unit/spec/reconnection-manager/index.js +68 -2
  249. package/test/unit/spec/roap/index.ts +63 -35
  250. package/test/unit/spec/stats-analyzer/index.js +19 -22
  251. package/dist/peer-connection-manager/index.js +0 -794
  252. package/dist/peer-connection-manager/index.js.map +0 -1
  253. package/dist/peer-connection-manager/util.js +0 -124
  254. package/dist/peer-connection-manager/util.js.map +0 -1
  255. package/dist/roap/collection.js +0 -73
  256. package/dist/roap/collection.js.map +0 -1
  257. package/dist/roap/handler.js +0 -337
  258. package/dist/roap/handler.js.map +0 -1
  259. package/dist/roap/state.js +0 -164
  260. package/dist/roap/state.js.map +0 -1
  261. package/dist/roap/util.js +0 -102
  262. package/dist/roap/util.js.map +0 -1
  263. package/src/media/util.js +0 -38
  264. package/src/peer-connection-manager/index.js +0 -723
  265. package/src/peer-connection-manager/util.ts +0 -117
  266. package/src/roap/collection.js +0 -63
  267. package/src/roap/handler.js +0 -252
  268. package/src/roap/index.js +0 -380
  269. package/src/roap/state.js +0 -149
  270. package/src/roap/util.js +0 -93
  271. package/test/unit/spec/peerconnection-manager/index.js +0 -188
  272. package/test/unit/spec/peerconnection-manager/utils.js +0 -48
  273. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
  274. package/test/unit/spec/roap/util.js +0 -30
@@ -12,11 +12,11 @@ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/
12
12
 
13
13
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
14
14
 
15
- var _Object$defineProperty2 = require("@babel/runtime-corejs2/core-js/object/define-property");
15
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
16
16
 
17
17
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
18
18
 
19
- _Object$defineProperty2(exports, "__esModule", {
19
+ _Object$defineProperty(exports, "__esModule", {
20
20
  value: true
21
21
  });
22
22
 
@@ -28,10 +28,10 @@ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/objec
28
28
 
29
29
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
30
30
 
31
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));
32
-
33
31
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
34
32
 
33
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
34
+
35
35
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
36
36
 
37
37
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
@@ -52,7 +52,9 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
52
52
 
53
53
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
54
54
 
55
- var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
55
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
56
+
57
+ var _defer2 = _interopRequireDefault(require("lodash/defer"));
56
58
 
57
59
  var _isString2 = _interopRequireDefault(require("lodash/isString"));
58
60
 
@@ -92,8 +94,6 @@ var _effectsState = _interopRequireDefault(require("../meeting/effectsState"));
92
94
 
93
95
  var _locusInfo = _interopRequireDefault(require("../locus-info"));
94
96
 
95
- var _peerConnectionManager = _interopRequireDefault(require("../peer-connection-manager"));
96
-
97
97
  var _metrics = _interopRequireDefault(require("../metrics"));
98
98
 
99
99
  var _config = require("../metrics/config");
@@ -130,13 +130,19 @@ var _meetingInfoV = require("../meeting-info/meeting-info-v2");
130
130
 
131
131
  var _browserDetection = _interopRequireDefault(require("../common/browser-detection"));
132
132
 
133
- var _collection = _interopRequireDefault(require("../roap/collection"));
133
+ var _receiveSlotManager = require("../multistream/receiveSlotManager");
134
+
135
+ var _mediaRequestManager = require("../multistream/mediaRequestManager");
136
+
137
+ var _remoteMediaManager = require("../multistream/remoteMediaManager");
138
+
139
+ var _multistreamMedia = require("../multistream/multistreamMedia");
134
140
 
135
141
  var _inMeetingActions = _interopRequireDefault(require("./in-meeting-actions"));
136
142
 
137
143
  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; }
138
144
 
139
- 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, _defineProperty3.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty2(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
145
+ 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; }
140
146
 
141
147
  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); }; }
142
148
 
@@ -211,6 +217,7 @@ var MEDIA_UPDATE_TYPE = {
211
217
  * @property {String} [meetingQuality.local]
212
218
  * @property {String} [meetingQuality.remote]
213
219
  * @property {Boolean} [rejoin]
220
+ * @property {Boolean} [enableMultistream]
214
221
  */
215
222
 
216
223
  /**
@@ -485,8 +492,90 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
485
492
  * @memberof Meeting
486
493
  */
487
494
 
488
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
489
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "getMediaStreams", function (mediaDirection) {
495
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "attrs", void 0);
496
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "audio", void 0);
497
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "conversationUrl", void 0);
498
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "correlationId", void 0);
499
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destination", void 0);
500
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destinationType", void 0);
501
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deviceUrl", void 0);
502
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "effects", void 0);
503
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hostId", void 0);
504
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "id", void 0);
505
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMultistream", void 0);
506
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusUrl", void 0);
507
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaConnections", void 0);
508
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaId", void 0);
509
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingFiniteStateMachine", void 0);
510
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfo", void 0);
511
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingRequest", void 0);
512
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "members", void 0);
513
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "options", void 0);
514
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "orgId", void 0);
515
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "owner", void 0);
516
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "partner", void 0);
517
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "policy", void 0);
518
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reconnectionManager", void 0);
519
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resource", void 0);
520
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roap", void 0);
521
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roapSeq", void 0);
522
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sipUri", void 0);
523
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", void 0);
524
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "userId", void 0);
525
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "video", void 0);
526
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callEvents", void 0);
527
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deferJoin", void 0);
528
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dialInDeviceStatus", void 0);
529
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dialInUrl", void 0);
530
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dialOutDeviceStatus", void 0);
531
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dialOutUrl", void 0);
532
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fetchMeetingInfoTimeoutId", void 0);
533
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "floorGrantPending", void 0);
534
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasJoinedOnce", void 0);
535
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasWebsocketConnected", void 0);
536
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "inMeetingActions", void 0);
537
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isLocalShareLive", void 0);
538
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isRoapInProgress", void 0);
539
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isSharing", void 0);
540
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "keepAliveTimerId", void 0);
541
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastVideoLayoutInfo", void 0);
542
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusInfo", void 0);
543
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "media", void 0);
544
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaProperties", void 0);
545
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaRequestManagers", void 0);
546
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfoFailureReason", void 0);
547
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkQualityMonitor", void 0);
548
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkStatus", void 0);
549
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "passwordStatus", void 0);
550
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "queuedMediaUpdates", void 0);
551
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "recording", void 0);
552
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "remoteMediaManager", void 0);
553
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requiredCaptcha", void 0);
554
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receiveSlotManager", void 0);
555
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "shareStatus", void 0);
556
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "statsAnalyzer", void 0);
557
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transcription", void 0);
558
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateMediaConnections", void 0);
559
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "endCallInitiateJoinReq", void 0);
560
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "endJoinReqResp", void 0);
561
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "endLocalSDPGenRemoteSDPRecvDelay", void 0);
562
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "joinedWith", void 0);
563
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusId", void 0);
564
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startCallInitiateJoinReq", void 0);
565
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startJoinReqResp", void 0);
566
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startLocalSDPGenRemoteSDPRecvDelay", void 0);
567
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "wirelessShare", void 0);
568
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "guest", void 0);
569
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingJoinUrl", void 0);
570
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingNumber", void 0);
571
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingState", void 0);
572
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "permissionToken", void 0);
573
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceId", void 0);
574
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resourceUrl", void 0);
575
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selfId", void 0);
576
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", void 0);
577
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
578
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getMediaStreams", function (mediaDirection) {
490
579
  var audioVideo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.VIDEO_RESOLUTIONS[_this.mediaProperties.localQualityLevel];
491
580
  var sharePreferences = arguments.length > 2 ? arguments[2] : undefined;
492
581
 
@@ -551,7 +640,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
551
640
  sendAudio: devicePermissions.sendAudio,
552
641
  sendVideo: devicePermissions.sendVideo,
553
642
  isSharing: _this.shareStatus === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE
554
- }), audioVideo, sharePreferences, _this.config).catch(function (error) {
643
+ }), audioVideo, sharePreferences, // @ts-ignore - config coming from registerPlugin
644
+ _this.config).catch(function (error) {
555
645
  var _this$locusUrl;
556
646
 
557
647
  // Whenever there is a failure when trying to access a user's device
@@ -578,7 +668,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
578
668
 
579
669
  return _promise.default.reject(new _media2.default('At least one of the mediaDirection value should be true'));
580
670
  });
581
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "getSupportedDevices", function (_ref3) {
671
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSupportedDevices", function (_ref3) {
582
672
  var _ref3$sendAudio = _ref3.sendAudio,
583
673
  sendAudio = _ref3$sendAudio === void 0 ? true : _ref3$sendAudio,
584
674
  _ref3$sendVideo = _ref3.sendVideo,
@@ -588,15 +678,349 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
588
678
  sendVideo: sendVideo
589
679
  });
590
680
  });
591
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "getDevices", function () {
681
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDevices", function () {
592
682
  return _media.default.getDevices();
593
683
  });
594
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setupStatsAnalyzerEventHandlers", function () {
684
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRoapFailure", function (error) {
685
+ var sendBehavioralMetric = function sendBehavioralMetric(metricName, error, correlationId) {
686
+ var _error$cause;
687
+
688
+ var data = {
689
+ code: error.code,
690
+ correlation_id: correlationId,
691
+ reason: error.message,
692
+ stack: error.stack
693
+ };
694
+ var metadata = {
695
+ type: ((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.name) || error.name
696
+ };
697
+
698
+ _metrics.default.sendBehavioralMetric(metricName, data, metadata);
699
+ };
700
+
701
+ if (error instanceof _internalMediaCore.MediaConnection.Errors.SdpOfferCreationError) {
702
+ sendBehavioralMetric(_constants2.default.PEERCONNECTION_FAILURE, error, _this.id);
703
+
704
+ _metrics.default.postEvent({
705
+ event: _config.eventType.LOCAL_SDP_GENERATED,
706
+ meetingId: _this.id,
707
+ data: {
708
+ canProceed: false,
709
+ errors: [_metrics.default.generateErrorPayload(2001, true, _config.error.name.MEDIA_ENGINE, undefined)]
710
+ }
711
+ });
712
+ } else if (error instanceof _internalMediaCore.MediaConnection.Errors.SdpOfferHandlingError || error instanceof _internalMediaCore.MediaConnection.Errors.SdpAnswerHandlingError) {
713
+ sendBehavioralMetric(_constants2.default.PEERCONNECTION_FAILURE, error, _this.id);
714
+
715
+ _metrics.default.postEvent({
716
+ event: _config.eventType.REMOTE_SDP_RECEIVED,
717
+ meetingId: _this.id,
718
+ data: {
719
+ canProceed: false,
720
+ errors: [_metrics.default.generateErrorPayload(2001, true, _config.error.name.MEDIA_ENGINE, undefined)]
721
+ }
722
+ });
723
+ } else if (error instanceof _internalMediaCore.MediaConnection.Errors.SdpError) {
724
+ // this covers also the case of MC.Errors.IceGatheringError which extends MC.Errors.SdpError
725
+ sendBehavioralMetric(_constants2.default.INVALID_ICE_CANDIDATE, error, _this.id);
726
+
727
+ _metrics.default.postEvent({
728
+ event: _config.eventType.LOCAL_SDP_GENERATED,
729
+ meetingId: _this.id,
730
+ data: {
731
+ canProceed: false,
732
+ errors: [_metrics.default.generateErrorPayload(2001, true, _config.error.name.MEDIA_ENGINE, undefined)]
733
+ }
734
+ });
735
+ }
736
+ });
737
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setupMediaConnectionListeners", function () {
738
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.ROAP_STARTED, function () {
739
+ _this.isRoapInProgress = true;
740
+ });
741
+
742
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.ROAP_DONE, function () {
743
+ _this.mediaNegotiatedEvent();
744
+
745
+ _this.isRoapInProgress = false;
746
+
747
+ _this.processNextQueuedMediaUpdate();
748
+ });
749
+
750
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.ROAP_FAILURE, _this.handleRoapFailure);
751
+
752
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.ROAP_MESSAGE_TO_SEND, function (event) {
753
+ var LOG_HEADER = 'Meeting:index#setupMediaConnectionListeners.ROAP_MESSAGE_TO_SEND -->';
754
+
755
+ switch (event.roapMessage.messageType) {
756
+ case 'OK':
757
+ _metrics.default.postEvent({
758
+ event: _config.eventType.REMOTE_SDP_RECEIVED,
759
+ meetingId: _this.id
760
+ });
761
+
762
+ logRequest(_this.roap.sendRoapOK({
763
+ seq: event.roapMessage.seq,
764
+ mediaId: _this.mediaId,
765
+ correlationId: _this.correlationId
766
+ }), {
767
+ header: "".concat(LOG_HEADER, " Send Roap OK"),
768
+ success: "".concat(LOG_HEADER, " Successfully send roap OK"),
769
+ failure: "".concat(LOG_HEADER, " Error joining the call on send roap OK, ")
770
+ });
771
+ break;
772
+
773
+ case 'OFFER':
774
+ _metrics.default.postEvent({
775
+ event: _config.eventType.LOCAL_SDP_GENERATED,
776
+ meetingId: _this.id
777
+ });
778
+
779
+ logRequest(_this.roap.sendRoapMediaRequest({
780
+ sdp: event.roapMessage.sdp,
781
+ seq: event.roapMessage.seq,
782
+ tieBreaker: event.roapMessage.tieBreaker,
783
+ meeting: (0, _assertThisInitialized2.default)(_this),
784
+ // or can pass meeting ID
785
+ reconnect: _this.reconnectionManager.isReconnectInProgress()
786
+ }), {
787
+ header: "".concat(LOG_HEADER, " Send Roap Offer"),
788
+ success: "".concat(LOG_HEADER, " Successfully send roap offer"),
789
+ failure: "".concat(LOG_HEADER, " Error joining the call on send roap offer, ")
790
+ });
791
+ break;
792
+
793
+ case 'ANSWER':
794
+ _metrics.default.postEvent({
795
+ event: _config.eventType.REMOTE_SDP_RECEIVED,
796
+ meetingId: _this.id
797
+ });
798
+
799
+ logRequest(_this.roap.sendRoapAnswer({
800
+ sdp: event.roapMessage.sdp,
801
+ seq: event.roapMessage.seq,
802
+ mediaId: _this.mediaId,
803
+ correlationId: _this.correlationId
804
+ }), {
805
+ header: "".concat(LOG_HEADER, " Send Roap Answer."),
806
+ success: "".concat(LOG_HEADER, " Successfully send roap answer"),
807
+ failure: "".concat(LOG_HEADER, " Error joining the call on send roap answer, ")
808
+ }).catch(function (error) {
809
+ var metricName = _constants2.default.ROAP_ANSWER_FAILURE;
810
+ var data = {
811
+ correlation_id: _this.correlationId,
812
+ locus_id: _this.locusUrl.split('/').pop(),
813
+ reason: error.message,
814
+ stack: error.stack
815
+ };
816
+ var metadata = {
817
+ type: error.name
818
+ };
819
+
820
+ _metrics.default.sendBehavioralMetric(metricName, data, metadata);
821
+ });
822
+ break;
823
+
824
+ case 'ERROR':
825
+ if (event.roapMessage.errorType === _internalMediaCore.MediaConnection.ErrorType.CONFLICT || event.roapMessage.errorType === _internalMediaCore.MediaConnection.ErrorType.DOUBLECONFLICT) {
826
+ _metrics.default.sendBehavioralMetric(_constants2.default.ROAP_GLARE_CONDITION, {
827
+ correlation_id: _this.correlationId,
828
+ locus_id: _this.locusUrl.split('/').pop(),
829
+ sequence: event.roapMessage.seq
830
+ });
831
+ }
832
+
833
+ logRequest(_this.roap.sendRoapError({
834
+ seq: event.roapMessage.seq,
835
+ errorType: event.roapMessage.errorType,
836
+ mediaId: _this.mediaId,
837
+ correlationId: _this.correlationId
838
+ }), {
839
+ header: "".concat(LOG_HEADER, " Send Roap Error."),
840
+ success: "".concat(LOG_HEADER, " Successfully send roap error"),
841
+ failure: "".concat(LOG_HEADER, " Failed to send roap error, ")
842
+ });
843
+ break;
844
+
845
+ default:
846
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Unsupported message type: ").concat(event.roapMessage.messageType));
847
+
848
+ break;
849
+ }
850
+ }); // eslint-disable-next-line no-param-reassign
851
+
852
+
853
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.REMOTE_TRACK_ADDED, function (event) {
854
+ _loggerProxy.default.logger.log("Meeting:index#setupMediaConnectionListeners --> REMOTE_TRACK_ADDED event received for webrtcMediaConnection: ".concat((0, _stringify.default)(event)));
855
+
856
+ var mediaTrack = event.track;
857
+ var eventType;
858
+
859
+ switch (event.type) {
860
+ case _internalMediaCore.MediaConnection.RemoteTrackType.AUDIO:
861
+ eventType = _constants.EVENT_TYPES.REMOTE_AUDIO;
862
+
863
+ _this.mediaProperties.setRemoteAudioTrack(event.track);
864
+
865
+ break;
866
+
867
+ case _internalMediaCore.MediaConnection.RemoteTrackType.VIDEO:
868
+ eventType = _constants.EVENT_TYPES.REMOTE_VIDEO;
869
+
870
+ _this.mediaProperties.setRemoteVideoTrack(event.track);
871
+
872
+ break;
873
+
874
+ case _internalMediaCore.MediaConnection.RemoteTrackType.SCREENSHARE_VIDEO:
875
+ if (event.track) {
876
+ eventType = _constants.EVENT_TYPES.REMOTE_SHARE;
877
+
878
+ _this.mediaProperties.setRemoteShare(event.track);
879
+ }
880
+
881
+ break;
882
+
883
+ default:
884
+ {
885
+ _loggerProxy.default.logger.log('Meeting:index#setupMediaConnectionListeners --> unexpected track');
886
+ }
887
+ } // start stats here the stats are coming null if you dont receive streams
888
+
889
+
890
+ _this.statsAnalyzer.startAnalyzer(_this.mediaProperties.webrtcMediaConnection);
891
+
892
+ if (eventType && mediaTrack) {
893
+ _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
894
+ file: 'meeting/index',
895
+ function: 'setupRemoteTrackListener:Event.REMOTE_TRACK_ADDED'
896
+ }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
897
+ type: eventType,
898
+ stream: _util2.default.createMediaStream([mediaTrack])
899
+ });
900
+ }
901
+ });
902
+
903
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.CONNECTION_STATE_CHANGED, function (event) {
904
+ var connectionFailed = function connectionFailed() {
905
+ // we know the media connection failed and browser will not attempt to recover it any more
906
+ // so reset the timer as it's not needed anymore, we want to reconnect immediately
907
+ _this.reconnectionManager.resetReconnectionTimer();
908
+
909
+ _this.reconnect({
910
+ networkDisconnect: true
911
+ });
912
+
913
+ _metrics.default.postEvent({
914
+ event: _config.eventType.ICE_END,
915
+ meeting: (0, _assertThisInitialized2.default)(_this),
916
+ data: {
917
+ canProceed: false,
918
+ errors: [_metrics.default.generateErrorPayload(2004, false, _config.error.name.MEDIA_ENGINE, undefined)]
919
+ }
920
+ });
921
+
922
+ _this.uploadLogs({
923
+ file: 'peer-connection-manager/index',
924
+ function: 'connectionFailed'
925
+ });
926
+
927
+ _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
928
+ correlation_id: _this.correlationId,
929
+ locus_id: _this.locusId
930
+ });
931
+ };
932
+
933
+ _loggerProxy.default.logger.info("Meeting:index#setupMediaConnectionListeners --> connection state changed to ".concat(event.state));
934
+
935
+ switch (event.state) {
936
+ case _internalMediaCore.MediaConnection.ConnectionState.Connecting:
937
+ _metrics.default.postEvent({
938
+ event: _config.eventType.ICE_START,
939
+ meeting: (0, _assertThisInitialized2.default)(_this)
940
+ });
941
+
942
+ break;
943
+
944
+ case _internalMediaCore.MediaConnection.ConnectionState.Connected:
945
+ _metrics.default.postEvent({
946
+ event: _config.eventType.ICE_END,
947
+ meeting: (0, _assertThisInitialized2.default)(_this)
948
+ });
949
+
950
+ _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_SUCCESS, {
951
+ correlation_id: _this.correlationId,
952
+ locus_id: _this.locusId
953
+ });
954
+
955
+ _this.setNetworkStatus(_constants.NETWORK_STATUS.CONNECTED);
956
+
957
+ _this.reconnectionManager.iceReconnected();
958
+
959
+ break;
960
+
961
+ case _internalMediaCore.MediaConnection.ConnectionState.Disconnected:
962
+ _this.setNetworkStatus(_constants.NETWORK_STATUS.DISCONNECTED);
963
+
964
+ _this.reconnectionManager.waitForIceReconnect().catch(function () {
965
+ _loggerProxy.default.logger.info('Meeting:index#setupMediaConnectionListeners --> state DISCONNECTED, automatic reconnection timed out.');
966
+
967
+ connectionFailed();
968
+ });
969
+
970
+ break;
971
+
972
+ case _internalMediaCore.MediaConnection.ConnectionState.Failed:
973
+ connectionFailed();
974
+ break;
975
+
976
+ default:
977
+ break;
978
+ }
979
+ });
980
+
981
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.ACTIVE_SPEAKERS_CHANGED, function (msg) {
982
+ _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
983
+ file: 'meeting/index',
984
+ function: 'setupMediaConnectionListeners'
985
+ }, _constants.EVENT_TRIGGERS.ACTIVE_SPEAKER_CHANGED, {
986
+ seqNum: msg.seqNum,
987
+ memberIds: msg.csis.map(function (csi) {
988
+ var _this$members$findMem;
989
+
990
+ return (_this$members$findMem = _this.members.findMemberByCsi(csi)) === null || _this$members$findMem === void 0 ? void 0 : _this$members$findMem.id;
991
+ }).filter(function (item) {
992
+ return item !== undefined;
993
+ })
994
+ });
995
+ });
996
+
997
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.VIDEO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources) {
998
+ _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
999
+ file: 'meeting/index',
1000
+ function: 'setupMediaConnectionListeners'
1001
+ }, _constants.EVENT_TRIGGERS.REMOTE_VIDEO_SOURCE_COUNT_CHANGED, {
1002
+ numTotalSources: numTotalSources,
1003
+ numLiveSources: numLiveSources
1004
+ });
1005
+ });
1006
+
1007
+ _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.MediaConnection.Event.AUDIO_SOURCES_COUNT_CHANGED, function (numTotalSources, numLiveSources) {
1008
+ _triggerProxy.default.trigger((0, _assertThisInitialized2.default)(_this), {
1009
+ file: 'meeting/index',
1010
+ function: 'setupMediaConnectionListeners'
1011
+ }, _constants.EVENT_TRIGGERS.REMOTE_AUDIO_SOURCE_COUNT_CHANGED, {
1012
+ numTotalSources: numTotalSources,
1013
+ numLiveSources: numLiveSources
1014
+ });
1015
+ });
1016
+ });
1017
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setupStatsAnalyzerEventHandlers", function () {
595
1018
  _this.statsAnalyzer.on(_statsAnalyzer.EVENTS.MEDIA_QUALITY, function (options) {
596
1019
  var _this$webex$meetings$;
597
1020
 
598
1021
  // TODO: might have to send the same event to the developer
599
1022
  // Add ip address info if geo hint is present
1023
+ // @ts-ignore fix type
600
1024
  options.data.intervalMetadata.peerReflexiveIP = ((_this$webex$meetings$ = _this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$ === void 0 ? void 0 : _this$webex$meetings$.clientAddress) || options.data.intervalMetadata.peerReflexiveIP || _constants.MQA_STATS.DEFAULT_IP;
601
1025
 
602
1026
  _metrics.default.postEvent({
@@ -659,7 +1083,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
659
1083
  });
660
1084
  });
661
1085
  });
662
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "mediaNegotiatedEvent", function () {
1086
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaNegotiatedEvent", function () {
1087
+ // @ts-ignore - config coming from registerPlugin
663
1088
  if (_this.config.experimental.enableMediaNegotiatedEvent) {
664
1089
  _loggerProxy.default.logger.info('Meeting:mediaNegotiatedEvent --> Media server negotiated');
665
1090
 
@@ -669,7 +1094,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
669
1094
  }, _constants.EVENT_TRIGGERS.MEDIA_NEGOTIATED);
670
1095
  }
671
1096
  });
672
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "processNextQueuedMediaUpdate", function () {
1097
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "processNextQueuedMediaUpdate", function () {
673
1098
  if (_this.canUpdateMedia() && _this.queuedMediaUpdates.length > 0) {
674
1099
  var _this$queuedMediaUpda = _this.queuedMediaUpdates.shift(),
675
1100
  pendingPromiseResolve = _this$queuedMediaUpda.pendingPromiseResolve,
@@ -707,7 +1132,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
707
1132
  }
708
1133
  }
709
1134
  });
710
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "clearMeetingData", function () {
1135
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearMeetingData", function () {
711
1136
  _this.audio = null;
712
1137
  _this.video = null;
713
1138
  _this.isSharing = false;
@@ -726,7 +1151,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
726
1151
  _this.transcription = undefined;
727
1152
  }
728
1153
  });
729
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "startKeepAlive", function () {
1154
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startKeepAlive", function () {
730
1155
  var _this$joinedWith, _this$joinedWith2;
731
1156
 
732
1157
  if (_this.keepAliveTimerId) {
@@ -766,7 +1191,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
766
1191
  });
767
1192
  }, keepAliveInterval);
768
1193
  });
769
- (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "stopKeepAlive", function () {
1194
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "stopKeepAlive", function () {
770
1195
  if (!_this.keepAliveTimerId) {
771
1196
  return;
772
1197
  }
@@ -840,16 +1265,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
840
1265
  */
841
1266
 
842
1267
  _this.deviceUrl = attrs.deviceUrl;
843
- /**
844
- * @description set you -1 as default values is 0 (used to idenfify if 1st roap request was sent)
845
- * @instance
846
- * @type {Number}
847
- * @readonly
848
- * @private
849
- * @memberof Meeting
850
- */
851
-
852
- _this.roapSeq = _constants.ROAP_SEQ_PRE;
853
1268
  /**
854
1269
  * @instance
855
1270
  * @type {Object}
@@ -860,6 +1275,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
860
1275
  // TODO: needs to be defined as a class
861
1276
 
862
1277
  _this.meetingInfo = {};
1278
+ /**
1279
+ * helper class for managing receive slots (for multistream media connections)
1280
+ */
1281
+
1282
+ _this.receiveSlotManager = new _receiveSlotManager.ReceiveSlotManager((0, _assertThisInitialized2.default)(_this));
1283
+ /**
1284
+ * Helper class for managing media requests for main video (for multistream media connections)
1285
+ * All media requests sent out for main video for this meeting have to go through it.
1286
+ */
1287
+
1288
+ _this.mediaRequestManagers = {
1289
+ audio: new _mediaRequestManager.MediaRequestManager(function (mediaRequests) {
1290
+ if (!_this.mediaProperties.webrtcMediaConnection) {
1291
+ _loggerProxy.default.logger.warn('Meeting:index#mediaRequestManager --> trying to send audio media request before media connection was created');
1292
+
1293
+ return;
1294
+ }
1295
+
1296
+ _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaConnection.MediaType.AudioMain, mediaRequests);
1297
+ }),
1298
+ video: new _mediaRequestManager.MediaRequestManager(function (mediaRequests) {
1299
+ if (!_this.mediaProperties.webrtcMediaConnection) {
1300
+ _loggerProxy.default.logger.warn('Meeting:index#mediaRequestManager --> trying to send video media request before media connection was created');
1301
+
1302
+ return;
1303
+ }
1304
+
1305
+ _this.mediaProperties.webrtcMediaConnection.requestMedia(_internalMediaCore.MediaConnection.MediaType.VideoMain, mediaRequests);
1306
+ })
1307
+ };
863
1308
  /**
864
1309
  * @instance
865
1310
  * @type {Members}
@@ -868,7 +1313,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
868
1313
  */
869
1314
 
870
1315
  _this.members = new _index2.default({
871
- locusUrl: attrs.locus && attrs.locus.url
1316
+ locusUrl: attrs.locus && attrs.locus.url,
1317
+ receiveSlotManager: _this.receiveSlotManager,
1318
+ mediaRequestManagers: _this.mediaRequestManagers // @ts-ignore - Fix type
1319
+
872
1320
  }, {
873
1321
  parent: _this.webex
874
1322
  });
@@ -879,10 +1327,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
879
1327
  * @private
880
1328
  * @memberof Meeting
881
1329
  */
1330
+ // @ts-ignore - Fix type
882
1331
 
883
1332
  _this.roap = new _index.default({}, {
884
1333
  parent: _this.webex
885
1334
  });
1335
+ /**
1336
+ * indicates if an SDP exchange is happening
1337
+ *
1338
+ * @instance
1339
+ * @type {Boolean}
1340
+ * @readonly
1341
+ * @private
1342
+ * @memberof Meeting
1343
+ */
1344
+
1345
+ _this.isRoapInProgress = false;
886
1346
  /**
887
1347
  * created later
888
1348
  * @instance
@@ -1036,6 +1496,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1036
1496
  */
1037
1497
 
1038
1498
  _this.mediaConnections = null;
1499
+ /**
1500
+ * If true, then media is sent over multiple separate streams.
1501
+ * If false, then media is transcoded by the server into a single stream.
1502
+ */
1503
+
1504
+ _this.isMultistream = false;
1039
1505
  /**
1040
1506
  * Fetching meeting info can be done randomly 2-5 mins before meeting start
1041
1507
  * In case it is done before the timer expires, this timeout id is reset to cancel the timer.
@@ -1092,39 +1558,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1092
1558
  _this.isSharing = false;
1093
1559
  /**
1094
1560
  * @instance
1095
- * @type {Boolean}
1561
+ * @type {string}
1096
1562
  * @readonly
1097
1563
  * @public
1098
1564
  * @memberof Meeting
1099
1565
  */
1100
1566
 
1101
1567
  _this.shareStatus = _constants.SHARE_STATUS.NO_SHARE;
1102
- /**
1103
- * @instance
1104
- * @type {Boolean}
1105
- * @readonly
1106
- * @private
1107
- * @memberof Meeting
1108
- */
1109
-
1110
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), 'isLocalShareLive', {
1111
- get: function get() {
1112
- var _shareTransceiver$sen, _shareTransceiver$sen2;
1113
-
1114
- var shareTransceiver = _this.mediaProperties.peerConnection.shareTransceiver;
1115
- var shareDirection = shareTransceiver === null || shareTransceiver === void 0 ? void 0 : shareTransceiver.direction;
1116
- var trackReadyState = shareTransceiver === null || shareTransceiver === void 0 ? void 0 : (_shareTransceiver$sen = shareTransceiver.sender) === null || _shareTransceiver$sen === void 0 ? void 0 : (_shareTransceiver$sen2 = _shareTransceiver$sen.track) === null || _shareTransceiver$sen2 === void 0 ? void 0 : _shareTransceiver$sen2.readyState;
1117
- var activeShare = trackReadyState === _constants.LIVE;
1118
- var offersToSendData = shareDirection === _constants.SENDRECV;
1119
-
1120
- if (activeShare && offersToSendData) {
1121
- return true;
1122
- }
1123
-
1124
- return false;
1125
- },
1126
- configurable: true
1127
- });
1128
1568
  /**
1129
1569
  * @instance
1130
1570
  * @type {Array}
@@ -1137,7 +1577,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1137
1577
  /**
1138
1578
  * There is a pending floor requested by the user
1139
1579
  * @instance
1140
- * @type {floorGrantPending}
1580
+ * @type {boolean}
1141
1581
  * @private
1142
1582
  * @memberof Meeting
1143
1583
  */
@@ -1213,6 +1653,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1213
1653
  * @private
1214
1654
  * @memberof Meeting
1215
1655
  */
1656
+ // @ts-ignore - Fix type
1216
1657
 
1217
1658
  _this.locusInfo = new _locusInfo.default(_this.updateMeetingObject.bind((0, _assertThisInitialized2.default)(_this)), _this.webex, _this.id); // We had to add listeners first before setting up the locus instance
1218
1659
 
@@ -1241,6 +1682,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1241
1682
  * @private
1242
1683
  * @memberof Meeting
1243
1684
  */
1685
+ // @ts-ignore - Fix type
1244
1686
 
1245
1687
  _this.hasWebsocketConnected = _this.webex.internal.mercury.connected;
1246
1688
  /**
@@ -1323,6 +1765,12 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1323
1765
  _this.locusInfo.init(attrs.locus ? attrs.locus : {});
1324
1766
 
1325
1767
  _this.hasJoinedOnce = false;
1768
+ _this.media = new _multistreamMedia.MultistreamMedia((0, _assertThisInitialized2.default)(_this));
1769
+ /**
1770
+ * helper class for managing remote streams
1771
+ */
1772
+
1773
+ _this.remoteMediaManager = null;
1326
1774
  return _this;
1327
1775
  }
1328
1776
  /**
@@ -1407,6 +1855,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1407
1855
  break;
1408
1856
  }
1409
1857
 
1858
+ // @ts-ignore
1410
1859
  _loggerProxy.default.logger.info("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, ").")); // when wbxappapi requires password it still populates partial meeting info in the response
1411
1860
 
1412
1861
 
@@ -1435,6 +1884,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1435
1884
  break;
1436
1885
  }
1437
1886
 
1887
+ // @ts-ignore
1438
1888
  _loggerProxy.default.logger.info("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, ")."));
1439
1889
 
1440
1890
  this.meetingInfoFailureReason = this.requiredCaptcha ? _constants.MEETING_INFO_FAILURE_REASON.WRONG_CAPTCHA : _constants.MEETING_INFO_FAILURE_REASON.WRONG_PASSWORD;
@@ -1592,7 +2042,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1592
2042
  function: 'setUpLocusInfoMediaInactiveListener'
1593
2043
  }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this4);
1594
2044
 
1595
- _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMediaInactiveListener --> Meeting disconnected due to inactivity: ".concat(res.reason));
2045
+ _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMediaInactiveListener --> Meeting disconnected due to inactivity: ".concat(res.reason)); // @ts-ignore - config coming from registerPlugin
2046
+
1596
2047
 
1597
2048
  if (_this4.config.reconnection.autoRejoin) {
1598
2049
  _this4.reconnect();
@@ -1671,7 +2122,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1671
2122
  if (options) {
1672
2123
  var event = options.event,
1673
2124
  trackingId = options.trackingId,
1674
- mediaConnections = options.mediaConnections;
2125
+ _mediaConnections = options.mediaConnections;
1675
2126
 
1676
2127
  if (!event) {
1677
2128
  _loggerProxy.default.logger.error('Meeting:index#getAnalyzerMetricsPrePayload --> Error [Call Analyzer Event', event || '', "]: invalid identifers or event type! ".concat(this.correlationId));
@@ -1684,6 +2135,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1684
2135
  userId: this.userId,
1685
2136
  deviceId: this.deviceUrl,
1686
2137
  orgId: this.orgId,
2138
+ // @ts-ignore fix type
1687
2139
  locusUrl: this.webex.internal.services.get('locus')
1688
2140
  };
1689
2141
 
@@ -1694,10 +2146,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1694
2146
  } // Check if mediaConnections has been passed in or else use this.mediaConnections
1695
2147
 
1696
2148
 
1697
- if (mediaConnections) {
1698
- identifiers.mediaAgentAlias = mediaConnections === null || mediaConnections === void 0 ? void 0 : mediaConnections[0].mediaAgentAlias;
1699
- identifiers.mediaAgentGroupId = mediaConnections === null || mediaConnections === void 0 ? void 0 : mediaConnections[0].mediaAgentGroupId;
1700
- identifiers.mediaAgentCluster = mediaConnections === null || mediaConnections === void 0 ? void 0 : mediaConnections[0].mediaAgentCluster;
2149
+ if (_mediaConnections) {
2150
+ identifiers.mediaAgentAlias = _mediaConnections === null || _mediaConnections === void 0 ? void 0 : _mediaConnections[0].mediaAgentAlias;
2151
+ identifiers.mediaAgentGroupId = _mediaConnections === null || _mediaConnections === void 0 ? void 0 : _mediaConnections[0].mediaAgentGroupId;
2152
+ identifiers.mediaAgentCluster = _mediaConnections === null || _mediaConnections === void 0 ? void 0 : _mediaConnections[0].mediaAgentCluster;
1701
2153
  } else if (this.mediaConnections) {
1702
2154
  var _this$mediaConnection, _this$mediaConnection2, _this$mediaConnection3;
1703
2155
 
@@ -1801,7 +2253,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1801
2253
  }, {
1802
2254
  key: "sendCallAnalyzerMetrics",
1803
2255
  value: function sendCallAnalyzerMetrics(options) {
1804
- var payload = this.getAnalyzerMetricsPrePayload(_objectSpread(_objectSpread({}, (0, _pick2.default)(this.config.metrics, ['clientType', 'subClientType'])), options));
2256
+ var payload = this.getAnalyzerMetricsPrePayload(_objectSpread(_objectSpread({}, (0, _pick2.default)(this.config.metrics, ['clientType', 'subClientType'])), options)); // @ts-ignore - fix type
2257
+
1805
2258
  return this.webex.internal.metrics.submitCallDiagnosticEvents(payload);
1806
2259
  }
1807
2260
  /**
@@ -1820,7 +2273,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1820
2273
  value: function sendMediaQualityAnalyzerMetrics(options) {
1821
2274
  var payload = this.getAnalyzerMetricsPrePayload(_objectSpread(_objectSpread({
1822
2275
  type: _constants.MQA_STATS.CA_TYPE
1823
- }, (0, _pick2.default)(this.config.metrics, ['clientType', 'subClientType'])), options));
2276
+ }, (0, _pick2.default)(this.config.metrics, ['clientType', 'subClientType'])), options)); // @ts-ignore
2277
+
1824
2278
  return this.webex.internal.metrics.submitCallDiagnosticEvents(payload);
1825
2279
  }
1826
2280
  /**
@@ -1869,7 +2323,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1869
2323
 
1870
2324
 
1871
2325
  if (_this7.floorGrantPending && payload.newSelf.state === _constants.MEETING_STATE.STATES.JOINED) {
1872
- _this7.share().then(function () {
2326
+ _this7.requestScreenShareFloor().then(function () {
1873
2327
  _this7.floorGrantPending = false;
1874
2328
  });
1875
2329
  }
@@ -2052,6 +2506,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2052
2506
  var caption = _ref7.caption,
2053
2507
  transcribing = _ref7.transcribing;
2054
2508
 
2509
+ // @ts-ignore - config coming from registerPlugin
2055
2510
  if (transcribing && _this11.transcription && _this11.config.receiveTranscription) {
2056
2511
  _this11.receiveTranscription();
2057
2512
  } else if (!transcribing && _this11.transcription) {
@@ -2152,7 +2607,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2152
2607
  case _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE:
2153
2608
  _triggerProxy.default.trigger(_this12, {
2154
2609
  file: 'meeting/index',
2155
- function: 'stopFloorRequest'
2610
+ function: 'localShare'
2156
2611
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2157
2612
  reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2158
2613
  });
@@ -2360,9 +2815,30 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2360
2815
  function: 'setUpLocusInfoMeetingInfoListener'
2361
2816
  }, _constants.EVENT_TRIGGERS.MEETING_ACTIONS_UPDATE, _this14.inMeetingActions.get());
2362
2817
  }
2818
+
2819
+ _this14.handleDataChannelUrlChange(payload.info.datachannelUrl);
2363
2820
  }
2364
2821
  });
2365
2822
  }
2823
+ /**
2824
+ * Handles a data channel URL change
2825
+ * @param {String} datachannelUrl
2826
+ * @returns {void}
2827
+ */
2828
+
2829
+ }, {
2830
+ key: "handleDataChannelUrlChange",
2831
+ value: function handleDataChannelUrlChange(datachannelUrl) {
2832
+ var _this15 = this;
2833
+
2834
+ if (datachannelUrl && this.config.enableAutomaticLLM) {
2835
+ // Defer this as updateLLMConnection relies upon this.locusInfo.url which is only set
2836
+ // after the MEETING_INFO_UPDATED callback finishes
2837
+ (0, _defer2.default)(function () {
2838
+ _this15.updateLLMConnection();
2839
+ });
2840
+ }
2841
+ }
2366
2842
  /**
2367
2843
  * Set up the locus info embedded apps listener
2368
2844
  * @returns {undefined}
@@ -2373,11 +2849,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2373
2849
  }, {
2374
2850
  key: "setUpLocusEmbeddedAppsListener",
2375
2851
  value: function setUpLocusEmbeddedAppsListener() {
2376
- var _this15 = this;
2852
+ var _this16 = this;
2377
2853
 
2378
2854
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.EMBEDDED_APPS_UPDATED, function (embeddedApps) {
2379
2855
  if (embeddedApps) {
2380
- _triggerProxy.default.trigger(_this15, {
2856
+ _triggerProxy.default.trigger(_this16, {
2381
2857
  file: 'meeting/index',
2382
2858
  function: 'setUpLocusEmbeddedAppsListener'
2383
2859
  }, _constants.EVENT_TRIGGERS.MEETING_EMBEDDED_APPS_UPDATE, embeddedApps);
@@ -2394,13 +2870,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2394
2870
  }, {
2395
2871
  key: "setUpLocusInfoSelfListener",
2396
2872
  value: function setUpLocusInfoSelfListener() {
2397
- var _this16 = this;
2873
+ var _this17 = this;
2398
2874
 
2399
2875
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUIRED, function (payload) {
2400
- if (_this16.audio) {
2401
- _this16.audio.handleServerLocalUnmuteRequired(_this16);
2876
+ if (_this17.audio) {
2877
+ _this17.audio.handleServerLocalUnmuteRequired(_this17);
2402
2878
 
2403
- _triggerProxy.default.trigger(_this16, {
2879
+ _triggerProxy.default.trigger(_this17, {
2404
2880
  file: 'meeting/index',
2405
2881
  function: 'setUpLocusInfoSelfListener'
2406
2882
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_UNMUTED_BY_OTHERS, {
@@ -2410,17 +2886,17 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2410
2886
  });
2411
2887
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED, function (payload) {
2412
2888
  if (payload) {
2413
- var _this16$audio;
2889
+ var _this17$audio;
2414
2890
 
2415
- if (_this16.audio) {
2416
- _this16.audio.handleServerRemoteMuteUpdate(payload.muted, payload.unmuteAllowed);
2891
+ if (_this17.audio) {
2892
+ _this17.audio.handleServerRemoteMuteUpdate(payload.muted, payload.unmuteAllowed);
2417
2893
  } // with "mute on entry" server will send us remote mute even if we don't have media configured,
2418
2894
  // so if being muted by others, always send the notification,
2419
2895
  // but if being unmuted, only send it if we are also locally unmuted
2420
2896
 
2421
2897
 
2422
- if (payload.muted || !((_this16$audio = _this16.audio) !== null && _this16$audio !== void 0 && _this16$audio.isMuted())) {
2423
- _triggerProxy.default.trigger(_this16, {
2898
+ if (payload.muted || !((_this17$audio = _this17.audio) !== null && _this17$audio !== void 0 && _this17$audio.isMuted())) {
2899
+ _triggerProxy.default.trigger(_this17, {
2424
2900
  file: 'meeting/index',
2425
2901
  function: 'setUpLocusInfoSelfListener'
2426
2902
  }, payload.muted ? _constants.EVENT_TRIGGERS.MEETING_SELF_MUTED_BY_OTHERS : _constants.EVENT_TRIGGERS.MEETING_SELF_UNMUTED_BY_OTHERS, {
@@ -2430,7 +2906,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2430
2906
  }
2431
2907
  });
2432
2908
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUESTED, function (payload) {
2433
- _triggerProxy.default.trigger(_this16, {
2909
+ _triggerProxy.default.trigger(_this17, {
2434
2910
  file: 'meeting/index',
2435
2911
  function: 'setUpLocusInfoSelfListener'
2436
2912
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_REQUESTED_TO_UNMUTE, {
@@ -2439,9 +2915,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2439
2915
  });
2440
2916
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_UNADMITTED_GUEST, function (payload) {
2441
2917
  if (payload) {
2442
- _this16.startKeepAlive();
2918
+ _this17.startKeepAlive();
2443
2919
 
2444
- _triggerProxy.default.trigger(_this16, {
2920
+ _triggerProxy.default.trigger(_this17, {
2445
2921
  file: 'meeting/index',
2446
2922
  function: 'setUpLocusInfoSelfListener'
2447
2923
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_LOBBY_WAITING, {
@@ -2450,15 +2926,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2450
2926
 
2451
2927
  _metrics.default.postEvent({
2452
2928
  event: _config.eventType.LOBBY_ENTERED,
2453
- meeting: _this16
2929
+ meeting: _this17
2454
2930
  });
2455
2931
  }
2456
2932
  });
2457
2933
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, function (payload) {
2458
- _this16.stopKeepAlive();
2934
+ _this17.stopKeepAlive();
2459
2935
 
2460
2936
  if (payload) {
2461
- _triggerProxy.default.trigger(_this16, {
2937
+ _triggerProxy.default.trigger(_this17, {
2462
2938
  file: 'meeting/index',
2463
2939
  function: 'setUpLocusInfoSelfListener'
2464
2940
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_GUEST_ADMITTED, {
@@ -2467,41 +2943,42 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2467
2943
 
2468
2944
  _metrics.default.postEvent({
2469
2945
  event: _config.eventType.LOBBY_EXITED,
2470
- meeting: _this16
2946
+ meeting: _this17
2471
2947
  });
2472
2948
  }
2473
- });
2949
+ }); // @ts-ignore - check if MEDIA_INACTIVITY exists
2950
+
2474
2951
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, function () {
2475
2952
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_MEDIA_INACTIVE, {
2476
- correlation_id: _this16.correlationId,
2477
- locus_id: _this16.locusId
2953
+ correlation_id: _this17.correlationId,
2954
+ locus_id: _this17.locusId
2478
2955
  });
2479
2956
 
2480
- _this16.reconnect();
2957
+ _this17.reconnect();
2481
2958
  }); // There is two stats for mute one is the actual media being sent or received
2482
2959
  // The second on is if the audio is muted, we need to tell the statsAnalyzer when
2483
2960
  // the audio is muted or the user is not willing to send media
2484
2961
 
2485
2962
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.MEDIA_STATUS_CHANGE, function (status) {
2486
- if (_this16.statsAnalyzer) {
2487
- var _this16$mediaProperti, _this16$audio2, _this16$mediaProperti2, _this16$video, _this16$mediaProperti3, _this16$mediaProperti4, _this16$mediaProperti5, _this16$mediaProperti6;
2963
+ if (_this17.statsAnalyzer) {
2964
+ var _this17$mediaProperti, _this17$audio2, _this17$mediaProperti2, _this17$video, _this17$mediaProperti3, _this17$mediaProperti4, _this17$mediaProperti5, _this17$mediaProperti6;
2488
2965
 
2489
- _this16.statsAnalyzer.updateMediaStatus({
2966
+ _this17.statsAnalyzer.updateMediaStatus({
2490
2967
  actual: status,
2491
2968
  expected: {
2492
2969
  // We need to check what should be the actual direction of media
2493
- sendAudio: ((_this16$mediaProperti = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti === void 0 ? void 0 : _this16$mediaProperti.sendAudio) && !((_this16$audio2 = _this16.audio) !== null && _this16$audio2 !== void 0 && _this16$audio2.isMuted()),
2494
- sendVideo: ((_this16$mediaProperti2 = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti2 === void 0 ? void 0 : _this16$mediaProperti2.sendVideo) && !((_this16$video = _this16.video) !== null && _this16$video !== void 0 && _this16$video.isMuted()),
2495
- sendShare: (_this16$mediaProperti3 = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti3 === void 0 ? void 0 : _this16$mediaProperti3.sendShare,
2496
- receiveAudio: (_this16$mediaProperti4 = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti4 === void 0 ? void 0 : _this16$mediaProperti4.receiveAudio,
2497
- receiveVideo: (_this16$mediaProperti5 = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti5 === void 0 ? void 0 : _this16$mediaProperti5.receiveVideo,
2498
- receiveShare: (_this16$mediaProperti6 = _this16.mediaProperties.mediaDirection) === null || _this16$mediaProperti6 === void 0 ? void 0 : _this16$mediaProperti6.receiveShare
2970
+ sendAudio: ((_this17$mediaProperti = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti === void 0 ? void 0 : _this17$mediaProperti.sendAudio) && !((_this17$audio2 = _this17.audio) !== null && _this17$audio2 !== void 0 && _this17$audio2.isMuted()),
2971
+ sendVideo: ((_this17$mediaProperti2 = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti2 === void 0 ? void 0 : _this17$mediaProperti2.sendVideo) && !((_this17$video = _this17.video) !== null && _this17$video !== void 0 && _this17$video.isMuted()),
2972
+ sendShare: (_this17$mediaProperti3 = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti3 === void 0 ? void 0 : _this17$mediaProperti3.sendShare,
2973
+ receiveAudio: (_this17$mediaProperti4 = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti4 === void 0 ? void 0 : _this17$mediaProperti4.receiveAudio,
2974
+ receiveVideo: (_this17$mediaProperti5 = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti5 === void 0 ? void 0 : _this17$mediaProperti5.receiveVideo,
2975
+ receiveShare: (_this17$mediaProperti6 = _this17.mediaProperties.mediaDirection) === null || _this17$mediaProperti6 === void 0 ? void 0 : _this17$mediaProperti6.receiveShare
2499
2976
  }
2500
2977
  });
2501
2978
  }
2502
2979
  });
2503
2980
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE, function (payload) {
2504
- _triggerProxy.default.trigger(_this16, {
2981
+ _triggerProxy.default.trigger(_this17, {
2505
2982
  file: 'meeting/index',
2506
2983
  function: 'setUpLocusInfoSelfListener'
2507
2984
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_CANNOT_VIEW_PARTICIPANT_LIST, {
@@ -2509,7 +2986,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2509
2986
  });
2510
2987
  });
2511
2988
  this.locusInfo.on(_constants.LOCUSINFO.EVENTS.SELF_IS_SHARING_BLOCKED_CHANGE, function (payload) {
2512
- _triggerProxy.default.trigger(_this16, {
2989
+ _triggerProxy.default.trigger(_this17, {
2513
2990
  file: 'meeting/index',
2514
2991
  function: 'setUpLocusInfoSelfListener'
2515
2992
  }, _constants.EVENT_TRIGGERS.MEETING_SELF_IS_SHARING_BLOCKED, {
@@ -2527,29 +3004,30 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2527
3004
  }, {
2528
3005
  key: "setUpLocusInfoMeetingListener",
2529
3006
  value: function setUpLocusInfoMeetingListener() {
2530
- var _this17 = this;
3007
+ var _this18 = this;
2531
3008
 
2532
3009
  this.locusInfo.on(_constants.EVENTS.REMOTE_RESPONSE, function (payload) {
2533
- _this17.meetingFiniteStateMachine.remote(payload);
3010
+ _this18.meetingFiniteStateMachine.remote(payload);
2534
3011
 
2535
3012
  if (payload.remoteDeclined) {
2536
- _this17.leave({
3013
+ _this18.leave({
2537
3014
  reason: payload.reason
2538
3015
  }).then(function () {
2539
3016
  _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoMeetingListener --> REMOTE_RESPONSE. Attempting to leave meeting.');
2540
3017
  }).catch(function (error) {
2541
- _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> REMOTE_RESPONSE. Issue with leave for meeting, meeting still in collection: ".concat(_this17.meeting, ", error: ").concat(error));
3018
+ // @ts-ignore
3019
+ _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> REMOTE_RESPONSE. Issue with leave for meeting, meeting still in collection: ".concat(_this18.meeting, ", error: ").concat(error));
2542
3020
  });
2543
3021
  }
2544
3022
  });
2545
3023
  this.locusInfo.on(_constants.EVENTS.DESTROY_MEETING, function (payload) {
2546
3024
  // if self state is NOT left
2547
3025
  // TODO: Handle sharing and wireless sharing when meeting end
2548
- if (_this17.wirelessShare) {
2549
- if (_this17.mediaProperties.shareTrack) {
2550
- _this17.mediaProperties.shareTrack.onended = null;
3026
+ if (_this18.wirelessShare) {
3027
+ if (_this18.mediaProperties.shareTrack) {
3028
+ _this18.mediaProperties.shareTrack.onended = null;
2551
3029
 
2552
- _this17.mediaProperties.shareTrack.stop();
3030
+ _this18.mediaProperties.shareTrack.stop();
2553
3031
  }
2554
3032
  } // when multiple WEB deviceType join with same user
2555
3033
  // and some of the devices are joined and some are left
@@ -2563,24 +3041,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2563
3041
 
2564
3042
  if (payload.shouldLeave) {
2565
3043
  // TODO: We should do cleaning of meeting object if the shouldLeave: false because there might be meeting object which we are not cleaning
2566
- _this17.leave({
3044
+ _this18.leave({
2567
3045
  reason: payload.reason
2568
3046
  }).then(function () {
2569
3047
  _loggerProxy.default.logger.warn('Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. The meeting has been left, but has not been destroyed, you should see a later event for leave.');
2570
3048
  }).catch(function (error) {
2571
- _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this17.meeting, ", error: ").concat(error));
3049
+ // @ts-ignore
3050
+ _loggerProxy.default.logger.error("Meeting:index#setUpLocusInfoMeetingListener --> DESTROY_MEETING. Issue with leave for meeting, meeting still in collection: ".concat(_this18.meeting, ", error: ").concat(error));
2572
3051
  });
2573
3052
  } else {
2574
3053
  _loggerProxy.default.logger.info('Meeting:index#setUpLocusInfoMeetingListener --> MEETING_REMOVED_REASON', payload.reason);
2575
3054
 
2576
- _util.default.cleanUp(_this17);
3055
+ _util.default.cleanUp(_this18);
2577
3056
 
2578
- _triggerProxy.default.trigger(_this17, {
3057
+ _triggerProxy.default.trigger(_this18, {
2579
3058
  file: 'meeting/index',
2580
3059
  function: 'setUpLocusInfoMeetingListener'
2581
3060
  }, _constants.EVENTS.DESTROY_MEETING, {
2582
3061
  reason: payload.reason,
2583
- meetingId: _this17.id
3062
+ meetingId: _this18.id
2584
3063
  });
2585
3064
  }
2586
3065
  });
@@ -2597,14 +3076,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2597
3076
  }, {
2598
3077
  key: "updateMeetingObject",
2599
3078
  value: function updateMeetingObject(object) {
2600
- var _this18 = this;
3079
+ var _this19 = this;
2601
3080
 
2602
3081
  // Validate if these are valid meeting object property
2603
3082
  // TODO: add a check to make sure the value passed in the constructor
2604
3083
  // is not changed by any delta event
2605
3084
  if (object && (0, _keys.default)(object).length) {
2606
3085
  (0, _keys.default)(object).forEach(function (key) {
2607
- _this18[key] = object[key];
3086
+ _this19[key] = object[key];
2608
3087
  });
2609
3088
  }
2610
3089
  }
@@ -2812,8 +3291,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2812
3291
  var _locusMeetingObject, _locusMeetingObject2, _locusMeetingObject3, _locusMeetingObject4, _locusMeetingObject6;
2813
3292
 
2814
3293
  this.conversationUrl = ((_locusMeetingObject = locusMeetingObject) === null || _locusMeetingObject === void 0 ? void 0 : _locusMeetingObject.conversationUrl) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.conversationUrl) || this.conversationUrl;
2815
- this.locusUrl = ((_locusMeetingObject2 = locusMeetingObject) === null || _locusMeetingObject2 === void 0 ? void 0 : _locusMeetingObject2.url) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.locusUrl) || this.locusUrl;
2816
- this.setSipUri(this.config.experimental.enableUnifiedMeetings ? ((_locusMeetingObject3 = locusMeetingObject) === null || _locusMeetingObject3 === void 0 ? void 0 : _locusMeetingObject3.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipUrl) : ((_locusMeetingObject4 = locusMeetingObject) === null || _locusMeetingObject4 === void 0 ? void 0 : _locusMeetingObject4.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipMeetingUri) || this.sipUri);
3294
+ this.locusUrl = ((_locusMeetingObject2 = locusMeetingObject) === null || _locusMeetingObject2 === void 0 ? void 0 : _locusMeetingObject2.url) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.locusUrl) || this.locusUrl; // @ts-ignore - config coming from registerPlugin
3295
+
3296
+ this.setSipUri(this.config.experimental.enableUnifiedMeetings ? ((_locusMeetingObject3 = locusMeetingObject) === null || _locusMeetingObject3 === void 0 ? void 0 : _locusMeetingObject3.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipUrl) : ((_locusMeetingObject4 = locusMeetingObject) === null || _locusMeetingObject4 === void 0 ? void 0 : _locusMeetingObject4.info.sipUri) || (webexMeetingInfo === null || webexMeetingInfo === void 0 ? void 0 : webexMeetingInfo.sipMeetingUri) || this.sipUri); // @ts-ignore - config coming from registerPlugin
2817
3297
 
2818
3298
  if (this.config.experimental.enableUnifiedMeetings) {
2819
3299
  var _locusMeetingObject5;
@@ -2871,153 +3351,33 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2871
3351
  // This can be tel no, device id or a sip uri, user Id
2872
3352
  this.sipUri = sipUri;
2873
3353
  }
2874
- /**
2875
- * Set the roap seq on the class instance
2876
- * @param {Number} seq
2877
- * @returns {undefined}
2878
- * @private
2879
- * @memberof Meeting
2880
- */
2881
-
2882
- }, {
2883
- key: "setRoapSeq",
2884
- value: function setRoapSeq(seq) {
2885
- if (seq >= 0) {
2886
- this.roapSeq = seq;
2887
- }
2888
- }
2889
3354
  /**
2890
3355
  * Set the locus info the class instance
2891
3356
  * @param {Object} locus
2892
3357
  * @param {Array} locus.mediaConnections
2893
3358
  * @param {String} locus.locusUrl
2894
3359
  * @param {String} locus.locusId
2895
- * @param {String} locus.mediaId
2896
- * @param {Object} locus.host
2897
- * @todo change name to genertic parser
2898
- * @returns {undefined}
2899
- * @private
2900
- * @memberof Meeting
2901
- */
2902
-
2903
- }, {
2904
- key: "setLocus",
2905
- value: function setLocus(locus) {
2906
- var mtgLocus = locus.locus || locus; // LocusInfo object saves the locus object
2907
- // this.locus = mtgLocus;
2908
-
2909
- this.mediaConnections = locus.mediaConnections;
2910
- this.locusUrl = locus.locusUrl || locus.url;
2911
- this.locusId = locus.locusId;
2912
- this.selfId = locus.selfId;
2913
- this.mediaId = locus.mediaId;
2914
- this.hostId = mtgLocus.host ? mtgLocus.host.id : this.hostId;
2915
- this.locusInfo.initialSetup(mtgLocus);
2916
- }
2917
- /**
2918
- * Sets the remote stream on the class instance and emits and
2919
- * event to developers
2920
- * @param {Object} pc The remote stream peer connection
2921
- * @returns {undefined}
2922
- * @public
2923
- * @memberof Meeting
2924
- */
2925
-
2926
- }, {
2927
- key: "setRemoteStream",
2928
- value: function setRemoteStream(pc) {
2929
- var _this19 = this;
2930
-
2931
- if (!pc) {
2932
- return;
2933
- } // eslint-disable-next-line no-param-reassign
2934
-
2935
-
2936
- pc.ontrack = function (event) {
2937
- // eslint-disable-next-line no-warning-comments
2938
- // TODO: It's possible for media to not be present
2939
- // so we might need to either
2940
- // A) wait until we have media flowing
2941
- // B) trigger a second event when video is flowing
2942
- _loggerProxy.default.logger.log("Meeting:index#setRemoteStream --> ontrack event received for peerConnection: ".concat(event));
2943
-
2944
- var MEDIA_ID = {
2945
- AUDIO_TRACK: '0',
2946
- VIDEO_TRACK: '1',
2947
- SHARE_TRACK: '2'
2948
- };
2949
- var eventType = null;
2950
- var mediaTrack = event.track;
2951
- var trackMediaID = null; // In case of safari some time the transceiver is not present for specific os version
2952
- // sdk tries to determine the transceive using the track id present
2953
-
2954
- if (event.transceiver && event.transceiver.mid) {
2955
- trackMediaID = event.transceiver.mid;
2956
- } else {
2957
- var _event$target = event.target,
2958
- audioTransceiver = _event$target.audioTransceiver,
2959
- videoTransceiver = _event$target.videoTransceiver,
2960
- shareTransceiver = _event$target.shareTransceiver; // audio kind indicates its a audio stream
2961
-
2962
- if (mediaTrack.id === audioTransceiver.receiver.track.id) {
2963
- trackMediaID = '0';
2964
- } else if (mediaTrack.id === videoTransceiver.receiver.track.id) {
2965
- trackMediaID = '1';
2966
- } else if (mediaTrack.id === shareTransceiver.receiver.track.id) {
2967
- trackMediaID = '2';
2968
- } else {
2969
- trackMediaID = null;
2970
-
2971
- _metrics.default.sendBehavioralMetric(_constants2.default.MUTE_AUDIO_FAILURE, {
2972
- correlation_id: _this19.correlationId,
2973
- locus_id: _this19.locusUrl.split('/').pop()
2974
- });
2975
- }
2976
- }
2977
-
2978
- switch (trackMediaID) {
2979
- case MEDIA_ID.AUDIO_TRACK:
2980
- eventType = _constants.EVENT_TYPES.REMOTE_AUDIO;
2981
-
2982
- _this19.mediaProperties.setRemoteAudioTrack(mediaTrack);
2983
-
2984
- break;
2985
-
2986
- case MEDIA_ID.VIDEO_TRACK:
2987
- eventType = _constants.EVENT_TYPES.REMOTE_VIDEO;
2988
-
2989
- _this19.mediaProperties.setRemoteVideoTrack(mediaTrack);
2990
-
2991
- break;
2992
-
2993
- case MEDIA_ID.SHARE_TRACK:
2994
- if (event.track) {
2995
- eventType = _constants.EVENT_TYPES.REMOTE_SHARE;
2996
-
2997
- _this19.mediaProperties.setRemoteShare(mediaTrack);
2998
- }
2999
-
3000
- break;
3001
-
3002
- default:
3003
- {
3004
- _loggerProxy.default.logger.log('Meeting:index#setRemoteStream --> no matching media track id');
3005
- }
3006
- } // start stats here the stats are coming null if you dont receive streams
3007
-
3360
+ * @param {String} locus.mediaId
3361
+ * @param {Object} locus.host
3362
+ * @todo change name to genertic parser
3363
+ * @returns {undefined}
3364
+ * @private
3365
+ * @memberof Meeting
3366
+ */
3008
3367
 
3009
- _this19.statsAnalyzer.startAnalyzer(_this19.mediaProperties.peerConnection);
3368
+ }, {
3369
+ key: "setLocus",
3370
+ value: function setLocus(locus) {
3371
+ var mtgLocus = locus.locus || locus; // LocusInfo object saves the locus object
3372
+ // this.locus = mtgLocus;
3010
3373
 
3011
- if (eventType && mediaTrack) {
3012
- _triggerProxy.default.trigger(_this19, {
3013
- file: 'meeting/index',
3014
- function: 'setRemoteStream:pc.ontrack'
3015
- }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
3016
- type: eventType,
3017
- stream: _util2.default.createMediaStream([mediaTrack])
3018
- });
3019
- }
3020
- };
3374
+ this.mediaConnections = locus.mediaConnections;
3375
+ this.locusUrl = locus.locusUrl || locus.url;
3376
+ this.locusId = locus.locusId;
3377
+ this.selfId = locus.selfId;
3378
+ this.mediaId = locus.mediaId;
3379
+ this.hostId = mtgLocus.host ? mtgLocus.host.id : this.hostId;
3380
+ this.locusInfo.initialSetup(mtgLocus);
3021
3381
  }
3022
3382
  /**
3023
3383
  * Upload logs for the current meeting
@@ -3257,7 +3617,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3257
3617
  }
3258
3618
  /**
3259
3619
  * Sets the local media stream on the class and emits an event to the developer
3260
- * @param {Stream} localShare the local media stream
3620
+ * @param {MediaStream} localShare the local media stream
3261
3621
  * @returns {undefined}
3262
3622
  * @public
3263
3623
  * @memberof Meeting
@@ -3401,6 +3761,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3401
3761
 
3402
3762
  // Client will have a socket manager and handle reconnecting to mercury, when we reconnect to mercury
3403
3763
  // if the meeting has active peer connections, it should try to reconnect.
3764
+ // @ts-ignore
3404
3765
  this.webex.internal.mercury.on(_constants.ONLINE, function () {
3405
3766
  _loggerProxy.default.logger.info('Meeting:index#setMercuryListener --> Web socket online'); // Only send restore event when it was disconnected before and for connected later
3406
3767
 
@@ -3417,7 +3778,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3417
3778
  }
3418
3779
 
3419
3780
  _this24.hasWebsocketConnected = true;
3420
- });
3781
+ }); // @ts-ignore
3782
+
3421
3783
  this.webex.internal.mercury.on(_constants.OFFLINE, function () {
3422
3784
  _loggerProxy.default.logger.error('Meeting:index#setMercuryListener --> Web socket offline');
3423
3785
 
@@ -3432,9 +3794,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3432
3794
  });
3433
3795
  }
3434
3796
  /**
3435
- * Close the peer connections and remove them from the class. Triggers an event
3436
- * when each is closed.
3437
- * @returns {Promise} returns a resolved promise with an array of closed peer connections
3797
+ * Close the peer connections and remove them from the class.
3798
+ * Cleanup any media connection related things.
3799
+ *
3800
+ * @returns {Promise}
3438
3801
  * @public
3439
3802
  * @memberof Meeting
3440
3803
  */
@@ -3442,12 +3805,24 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3442
3805
  }, {
3443
3806
  key: "closePeerConnections",
3444
3807
  value: function closePeerConnections() {
3445
- return _peerConnectionManager.default.close(this.mediaProperties.peerConnection);
3808
+ if (this.mediaProperties.webrtcMediaConnection) {
3809
+ if (this.remoteMediaManager) {
3810
+ this.remoteMediaManager.stop();
3811
+ this.remoteMediaManager = null;
3812
+ }
3813
+
3814
+ (0, _values.default)(this.mediaRequestManagers).forEach(function (mediaRequestManager) {
3815
+ return mediaRequestManager.reset();
3816
+ });
3817
+ this.receiveSlotManager.reset();
3818
+ this.mediaProperties.webrtcMediaConnection.close();
3819
+ }
3820
+
3821
+ return _promise.default.resolve();
3446
3822
  }
3447
3823
  /**
3448
3824
  * Unsets the peer connections on the class
3449
3825
  * warning DO NOT CALL WITHOUT CLOSING PEER CONNECTIONS FIRST
3450
- * @param {PeerConnection} peerConnection
3451
3826
  * @returns {undefined}
3452
3827
  * @public
3453
3828
  * @memberof Meeting
@@ -3456,9 +3831,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3456
3831
  }, {
3457
3832
  key: "unsetPeerConnections",
3458
3833
  value: function unsetPeerConnections() {
3459
- this.mediaProperties.unsetPeerConnection();
3834
+ this.mediaProperties.unsetPeerConnection(); // @ts-ignore - config coming from registerPlugin
3460
3835
 
3461
3836
  if (this.config.reconnection.detection) {
3837
+ // @ts-ignore
3462
3838
  this.webex.internal.mercury.off(_constants.ONLINE);
3463
3839
  }
3464
3840
  }
@@ -3489,7 +3865,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3489
3865
 
3490
3866
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3491
3867
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3492
- }
3868
+ } // @ts-ignore
3869
+
3493
3870
 
3494
3871
  if (!this.mediaId) {
3495
3872
  // Happens when addMedia and mute are triggered in succession
@@ -3542,7 +3919,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3542
3919
 
3543
3920
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3544
3921
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3545
- }
3922
+ } // @ts-ignore
3923
+
3546
3924
 
3547
3925
  if (!this.mediaId) {
3548
3926
  // Happens when addMedia and mute are triggered in succession
@@ -3595,7 +3973,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3595
3973
 
3596
3974
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3597
3975
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3598
- }
3976
+ } // @ts-ignore
3977
+
3599
3978
 
3600
3979
  if (!this.mediaId) {
3601
3980
  // Happens when addMedia and mute are triggered in succession
@@ -3647,7 +4026,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3647
4026
 
3648
4027
  if (!_util.default.isUserInJoinedState(this.locusInfo)) {
3649
4028
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
3650
- }
4029
+ } // @ts-ignore
4030
+
3651
4031
 
3652
4032
  if (!this.mediaId) {
3653
4033
  // Happens when addMedia and mute are triggered in succession
@@ -3772,14 +4152,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3772
4152
 
3773
4153
  if (!this.reconnectionManager || !this.reconnectionManager.reconnect) {
3774
4154
  return _promise.default.reject(new _parameter.default('Cannot reconnect, ReconnectionManager must first be defined.'));
3775
- }
4155
+ } // @ts-ignore - currentMediaStatus coming from SelfUtil
4156
+
3776
4157
 
3777
4158
  if (!_util.default.isMediaEstablished(this.currentMediaStatus)) {
3778
4159
  return _promise.default.reject(new _parameter.default('Cannot reconnect, Media has not established to reconnect'));
3779
4160
  }
3780
4161
 
3781
4162
  try {
3782
- _loggerProxy.default.logger.info('Meeting:index#reconnect --> Validating reconnect ability.');
4163
+ _loggerProxy.default.logger.info('Meeting:index#reconnect --> Validating reconnect ability.'); // @ts-ignore
4164
+
3783
4165
 
3784
4166
  this.reconnectionManager.validate();
3785
4167
  } catch (error) {
@@ -3900,7 +4282,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3900
4282
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Attempting to generate a web socket url.");
3901
4283
 
3902
4284
  _context2.prev = 1;
3903
- datachannelUrl = this.locusInfo.info.datachannelUrl;
4285
+ datachannelUrl = this.locusInfo.info.datachannelUrl; // @ts-ignore - fix type
4286
+
3904
4287
  _context2.next = 5;
3905
4288
  return this.request({
3906
4289
  method: _constants.HTTP_VERBS.POST,
@@ -3916,7 +4299,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3916
4299
 
3917
4300
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n Generated web socket url succesfully.");
3918
4301
 
3919
- this.transcription = new _transcription.default(webSocketUrl, this.webex.sessionId, this.members);
4302
+ this.transcription = new _transcription.default(webSocketUrl, // @ts-ignore - fix type
4303
+ this.webex.sessionId, this.members);
3920
4304
 
3921
4305
  _loggerProxy.default.logger.info("Meeting:index#receiveTranscription -->\n opened LLM web socket connection successfully."); // retrieve and pass the payload
3922
4306
 
@@ -3927,7 +4311,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3927
4311
  function: 'join'
3928
4312
  }, _constants.EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, payload);
3929
4313
  });
3930
- this.monitorTranscriptionSocketConnection();
4314
+ this.monitorTranscriptionSocketConnection(); // @ts-ignore - fix type
4315
+
3931
4316
  this.transcription.connect(this.webex.credentials.supertoken.access_token);
3932
4317
  _context2.next = 19;
3933
4318
  break;
@@ -4008,6 +4393,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4008
4393
 
4009
4394
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4010
4395
 
4396
+ // @ts-ignore - fix type
4011
4397
  if (!this.webex.meetings.registered) {
4012
4398
  var errorMessage = 'Meeting:index#join --> Device not registered';
4013
4399
  var error = new Error(errorMessage);
@@ -4113,6 +4499,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4113
4499
  }
4114
4500
  }
4115
4501
 
4502
+ this.isMultistream = !!options.enableMultistream;
4116
4503
  return _util.default.joinMeetingOptions(this, options).then(function (join) {
4117
4504
  _this33.meetingFiniteStateMachine.join();
4118
4505
 
@@ -4133,48 +4520,76 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4133
4520
  return _regenerator.default.wrap(function _callee3$(_context3) {
4134
4521
  while (1) {
4135
4522
  switch (_context3.prev = _context3.next) {
4523
+ case 0:
4524
+ if (!_this33.config.enableAutomaticLLM) {
4525
+ _context3.next = 3;
4526
+ break;
4527
+ }
4528
+
4529
+ _context3.next = 3;
4530
+ return _this33.updateLLMConnection();
4531
+
4532
+ case 3:
4533
+ return _context3.abrupt("return", join);
4534
+
4535
+ case 4:
4536
+ case "end":
4537
+ return _context3.stop();
4538
+ }
4539
+ }
4540
+ }, _callee3);
4541
+ }));
4542
+
4543
+ return function (_x2) {
4544
+ return _ref11.apply(this, arguments);
4545
+ };
4546
+ }()).then( /*#__PURE__*/function () {
4547
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(join) {
4548
+ return _regenerator.default.wrap(function _callee4$(_context4) {
4549
+ while (1) {
4550
+ switch (_context4.prev = _context4.next) {
4136
4551
  case 0:
4137
4552
  if (!isBrowser) {
4138
- _context3.next = 8;
4553
+ _context4.next = 8;
4139
4554
  break;
4140
4555
  }
4141
4556
 
4142
4557
  if (!(_this33.config.receiveTranscription || options.receiveTranscription)) {
4143
- _context3.next = 6;
4558
+ _context4.next = 6;
4144
4559
  break;
4145
4560
  }
4146
4561
 
4147
4562
  if (!_this33.isTranscriptionSupported()) {
4148
- _context3.next = 6;
4563
+ _context4.next = 6;
4149
4564
  break;
4150
4565
  }
4151
4566
 
4152
- _context3.next = 5;
4567
+ _context4.next = 5;
4153
4568
  return _this33.receiveTranscription();
4154
4569
 
4155
4570
  case 5:
4156
4571
  _loggerProxy.default.logger.info('Meeting:index#join --> enabled to recieve transcription!');
4157
4572
 
4158
4573
  case 6:
4159
- _context3.next = 9;
4574
+ _context4.next = 9;
4160
4575
  break;
4161
4576
 
4162
4577
  case 8:
4163
4578
  _loggerProxy.default.logger.error('Meeting:index#join --> Receving transcription is not supported on this platform');
4164
4579
 
4165
4580
  case 9:
4166
- return _context3.abrupt("return", join);
4581
+ return _context4.abrupt("return", join);
4167
4582
 
4168
4583
  case 10:
4169
4584
  case "end":
4170
- return _context3.stop();
4585
+ return _context4.stop();
4171
4586
  }
4172
4587
  }
4173
- }, _callee3);
4588
+ }, _callee4);
4174
4589
  }));
4175
4590
 
4176
- return function (_x2) {
4177
- return _ref11.apply(this, arguments);
4591
+ return function (_x3) {
4592
+ return _ref12.apply(this, arguments);
4178
4593
  };
4179
4594
  }()).catch(function (error) {
4180
4595
  var _error$error;
@@ -4210,6 +4625,69 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4210
4625
  return _promise.default.reject(error);
4211
4626
  });
4212
4627
  }
4628
+ /**
4629
+ * Connects to low latency mercury and reconnects if the address has changed
4630
+ * It will also disconnect if called when the meeting has ended
4631
+ * @param {String} datachannelUrl
4632
+ * @returns {Promise}
4633
+ */
4634
+
4635
+ }, {
4636
+ key: "updateLLMConnection",
4637
+ value: function () {
4638
+ var _updateLLMConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
4639
+ var _this$locusInfo, url, _this$locusInfo$info, datachannelUrl, isJoined;
4640
+
4641
+ return _regenerator.default.wrap(function _callee5$(_context5) {
4642
+ while (1) {
4643
+ switch (_context5.prev = _context5.next) {
4644
+ case 0:
4645
+ _this$locusInfo = this.locusInfo, url = _this$locusInfo.url, _this$locusInfo$info = _this$locusInfo.info;
4646
+ _this$locusInfo$info = _this$locusInfo$info === void 0 ? {} : _this$locusInfo$info;
4647
+ datachannelUrl = _this$locusInfo$info.datachannelUrl;
4648
+ isJoined = this.joinedWith && this.joinedWith.state === 'JOINED';
4649
+
4650
+ if (!this.webex.internal.llm.isConnected()) {
4651
+ _context5.next = 9;
4652
+ break;
4653
+ }
4654
+
4655
+ if (!(url === this.webex.internal.llm.getLocusUrl() && isJoined)) {
4656
+ _context5.next = 7;
4657
+ break;
4658
+ }
4659
+
4660
+ return _context5.abrupt("return", undefined);
4661
+
4662
+ case 7:
4663
+ _context5.next = 9;
4664
+ return this.webex.internal.llm.disconnectLLM();
4665
+
4666
+ case 9:
4667
+ if (isJoined) {
4668
+ _context5.next = 11;
4669
+ break;
4670
+ }
4671
+
4672
+ return _context5.abrupt("return", undefined);
4673
+
4674
+ case 11:
4675
+ return _context5.abrupt("return", this.webex.internal.llm.registerAndConnect(url, datachannelUrl));
4676
+
4677
+ case 12:
4678
+ case "end":
4679
+ return _context5.stop();
4680
+ }
4681
+ }
4682
+ }, _callee5, this);
4683
+ }));
4684
+
4685
+ function updateLLMConnection() {
4686
+ return _updateLLMConnection.apply(this, arguments);
4687
+ }
4688
+
4689
+ return updateLLMConnection;
4690
+ }()
4213
4691
  /**
4214
4692
  * Use phone for meeting audio
4215
4693
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -4378,21 +4856,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4378
4856
  meeting: this
4379
4857
  });
4380
4858
 
4381
- this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
4859
+ this.locusInfo.once(_constants.LOCUSINFO.EVENTS.SELF_OBSERVING, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
4382
4860
  var mediaSettings;
4383
- return _regenerator.default.wrap(function _callee4$(_context4) {
4861
+ return _regenerator.default.wrap(function _callee6$(_context6) {
4384
4862
  while (1) {
4385
- switch (_context4.prev = _context4.next) {
4863
+ switch (_context6.prev = _context6.next) {
4386
4864
  case 0:
4387
- _context4.prev = 0;
4865
+ _context6.prev = 0;
4388
4866
 
4389
4867
  if (!_this36.isSharing) {
4390
- _context4.next = 4;
4868
+ _context6.next = 4;
4391
4869
  break;
4392
4870
  }
4393
4871
 
4394
- _context4.next = 4;
4395
- return _this36.stopFloorRequest();
4872
+ _context6.next = 4;
4873
+ return _this36.releaseScreenShareFloor();
4396
4874
 
4397
4875
  case 4:
4398
4876
  mediaSettings = {
@@ -4409,46 +4887,47 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4409
4887
  _this36.mediaProperties.setMediaDirection(mediaSettings.mediaDirection); // close the existing local tracks
4410
4888
 
4411
4889
 
4412
- _context4.next = 8;
4890
+ _context6.next = 8;
4413
4891
  return _this36.closeLocalStream();
4414
4892
 
4415
4893
  case 8:
4416
- _context4.next = 10;
4894
+ _context6.next = 10;
4417
4895
  return _this36.closeLocalShare();
4418
4896
 
4419
4897
  case 10:
4420
4898
  _this36.mediaProperties.unsetMediaTracks(); // 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
4421
4899
  // once the DX answers we establish connection back the media server with only receiveShare enabled
4900
+ // @ts-ignore - reconnectMedia does not accept any argument
4422
4901
 
4423
4902
 
4424
- _context4.next = 13;
4903
+ _context6.next = 13;
4425
4904
  return _this36.reconnectionManager.reconnectMedia(mediaSettings).then(function () {
4426
4905
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_SUCCESS);
4427
4906
  });
4428
4907
 
4429
4908
  case 13:
4430
- _context4.next = 19;
4909
+ _context6.next = 19;
4431
4910
  break;
4432
4911
 
4433
4912
  case 15:
4434
- _context4.prev = 15;
4435
- _context4.t0 = _context4["catch"](0);
4913
+ _context6.prev = 15;
4914
+ _context6.t0 = _context6["catch"](0);
4436
4915
 
4437
- _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context4.t0);
4916
+ _loggerProxy.default.logger.error('Meeting:index#moveTo --> Failed to moveTo resourceId', _context6.t0);
4438
4917
 
4439
4918
  _metrics.default.sendBehavioralMetric(_constants2.default.MOVE_TO_FAILURE, {
4440
4919
  correlation_id: _this36.correlationId,
4441
4920
  locus_id: _this36.locusUrl.split('/').pop(),
4442
- reason: _context4.t0.message,
4443
- stack: _context4.t0.stack
4921
+ reason: _context6.t0.message,
4922
+ stack: _context6.t0.stack
4444
4923
  });
4445
4924
 
4446
4925
  case 19:
4447
4926
  case "end":
4448
- return _context4.stop();
4927
+ return _context6.stop();
4449
4928
  }
4450
4929
  }
4451
- }, _callee4, null, [[0, 15]]);
4930
+ }, _callee6, null, [[0, 15]]);
4452
4931
  })));
4453
4932
 
4454
4933
  _loggerProxy.default.logger.info('Meeting:index#moveTo --> Initated moved to using resourceId', resourceId);
@@ -4525,6 +5004,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4525
5004
  }
4526
5005
  /**
4527
5006
  * Get local media streams based on options passed
5007
+ *
5008
+ * NOTE: this method can only be used with transcoded meetings, not with multistream meetings
5009
+ *
4528
5010
  * @param {MediaDirection} mediaDirection A configurable options object for joining a meeting
4529
5011
  * @param {AudioVideo} [audioVideo] audio/video object to set audioinput and videoinput devices, see #Media.getUserMedia
4530
5012
  * @param {SharePreferences} [sharePreferences] audio/video object to set audioinput and videoinput devices, see #Media.getUserMedia
@@ -4535,8 +5017,49 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4535
5017
  */
4536
5018
 
4537
5019
  }, {
4538
- key: "addMedia",
4539
- value:
5020
+ key: "getMediaConnectionDebugId",
5021
+ value: function getMediaConnectionDebugId() {
5022
+ return "MC-".concat(this.id.substring(0, 4));
5023
+ }
5024
+ }, {
5025
+ key: "createMediaConnection",
5026
+ value: function createMediaConnection(turnServerInfo) {
5027
+ var mc = _media.default.createMediaConnection(this.isMultistream, this.getMediaConnectionDebugId(), {
5028
+ mediaProperties: this.mediaProperties,
5029
+ remoteQualityLevel: this.mediaProperties.remoteQualityLevel,
5030
+ // @ts-ignore - config coming from registerPlugin
5031
+ enableRtx: this.config.enableRtx,
5032
+ // @ts-ignore - config coming from registerPlugin
5033
+ enableExtmap: this.config.enableExtmap,
5034
+ turnServerInfo: turnServerInfo
5035
+ });
5036
+
5037
+ this.mediaProperties.setMediaPeerConnection(mc);
5038
+ this.setupMediaConnectionListeners();
5039
+ return mc;
5040
+ }
5041
+ /**
5042
+ * Listens for an event emitted by eventEmitter and emits it from the meeting object
5043
+ *
5044
+ * @private
5045
+ * @param {*} eventEmitter object from which to forward the event
5046
+ * @param {*} eventTypeToForward which event type to listen on and to forward
5047
+ * @param {string} meetingEventType event type to be used in the event emitted from the meeting object
5048
+ * @returns {void}
5049
+ */
5050
+
5051
+ }, {
5052
+ key: "forwardEvent",
5053
+ value: function forwardEvent(eventEmitter, eventTypeToForward, meetingEventType) {
5054
+ var _this38 = this;
5055
+
5056
+ eventEmitter.on(eventTypeToForward, function (data) {
5057
+ return _triggerProxy.default.trigger(_this38, {
5058
+ file: 'meetings',
5059
+ function: 'addMedia'
5060
+ }, meetingEventType, data);
5061
+ });
5062
+ }
4540
5063
  /**
4541
5064
  * Specify joining via audio (option: pstn), video, screenshare
4542
5065
  * @param {Object} options A configurable options object for joining a meeting
@@ -4544,12 +5067,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4544
5067
  * @param {MediaDirection} options.mediaSettings pass media options
4545
5068
  * @param {MediaStream} options.localStream
4546
5069
  * @param {MediaStream} options.localShare
5070
+ * @param {RemoteMediaManagerConfig} options.remoteMediaManagerConfig only applies if multistream is enabled
4547
5071
  * @returns {Promise}
4548
5072
  * @public
4549
5073
  * @memberof Meeting
4550
5074
  */
4551
- function addMedia() {
4552
- var _this38 = this;
5075
+
5076
+ }, {
5077
+ key: "addMedia",
5078
+ value: function addMedia() {
5079
+ var _this39 = this;
4553
5080
 
4554
5081
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4555
5082
  var LOG_HEADER = 'Meeting:index#addMedia -->';
@@ -4563,6 +5090,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4563
5090
  if (_util.default.isUserInLeftState(this.locusInfo)) {
4564
5091
  return _promise.default.reject(new _webexErrors.UserNotJoinedError());
4565
5092
  } // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
5093
+ // @ts-ignore - isUserUnadmitted coming from SelfUtil
4566
5094
 
4567
5095
 
4568
5096
  if (this.isUserUnadmitted && !this.wirelessShare) {
@@ -4571,7 +5099,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4571
5099
 
4572
5100
  var localStream = options.localStream,
4573
5101
  localShare = options.localShare,
4574
- mediaSettings = options.mediaSettings;
5102
+ mediaSettings = options.mediaSettings,
5103
+ remoteMediaManagerConfig = options.remoteMediaManagerConfig;
4575
5104
 
4576
5105
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " Adding Media."));
4577
5106
 
@@ -4599,75 +5128,70 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4599
5128
  });
4600
5129
 
4601
5130
  return _util.default.validateOptions(options).then(function () {
4602
- return _this38.roap.doTurnDiscovery(_this38, false);
5131
+ return _this39.roap.doTurnDiscovery(_this39, false);
4603
5132
  }).then(function (turnDiscoveryObject) {
4604
5133
  turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
4605
5134
  turnServerUsed = !turnDiscoverySkippedReason;
4606
5135
  var turnServerInfo = turnDiscoveryObject.turnServerInfo;
4607
5136
 
4608
- _this38.mediaProperties.setMediaPeerConnection(_util2.default.createPeerConnection(turnServerInfo));
5137
+ _this39.preMedia(localStream, localShare, mediaSettings);
5138
+
5139
+ var mc = _this39.createMediaConnection(turnServerInfo);
5140
+
5141
+ if (_this39.isMultistream) {
5142
+ _this39.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this39.receiveSlotManager, _this39.mediaRequestManagers, remoteMediaManagerConfig);
5143
+
5144
+ _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5145
+
5146
+ _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
4609
5147
 
4610
- _this38.setMercuryListener();
5148
+ _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
4611
5149
 
4612
- _peerConnectionManager.default.setPeerConnectionEvents(_this38);
5150
+ return _this39.remoteMediaManager.start().then(function () {
5151
+ return mc.initiateOffer();
5152
+ });
5153
+ }
4613
5154
 
4614
- return _this38.preMedia(localStream, localShare, mediaSettings);
5155
+ return mc.initiateOffer();
4615
5156
  }).then(function () {
4616
- return _media.default.attachMedia(_this38.mediaProperties, {
4617
- meetingId: _this38.id,
4618
- remoteQualityLevel: _this38.mediaProperties.remoteQualityLevel,
4619
- enableRtx: _this38.config.enableRtx,
4620
- enableExtmap: _this38.config.enableExtmap,
4621
- setStartLocalSDPGenRemoteSDPRecvDelay: _this38.setStartLocalSDPGenRemoteSDPRecvDelay.bind(_this38)
4622
- });
4623
- }).then(function (peerConnection) {
4624
- return _this38.getDevices().then(function (devices) {
5157
+ _this39.setMercuryListener();
5158
+ }).then(function () {
5159
+ return _this39.getDevices().then(function (devices) {
4625
5160
  _util.default.handleDeviceLogging(devices);
4626
-
4627
- return peerConnection;
4628
5161
  });
4629
- }).then(function (peerConnection) {
4630
- _this38.handleMediaLogging(_this38.mediaProperties);
5162
+ }).then(function () {
5163
+ _this39.handleMediaLogging(_this39.mediaProperties);
4631
5164
 
4632
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " PeerConnection Received from attachMedia "));
5165
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created")); // @ts-ignore - config coming from registerPlugin
4633
5166
 
4634
- _this38.setRemoteStream(peerConnection);
4635
5167
 
4636
- if (_this38.config.stats.enableStatsAnalyzer) {
4637
- // TODO: ** Dont re create StatsAnalyzer on reconnect or rejoin
4638
- _this38.networkQualityMonitor = new _networkQualityMonitor.default(_this38.config.stats);
4639
- _this38.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(_this38.config.stats, _this38.networkQualityMonitor);
5168
+ if (_this39.config.stats.enableStatsAnalyzer) {
5169
+ // @ts-ignore - config coming from registerPlugin
5170
+ _this39.networkQualityMonitor = new _networkQualityMonitor.default(_this39.config.stats); // @ts-ignore - config coming from registerPlugin
4640
5171
 
4641
- _this38.setupStatsAnalyzerEventHandlers();
5172
+ _this39.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(_this39.config.stats, _this39.networkQualityMonitor);
4642
5173
 
4643
- _this38.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this38.sendNetworkQualityEvent.bind(_this38));
5174
+ _this39.setupStatsAnalyzerEventHandlers();
5175
+
5176
+ _this39.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this39.sendNetworkQualityEvent.bind(_this39));
4644
5177
  }
4645
5178
  }).catch(function (error) {
4646
5179
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media , setting up peerconnection, "), error);
4647
5180
 
4648
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, {
4649
- correlation_id: _this38.correlationId,
4650
- locus_id: _this38.locusUrl.split('/').pop(),
4651
- reason: error.message,
4652
- stack: error.stack,
4653
- turnDiscoverySkippedReason: turnDiscoverySkippedReason,
4654
- turnServerUsed: turnServerUsed
4655
- });
4656
-
4657
5181
  throw error;
4658
5182
  }).then(function () {
4659
5183
  return new _promise.default(function (resolve, reject) {
4660
5184
  var timerCount = 0; // eslint-disable-next-line func-names
4661
5185
  // eslint-disable-next-line prefer-arrow-callback
4662
5186
 
4663
- if (_this38.type === _constants._CALL_) {
5187
+ if (_this39.type === _constants._CALL_) {
4664
5188
  resolve();
4665
5189
  }
4666
5190
 
4667
5191
  var joiningTimer = setInterval(function () {
4668
5192
  timerCount += 1;
4669
5193
 
4670
- if (_this38.meetingState === _constants.FULL_STATE.ACTIVE) {
5194
+ if (_this39.meetingState === _constants.FULL_STATE.ACTIVE) {
4671
5195
  clearInterval(joiningTimer);
4672
5196
  resolve();
4673
5197
  }
@@ -4679,58 +5203,47 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4679
5203
  }, 1000);
4680
5204
  });
4681
5205
  }).then(function () {
4682
- return logRequest(_this38.roap.sendRoapMediaRequest({
4683
- sdp: _this38.mediaProperties.peerConnection.sdp,
4684
- roapSeq: _this38.roapSeq,
4685
- meeting: _this38 // or can pass meeting ID
4686
-
4687
- }), {
4688
- header: "".concat(LOG_HEADER, " Send Roap Media Request."),
4689
- success: "".concat(LOG_HEADER, " Successfully send roap media request"),
4690
- failure: "".concat(LOG_HEADER, " Error joining the call on send roap media request, ")
4691
- });
4692
- }).then(function () {
4693
- return _this38.mediaProperties.waitForIceConnectedState().catch(function () {
5206
+ return _this39.mediaProperties.waitForMediaConnectionConnected().catch(function () {
4694
5207
  throw (0, _webexErrors.createMeetingsError)(30202, 'Meeting connection failed');
4695
5208
  });
4696
5209
  }).then(function () {
4697
5210
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " PeerConnection CONNECTED"));
4698
5211
 
4699
5212
  if (mediaSettings && mediaSettings.sendShare && localShare) {
4700
- if (_this38.state === _constants.MEETING_STATE.STATES.JOINED) {
4701
- return _this38.share();
5213
+ if (_this39.state === _constants.MEETING_STATE.STATES.JOINED) {
5214
+ return _this39.requestScreenShareFloor();
4702
5215
  } // When the self state changes to JOINED then request the floor
4703
5216
 
4704
5217
 
4705
- _this38.floorGrantPending = true;
5218
+ _this39.floorGrantPending = true;
4706
5219
  }
4707
5220
 
4708
5221
  return {};
4709
5222
  }).then(function () {
4710
- return _this38.mediaProperties.getCurrentConnectionType();
5223
+ return _this39.mediaProperties.getCurrentConnectionType();
4711
5224
  }).then(function (connectionType) {
4712
5225
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, {
4713
- correlation_id: _this38.correlationId,
4714
- locus_id: _this38.locusUrl.split('/').pop(),
5226
+ correlation_id: _this39.correlationId,
5227
+ locus_id: _this39.locusUrl.split('/').pop(),
4715
5228
  connectionType: connectionType
4716
5229
  });
4717
5230
  }).catch(function (error) {
4718
5231
  // Clean up stats analyzer, peer connection, and turn off listeners
4719
- var stopStatsAnalyzer = _this38.statsAnalyzer ? _this38.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
5232
+ var stopStatsAnalyzer = _this39.statsAnalyzer ? _this39.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
4720
5233
  return stopStatsAnalyzer.then(function () {
4721
- _this38.statsAnalyzer = null;
5234
+ _this39.statsAnalyzer = null;
4722
5235
 
4723
- if (_this38.mediaProperties.peerConnection) {
4724
- _this38.closePeerConnections();
5236
+ if (_this39.mediaProperties.webrtcMediaConnection) {
5237
+ _this39.closePeerConnections();
4725
5238
 
4726
- _this38.unsetPeerConnections();
5239
+ _this39.unsetPeerConnections();
4727
5240
  }
4728
5241
 
4729
5242
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media failed to initiate PC and send request, "), error);
4730
5243
 
4731
5244
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, {
4732
- correlation_id: _this38.correlationId,
4733
- locus_id: _this38.locusUrl.split('/').pop(),
5245
+ correlation_id: _this39.correlationId,
5246
+ locus_id: _this39.locusUrl.split('/').pop(),
4734
5247
  reason: error.message,
4735
5248
  stack: error.stack,
4736
5249
  code: error.code,
@@ -4739,16 +5252,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4739
5252
  }); // Upload logs on error while adding media
4740
5253
 
4741
5254
 
4742
- _triggerProxy.default.trigger(_this38, {
5255
+ _triggerProxy.default.trigger(_this39, {
4743
5256
  file: 'meeting/index',
4744
5257
  function: 'addMedia'
4745
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this38); // If addMedia failes for not establishing connection then
4746
- // leave the meeting with reson connection failed as meeting anyways will end
4747
- // and cannot be connected unless network condition is checked for firewall
4748
-
5258
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this39);
4749
5259
 
4750
- if (error.code === _webexErrors.InvalidSdpError.CODE) {
4751
- _this38.leave({
5260
+ if (error instanceof _internalMediaCore.MediaConnection.Errors.SdpError) {
5261
+ _this39.leave({
4752
5262
  reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
4753
5263
  });
4754
5264
  }
@@ -4765,7 +5275,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4765
5275
  }, {
4766
5276
  key: "canUpdateMedia",
4767
5277
  value: function canUpdateMedia() {
4768
- return this.mediaProperties.peerConnection.signalingState === _constants.SDP.STABLE && !_collection.default.isBusy(this.correlationId);
5278
+ // in theory we shouldn't need this as RoapMediaConnection handles multiple updates, glare, etc,
5279
+ // but there are some server issues, like https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-248394
5280
+ // so for now it's better to keep queuing any media updates at SDK meeting level
5281
+ return !this.isRoapInProgress;
4769
5282
  }
4770
5283
  /**
4771
5284
  * Enqueues a media update operation.
@@ -4779,7 +5292,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4779
5292
  }, {
4780
5293
  key: "enqueueMediaUpdate",
4781
5294
  value: function enqueueMediaUpdate(mediaUpdateType, options) {
4782
- var _this39 = this;
5295
+ var _this40 = this;
4783
5296
 
4784
5297
  return new _promise.default(function (resolve, reject) {
4785
5298
  var queueItem = {
@@ -4791,7 +5304,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4791
5304
 
4792
5305
  _loggerProxy.default.logger.log("Meeting:index#enqueueMediaUpdate --> enqueuing media update type=".concat(mediaUpdateType));
4793
5306
 
4794
- _this39.queuedMediaUpdates.push(queueItem);
5307
+ _this40.queuedMediaUpdates.push(queueItem);
4795
5308
  });
4796
5309
  }
4797
5310
  /**
@@ -4812,12 +5325,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4812
5325
  * @param {MediaStream} options.localShare
4813
5326
  * @param {MediaDirection} options.mediaSettings
4814
5327
  * @returns {Promise}
4815
- * @todo fix setRemoteStream for updateMedia
4816
5328
  * @public
4817
5329
  * @memberof Meeting
4818
5330
  */
4819
5331
  function updateMedia() {
4820
- var _this40 = this;
5332
+ var _this41 = this;
4821
5333
 
4822
5334
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4823
5335
  var LOG_HEADER = 'Meeting:index#updateMedia -->';
@@ -4830,52 +5342,51 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4830
5342
  localShare = options.localShare,
4831
5343
  mediaSettings = options.mediaSettings;
4832
5344
  var previousSendShareStatus = this.mediaProperties.mediaDirection.sendShare;
5345
+
5346
+ if (!this.mediaProperties.webrtcMediaConnection) {
5347
+ return _promise.default.reject(new Error('media connection not established, call addMedia() first'));
5348
+ }
5349
+
4833
5350
  return _util.default.validateOptions(options).then(function () {
4834
- return _this40.preMedia(localStream, localShare, mediaSettings);
5351
+ return _this41.preMedia(localStream, localShare, mediaSettings);
4835
5352
  }).then(function () {
4836
- return _media.default.updateMedia(_this40.mediaProperties, {
4837
- meetingId: _this40.id,
4838
- remoteQualityLevel: _this40.mediaProperties.remoteQualityLevel,
4839
- enableRtx: _this40.config.enableRtx,
4840
- enableExtmap: _this40.config.enableExtmap
4841
- }).then(function (peerConnection) {
4842
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " PeerConnection received from updateMedia, ").concat(peerConnection));
4843
-
4844
- _this40.setRemoteStream(peerConnection);
4845
-
4846
- if (mediaSettings.receiveShare || localShare) {
4847
- _peerConnectionManager.default.setContentSlides(peerConnection);
5353
+ return _this41.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5354
+ send: {
5355
+ audio: _this41.mediaProperties.mediaDirection.sendAudio ? _this41.mediaProperties.audioTrack : null,
5356
+ video: _this41.mediaProperties.mediaDirection.sendVideo ? _this41.mediaProperties.videoTrack : null,
5357
+ screenShareVideo: _this41.mediaProperties.mediaDirection.sendShare ? _this41.mediaProperties.shareTrack : null
5358
+ },
5359
+ receive: {
5360
+ audio: _this41.mediaProperties.mediaDirection.receiveAudio,
5361
+ video: _this41.mediaProperties.mediaDirection.receiveVideo,
5362
+ screenShareVideo: _this41.mediaProperties.mediaDirection.receiveShare,
5363
+ remoteQualityLevel: _this41.mediaProperties.remoteQualityLevel
4848
5364
  }
5365
+ }).then(function () {
5366
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " webrtcMediaConnection.updateSendReceiveOptions done"));
4849
5367
  }).catch(function (error) {
4850
5368
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error updatedMedia, "), error);
4851
5369
 
4852
5370
  _metrics.default.sendBehavioralMetric(_constants2.default.UPDATE_MEDIA_FAILURE, {
4853
- correlation_id: _this40.correlationId,
4854
- locus_id: _this40.locusUrl.split('/').pop(),
5371
+ correlation_id: _this41.correlationId,
5372
+ locus_id: _this41.locusUrl.split('/').pop(),
4855
5373
  reason: error.message,
4856
5374
  stack: error.stack
4857
5375
  });
4858
5376
 
4859
5377
  throw error;
4860
- }).then(function () {
4861
- return logRequest(_this40.roap.sendRoapMediaRequest({
4862
- sdp: _this40.mediaProperties.peerConnection.sdp,
4863
- roapSeq: _this40.roapSeq,
4864
- meeting: _this40 // or can pass meeting ID
4865
-
4866
- }), {
4867
- header: "".concat(LOG_HEADER, " sendRoapMediaRequest being sent"),
4868
- success: "".concat(LOG_HEADER, " sendRoadMediaRequest successful"),
4869
- failure: "".concat(LOG_HEADER, " Error updateMedia on send roap media request, ")
4870
- });
4871
- }).then(function () {
4872
- return _this40.checkForStopShare(mediaSettings.sendShare, previousSendShareStatus);
5378
+ }) // todo: the following code used to be called always after sending the roap message with the new SDP
5379
+ // now it's called independently from the roap message (so might be before it), check if that's OK
5380
+ // if not, ensure it's called after (now it's called after roap message is sent out, but we're not
5381
+ // waiting for sendRoapMediaRequest() to be resolved)
5382
+ .then(function () {
5383
+ return _this41.checkForStopShare(mediaSettings.sendShare, previousSendShareStatus);
4873
5384
  }).then(function (startShare) {
4874
5385
  // This is a special case if we do an /floor grant followed by /media
4875
5386
  // we actually get a OFFER from the server and a GLAR condition happens
4876
5387
  if (startShare) {
4877
5388
  // We are assuming that the clients are connected when doing an update
4878
- return _this40.share();
5389
+ return _this41.requestScreenShareFloor();
4879
5390
  }
4880
5391
 
4881
5392
  return _promise.default.resolve();
@@ -4884,6 +5395,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4884
5395
  }
4885
5396
  /**
4886
5397
  * Update the main audio track with new parameters
5398
+ *
5399
+ * NOTE: this method can only be used with transcoded meetings, for multistream meetings use publishTrack()
5400
+ *
4887
5401
  * @param {Object} options
4888
5402
  * @param {boolean} options.sendAudio
4889
5403
  * @param {boolean} options.receiveAudio
@@ -4896,103 +5410,98 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4896
5410
  }, {
4897
5411
  key: "updateAudio",
4898
5412
  value: function () {
4899
- var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(options) {
4900
- var _this41 = this;
5413
+ var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(options) {
5414
+ var _this42 = this;
4901
5415
 
4902
- var sendAudio, receiveAudio, stream, audioTransceiver, track, bnrEnabled;
4903
- return _regenerator.default.wrap(function _callee5$(_context5) {
5416
+ var sendAudio, receiveAudio, stream, track, bnrEnabled;
5417
+ return _regenerator.default.wrap(function _callee7$(_context7) {
4904
5418
  while (1) {
4905
- switch (_context5.prev = _context5.next) {
5419
+ switch (_context7.prev = _context7.next) {
4906
5420
  case 0:
4907
5421
  if (this.canUpdateMedia()) {
4908
- _context5.next = 2;
5422
+ _context7.next = 2;
4909
5423
  break;
4910
5424
  }
4911
5425
 
4912
- return _context5.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
5426
+ return _context7.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
4913
5427
 
4914
5428
  case 2:
4915
5429
  sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream;
4916
- audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
4917
5430
  track = _util.default.getTrack(stream).audioTrack;
4918
5431
 
4919
5432
  if (!(typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean')) {
4920
- _context5.next = 7;
5433
+ _context7.next = 6;
4921
5434
  break;
4922
5435
  }
4923
5436
 
4924
- return _context5.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
5437
+ return _context7.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
4925
5438
 
4926
- case 7:
5439
+ case 6:
5440
+ if (this.mediaProperties.webrtcMediaConnection) {
5441
+ _context7.next = 8;
5442
+ break;
5443
+ }
5444
+
5445
+ return _context7.abrupt("return", _promise.default.reject(new Error('media connection not established, call addMedia() first')));
5446
+
5447
+ case 8:
4927
5448
  if (!(this.effects && this.effects.state)) {
4928
- _context5.next = 15;
5449
+ _context7.next = 16;
4929
5450
  break;
4930
5451
  }
4931
5452
 
4932
5453
  bnrEnabled = this.effects.state.bnr.enabled;
4933
5454
 
4934
5455
  if (!(sendAudio && !this.isAudioMuted() && (bnrEnabled === _constants.BNR_STATUS.ENABLED || bnrEnabled === _constants.BNR_STATUS.SHOULD_ENABLE))) {
4935
- _context5.next = 15;
5456
+ _context7.next = 16;
4936
5457
  break;
4937
5458
  }
4938
5459
 
4939
5460
  _loggerProxy.default.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
4940
5461
 
4941
- _context5.next = 13;
5462
+ _context7.next = 14;
4942
5463
  return this.internal_enableBNR(track);
4943
5464
 
4944
- case 13:
4945
- track = _context5.sent;
5465
+ case 14:
5466
+ track = _context7.sent;
4946
5467
 
4947
5468
  _loggerProxy.default.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
4948
5469
 
4949
- case 15:
4950
- return _context5.abrupt("return", _util.default.validateOptions({
5470
+ case 16:
5471
+ return _context7.abrupt("return", _util.default.validateOptions({
4951
5472
  sendAudio: sendAudio,
4952
5473
  localStream: stream
4953
5474
  }).then(function () {
4954
- var previousMediaDirection = {};
4955
-
4956
- if (_this41.mediaProperties.mediaDirection) {
4957
- previousMediaDirection = {
4958
- sendTrack: _this41.mediaProperties.mediaDirection.sendAudio,
4959
- receiveTrack: _this41.mediaProperties.mediaDirection.receiveAudio
4960
- };
4961
- } else {
4962
- _this41.mediaProperties.mediaDirection = {};
4963
- }
4964
-
4965
- return _util.default.updateTransceiver({
4966
- type: 'audio',
4967
- sendTrack: options.sendAudio,
4968
- receiveTrack: options.receiveAudio,
4969
- track: track,
4970
- transceiver: audioTransceiver,
4971
- peerConnection: _this41.mediaProperties.peerConnection,
4972
- previousMediaDirection: previousMediaDirection
4973
- }, {
4974
- mediaProperties: _this41.mediaProperties,
4975
- meeting: _this41,
4976
- id: _this41.id
5475
+ return _this42.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5476
+ send: {
5477
+ audio: track
5478
+ },
5479
+ receive: {
5480
+ audio: options.receiveAudio,
5481
+ video: _this42.mediaProperties.mediaDirection.receiveVideo,
5482
+ screenShareVideo: _this42.mediaProperties.mediaDirection.receiveShare,
5483
+ remoteQualityLevel: _this42.mediaProperties.remoteQualityLevel
5484
+ }
4977
5485
  });
4978
5486
  }).then(function () {
4979
- _this41.setLocalAudioTrack(track);
5487
+ _this42.setLocalAudioTrack(track); // todo: maybe this.mediaProperties.mediaDirection could be removed? it's duplicating stuff from webrtcMediaConnection
5488
+
4980
5489
 
4981
- _this41.mediaProperties.mediaDirection.sendAudio = sendAudio;
4982
- _this41.mediaProperties.mediaDirection.receiveAudio = receiveAudio; // audio state could be undefined if you have not sent audio before
5490
+ _this42.mediaProperties.mediaDirection.sendAudio = sendAudio;
5491
+ _this42.mediaProperties.mediaDirection.receiveAudio = receiveAudio; // audio state could be undefined if you have not sent audio before
4983
5492
 
4984
- _this41.audio = _this41.audio || (0, _muteState.default)(_constants.AUDIO, _this41, _this41.mediaProperties.mediaDirection);
5493
+ _this42.audio = _this42.audio || (0, _muteState.default)(_constants.AUDIO, _this42, _this42.mediaProperties.mediaDirection);
4985
5494
  }));
4986
5495
 
4987
- case 16:
5496
+ case 17:
4988
5497
  case "end":
4989
- return _context5.stop();
5498
+ return _context7.stop();
4990
5499
  }
4991
5500
  }
4992
- }, _callee5, this);
5501
+ }, _callee7, this);
4993
5502
  }));
4994
5503
 
4995
- function updateAudio(_x3) {
5504
+ function updateAudio(_x4) {
4996
5505
  return _updateAudio.apply(this, arguments);
4997
5506
  }
4998
5507
 
@@ -5000,6 +5509,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5000
5509
  }()
5001
5510
  /**
5002
5511
  * Update the main video track with new parameters
5512
+ *
5513
+ * NOTE: this method can only be used with transcoded meetings, for multistream meetings use publishTrack()
5514
+ *
5003
5515
  * @param {Object} options
5004
5516
  * @param {boolean} options.sendVideo
5005
5517
  * @param {boolean} options.receiveVideo
@@ -5012,7 +5524,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5012
5524
  }, {
5013
5525
  key: "updateVideo",
5014
5526
  value: function updateVideo(options) {
5015
- var _this42 = this;
5527
+ var _this43 = this;
5016
5528
 
5017
5529
  if (!this.canUpdateMedia()) {
5018
5530
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.VIDEO, options);
@@ -5021,7 +5533,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5021
5533
  var sendVideo = options.sendVideo,
5022
5534
  receiveVideo = options.receiveVideo,
5023
5535
  stream = options.stream;
5024
- var videoTransceiver = this.mediaProperties.peerConnection.videoTransceiver;
5025
5536
 
5026
5537
  var track = _util.default.getTrack(stream).videoTrack;
5027
5538
 
@@ -5029,33 +5540,32 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5029
5540
  return _promise.default.reject(new _parameter.default('Pass sendVideo and receiveVideo parameter'));
5030
5541
  }
5031
5542
 
5543
+ if (!this.mediaProperties.webrtcMediaConnection) {
5544
+ return _promise.default.reject(new Error('media connection not established, call addMedia() first'));
5545
+ }
5546
+
5032
5547
  return _util.default.validateOptions({
5033
5548
  sendVideo: sendVideo,
5034
5549
  localStream: stream
5035
5550
  }).then(function () {
5036
- return _util.default.updateTransceiver({
5037
- type: 'video',
5038
- sendTrack: options.sendVideo,
5039
- receiveTrack: options.receiveVideo,
5040
- track: track,
5041
- transceiver: videoTransceiver,
5042
- peerConnection: _this42.mediaProperties.peerConnection,
5043
- previousMediaDirection: {
5044
- sendTrack: _this42.mediaProperties.mediaDirection.sendVideo,
5045
- receiveTrack: _this42.mediaProperties.mediaDirection.receiveVideo
5551
+ return _this43.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5552
+ send: {
5553
+ video: track
5554
+ },
5555
+ receive: {
5556
+ audio: _this43.mediaProperties.mediaDirection.receiveAudio,
5557
+ video: options.receiveVideo,
5558
+ screenShareVideo: _this43.mediaProperties.mediaDirection.receiveShare,
5559
+ remoteQualityLevel: _this43.mediaProperties.remoteQualityLevel
5046
5560
  }
5047
- }, {
5048
- mediaProperties: _this42.mediaProperties,
5049
- meeting: _this42,
5050
- id: _this42.id
5051
5561
  });
5052
5562
  }).then(function () {
5053
- _this42.setLocalVideoTrack(track);
5563
+ _this43.setLocalVideoTrack(track);
5054
5564
 
5055
- _this42.mediaProperties.mediaDirection.sendVideo = sendVideo;
5056
- _this42.mediaProperties.mediaDirection.receiveVideo = receiveVideo; // video state could be undefined if you have not sent video before
5565
+ _this43.mediaProperties.mediaDirection.sendVideo = sendVideo;
5566
+ _this43.mediaProperties.mediaDirection.receiveVideo = receiveVideo; // video state could be undefined if you have not sent video before
5057
5567
 
5058
- _this42.video = _this42.video || (0, _muteState.default)(_constants.VIDEO, _this42, _this42.mediaProperties.mediaDirection);
5568
+ _this43.video = _this43.video || (0, _muteState.default)(_constants.VIDEO, _this43, _this43.mediaProperties.mediaDirection);
5059
5569
  });
5060
5570
  }
5061
5571
  /**
@@ -5077,7 +5587,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5077
5587
 
5078
5588
  if (!sendShare && previousShareStatus) {
5079
5589
  // When user stops sharing
5080
- return this.stopFloorRequest().then(function () {
5590
+ return this.releaseScreenShareFloor().then(function () {
5081
5591
  return _promise.default.resolve(false);
5082
5592
  });
5083
5593
  }
@@ -5086,6 +5596,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5086
5596
  }
5087
5597
  /**
5088
5598
  * Update the share streams, can be used to start sharing
5599
+ *
5600
+ * NOTE: this method can only be used with transcoded meetings, for multistream meetings use publishTrack()
5601
+ *
5089
5602
  * @param {Object} options
5090
5603
  * @param {boolean} options.sendShare
5091
5604
  * @param {boolean} options.receiveShare
@@ -5097,7 +5610,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5097
5610
  }, {
5098
5611
  key: "updateShare",
5099
5612
  value: function updateShare(options) {
5100
- var _this43 = this;
5613
+ var _this44 = this;
5101
5614
 
5102
5615
  if (!options.skipSignalingCheck && !this.canUpdateMedia()) {
5103
5616
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.SHARE, options);
@@ -5106,7 +5619,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5106
5619
  var sendShare = options.sendShare,
5107
5620
  receiveShare = options.receiveShare,
5108
5621
  stream = options.stream;
5109
- var shareTransceiver = this.mediaProperties.peerConnection.shareTransceiver;
5110
5622
 
5111
5623
  var track = _util.default.getTrack(stream).videoTrack;
5112
5624
 
@@ -5114,57 +5626,42 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5114
5626
  return _promise.default.reject(new _parameter.default('Pass sendShare and receiveShare parameter'));
5115
5627
  }
5116
5628
 
5629
+ if (!this.mediaProperties.webrtcMediaConnection) {
5630
+ return _promise.default.reject(new Error('media connection not established, call addMedia() first'));
5631
+ }
5632
+
5117
5633
  var previousSendShareStatus = this.mediaProperties.mediaDirection.sendShare;
5118
5634
  this.setLocalShareTrack(stream);
5119
5635
  return _util.default.validateOptions({
5120
5636
  sendShare: sendShare,
5121
5637
  localShare: stream
5122
5638
  }).then(function () {
5123
- return _this43.checkForStopShare(sendShare, previousSendShareStatus);
5639
+ return _this44.checkForStopShare(sendShare, previousSendShareStatus);
5124
5640
  }).then(function (startShare) {
5125
- return _util.default.updateTransceiver({
5126
- type: 'video',
5127
- sendTrack: sendShare,
5128
- receiveTrack: receiveShare,
5129
- track: track,
5130
- transceiver: shareTransceiver,
5131
- peerConnection: _this43.mediaProperties.peerConnection,
5132
- previousMediaDirection: {
5133
- sendTrack: _this43.mediaProperties.mediaDirection.sendShare,
5134
- receiveTrack: _this43.mediaProperties.mediaDirection.receiveShare
5641
+ return _this44.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5642
+ send: {
5643
+ screenShareVideo: track
5644
+ },
5645
+ receive: {
5646
+ audio: _this44.mediaProperties.mediaDirection.receiveAudio,
5647
+ video: _this44.mediaProperties.mediaDirection.receiveVideo,
5648
+ screenShareVideo: options.receiveShare,
5649
+ remoteQualityLevel: _this44.mediaProperties.remoteQualityLevel
5135
5650
  }
5136
- }, {
5137
- mediaProperties: _this43.mediaProperties,
5138
- meeting: _this43,
5139
- id: _this43.id
5140
5651
  }).then(function () {
5141
5652
  if (startShare) {
5142
- return _this43.share();
5653
+ return _this44.requestScreenShareFloor();
5143
5654
  }
5144
5655
 
5145
5656
  return _promise.default.resolve();
5146
5657
  });
5147
5658
  }).then(function () {
5148
- _this43.mediaProperties.mediaDirection.sendShare = sendShare;
5149
- _this43.mediaProperties.mediaDirection.receiveShare = receiveShare;
5659
+ _this44.mediaProperties.mediaDirection.sendShare = sendShare;
5660
+ _this44.mediaProperties.mediaDirection.receiveShare = receiveShare;
5150
5661
  }).catch(function (error) {
5151
- _this43.unsetLocalShareTrack(stream);
5662
+ _this44.unsetLocalShareTrack();
5152
5663
 
5153
5664
  throw error;
5154
- }).finally(function () {
5155
- var delay = 1e3; // Check to see if share was stopped natively before onended was assigned.
5156
-
5157
- var sharingModeIsActive = _this43.mediaProperties.peerConnection.shareTransceiver.direction === _constants.SENDRECV;
5158
- var isSharingOutOfSync = sharingModeIsActive && !_this43.isLocalShareLive;
5159
-
5160
- if (isSharingOutOfSync) {
5161
- // Adding a delay to avoid a 409 from server
5162
- // which results in user still appearing as if sharing.
5163
- // Also delay give time for changes to peerConnection.
5164
- setTimeout(function () {
5165
- return _this43.handleShareTrackEnded(stream);
5166
- }, delay);
5167
- }
5168
5665
  });
5169
5666
  }
5170
5667
  /**
@@ -5182,6 +5679,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5182
5679
  value: function preMedia(localStream, localShare, mediaSettings) {
5183
5680
  // eslint-disable-next-line no-warning-comments
5184
5681
  // TODO wire into default config. There's currently an issue with the stateless plugin or how we register
5682
+ // @ts-ignore - config coming from registerPlugin
5185
5683
  this.mediaProperties.setMediaDirection((0, _assign.default)(this.config.mediaSettings, mediaSettings)); // add a setup a function move the create and setup media in future
5186
5684
  // TODO: delete old audio and video if stale
5187
5685
 
@@ -5202,7 +5700,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5202
5700
  }, {
5203
5701
  key: "acknowledge",
5204
5702
  value: function acknowledge(type) {
5205
- var _this44 = this;
5703
+ var _this45 = this;
5206
5704
 
5207
5705
  if (!type) {
5208
5706
  return _promise.default.reject(new _parameter.default('Type must be set to acknowledge the meeting.'));
@@ -5216,11 +5714,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5216
5714
  }).then(function (response) {
5217
5715
  return _promise.default.resolve(response);
5218
5716
  }).then(function (response) {
5219
- _this44.meetingFiniteStateMachine.ring(type);
5717
+ _this45.meetingFiniteStateMachine.ring(type);
5220
5718
 
5221
5719
  _metrics.default.postEvent({
5222
5720
  event: _config.eventType.ALERT_DISPLAYED,
5223
- meeting: _this44
5721
+ meeting: _this45
5224
5722
  });
5225
5723
 
5226
5724
  return _promise.default.resolve({
@@ -5245,14 +5743,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5245
5743
  }, {
5246
5744
  key: "decline",
5247
5745
  value: function decline(reason) {
5248
- var _this45 = this;
5746
+ var _this46 = this;
5249
5747
 
5250
5748
  return _util.default.declineMeeting(this, reason).then(function (decline) {
5251
- _this45.meetingFiniteStateMachine.decline();
5749
+ _this46.meetingFiniteStateMachine.decline();
5252
5750
 
5253
5751
  return _promise.default.resolve(decline);
5254
5752
  }).catch(function (error) {
5255
- _this45.meetingFiniteStateMachine.fail(error);
5753
+ _this46.meetingFiniteStateMachine.fail(error);
5256
5754
 
5257
5755
  return _promise.default.reject(error);
5258
5756
  });
@@ -5269,7 +5767,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5269
5767
  }, {
5270
5768
  key: "leave",
5271
5769
  value: function leave() {
5272
- var _this46 = this;
5770
+ var _this47 = this;
5273
5771
 
5274
5772
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5275
5773
 
@@ -5287,25 +5785,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5287
5785
  _loggerProxy.default.logger.log('Meeting:index#leave --> Leaving a meeting');
5288
5786
 
5289
5787
  return _util.default.leaveMeeting(this, options).then(function (leave) {
5290
- _this46.meetingFiniteStateMachine.leave();
5788
+ _this47.meetingFiniteStateMachine.leave();
5291
5789
 
5292
- _this46.clearMeetingData(); // upload logs on leave irrespective of meeting delete
5790
+ _this47.clearMeetingData(); // upload logs on leave irrespective of meeting delete
5293
5791
 
5294
5792
 
5295
- _triggerProxy.default.trigger(_this46, {
5793
+ _triggerProxy.default.trigger(_this47, {
5296
5794
  file: 'meeting/index',
5297
5795
  function: 'leave'
5298
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this46); // TODO: more testing before we remove this code, we are not sure the scenarios for destroy here
5796
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this47); // TODO: more testing before we remove this code, we are not sure the scenarios for destroy here
5299
5797
 
5300
5798
 
5301
- if (_this46.wirelessShare || _this46.guest) {
5799
+ if (_this47.wirelessShare || _this47.guest) {
5302
5800
  // If screen sharing clean the meeting object
5303
- _triggerProxy.default.trigger(_this46, {
5801
+ _triggerProxy.default.trigger(_this47, {
5304
5802
  file: 'meeting/index',
5305
5803
  function: 'leave'
5306
5804
  }, _constants.EVENTS.DESTROY_MEETING, {
5307
5805
  reason: options.reason,
5308
- meetingId: _this46.id
5806
+ meetingId: _this47.id
5309
5807
  });
5310
5808
  }
5311
5809
 
@@ -5313,19 +5811,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5313
5811
 
5314
5812
  return leave;
5315
5813
  }).catch(function (error) {
5316
- _this46.meetingFiniteStateMachine.fail(error);
5814
+ _this47.meetingFiniteStateMachine.fail(error);
5317
5815
 
5318
5816
  _loggerProxy.default.logger.error('Meeting:index#leave --> Failed to leave ', error); // upload logs on leave irrespective of meeting delete
5319
5817
 
5320
5818
 
5321
- _triggerProxy.default.trigger(_this46, {
5819
+ _triggerProxy.default.trigger(_this47, {
5322
5820
  file: 'meeting/index',
5323
5821
  function: 'leave'
5324
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this46);
5822
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this47);
5325
5823
 
5326
5824
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_LEAVE_FAILURE, {
5327
- correlation_id: _this46.correlationId,
5328
- locus_id: _this46.locusUrl.split('/').pop(),
5825
+ correlation_id: _this47.correlationId,
5826
+ locus_id: _this47.locusUrl.split('/').pop(),
5329
5827
  reason: error.message,
5330
5828
  stack: error.stack,
5331
5829
  code: error.code
@@ -5346,7 +5844,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5346
5844
  }, {
5347
5845
  key: "startWhiteboardShare",
5348
5846
  value: function startWhiteboardShare(channelUrl, resourceToken) {
5349
- var _this47 = this;
5847
+ var _this48 = this;
5350
5848
 
5351
5849
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
5352
5850
  return element.name === 'whiteboard';
@@ -5375,14 +5873,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5375
5873
  }
5376
5874
 
5377
5875
  return this.meetingRequest.changeMeetingFloor(body).then(function () {
5378
- _this47.isSharing = false;
5876
+ _this48.isSharing = false;
5379
5877
  return _promise.default.resolve();
5380
5878
  }).catch(function (error) {
5381
5879
  _loggerProxy.default.logger.error('Meeting:index#startWhiteboardShare --> Error ', error);
5382
5880
 
5383
5881
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_START_WHITEBOARD_SHARE_FAILURE, {
5384
- correlation_id: _this47.correlationId,
5385
- locus_id: _this47.locusUrl.split('/').pop(),
5882
+ correlation_id: _this48.correlationId,
5883
+ locus_id: _this48.locusUrl.split('/').pop(),
5386
5884
  reason: error.message,
5387
5885
  stack: error.stack,
5388
5886
  board: {
@@ -5407,7 +5905,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5407
5905
  }, {
5408
5906
  key: "stopWhiteboardShare",
5409
5907
  value: function stopWhiteboardShare(channelUrl) {
5410
- var _this48 = this;
5908
+ var _this49 = this;
5411
5909
 
5412
5910
  var whiteboard = this.locusInfo.mediaShares.find(function (element) {
5413
5911
  return element.name === 'whiteboard';
@@ -5427,9 +5925,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5427
5925
  }).catch(function (error) {
5428
5926
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
5429
5927
 
5430
- _metrics.default.sendBehavioralMetric(_constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
5431
- correlation_id: _this48.correlationId,
5432
- locus_id: _this48.locusUrl.split('/').pop(),
5928
+ _metrics.default.sendBehavioralMetric( // @ts-ignore - check if STOP_WHITEBOARD_SHARE_FAILURE exists
5929
+ _constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
5930
+ correlation_id: _this49.correlationId,
5931
+ locus_id: _this49.locusUrl.split('/').pop(),
5433
5932
  reason: error.message,
5434
5933
  stack: error.stack,
5435
5934
  board: {
@@ -5444,16 +5943,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5444
5943
  return _promise.default.reject(new _parameter.default('Cannot stop share without whiteboard.'));
5445
5944
  }
5446
5945
  /**
5447
- * Start sharing content with server
5946
+ * Sends a request to Locus to obtain the screen share floor
5448
5947
  * @returns {Promise} see #meetingRequest.changeMeetingFloor
5449
5948
  * @private
5450
5949
  * @memberof Meeting
5451
5950
  */
5452
5951
 
5453
5952
  }, {
5454
- key: "share",
5455
- value: function share() {
5456
- var _this49 = this;
5953
+ key: "requestScreenShareFloor",
5954
+ value: function requestScreenShareFloor() {
5955
+ var _this50 = this;
5457
5956
 
5458
5957
  var content = this.locusInfo.mediaShares.find(function (element) {
5459
5958
  return element.name === _constants.CONTENT;
@@ -5472,14 +5971,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5472
5971
  uri: content.url,
5473
5972
  resourceUrl: this.resourceUrl
5474
5973
  }).then(function () {
5475
- _this49.isSharing = true;
5974
+ _this50.isSharing = true;
5476
5975
  return _promise.default.resolve();
5477
5976
  }).catch(function (error) {
5478
5977
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
5479
5978
 
5480
5979
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_FAILURE, {
5481
- correlation_id: _this49.correlationId,
5482
- locus_id: _this49.locusUrl.split('/').pop(),
5980
+ correlation_id: _this50.correlationId,
5981
+ locus_id: _this50.locusUrl.split('/').pop(),
5483
5982
  reason: error.message,
5484
5983
  stack: error.stack
5485
5984
  });
@@ -5509,16 +6008,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5509
6008
  }, options));
5510
6009
  }
5511
6010
  /**
5512
- * sends stops floor request
6011
+ * Sends a request to Locus to release the screen share floor.
5513
6012
  * @returns {Promise} see #meetingRequest.changeMeetingFloor
5514
6013
  * @private
5515
6014
  * @memberof Meeting
5516
6015
  */
5517
6016
 
5518
6017
  }, {
5519
- key: "stopFloorRequest",
5520
- value: function stopFloorRequest() {
5521
- var _this50 = this;
6018
+ key: "releaseScreenShareFloor",
6019
+ value: function releaseScreenShareFloor() {
6020
+ var _this51 = this;
5522
6021
 
5523
6022
  var content = this.locusInfo.mediaShares.find(function (element) {
5524
6023
  return element.name === _constants.CONTENT;
@@ -5545,18 +6044,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5545
6044
  uri: content.url,
5546
6045
  resourceUrl: this.resourceUrl
5547
6046
  }).catch(function (error) {
5548
- _loggerProxy.default.logger.error('Meeting:index#stopFloorRequest --> Error ', error);
6047
+ _loggerProxy.default.logger.error('Meeting:index#releaseScreenShareFloor --> Error ', error);
5549
6048
 
5550
6049
  _metrics.default.sendBehavioralMetric(_constants2.default.STOP_FLOOR_REQUEST_FAILURE, {
5551
- correlation_id: _this50.correlationId,
5552
- locus_id: _this50.locusUrl.split('/').pop(),
6050
+ correlation_id: _this51.correlationId,
6051
+ locus_id: _this51.locusUrl.split('/').pop(),
5553
6052
  reason: error.message,
5554
6053
  stack: error.stack
5555
6054
  });
5556
6055
 
5557
6056
  return _promise.default.reject(error);
5558
6057
  }).finally(function () {
5559
- _this50.isSharing = false;
6058
+ _this51.isSharing = false;
5560
6059
  });
5561
6060
  }
5562
6061
 
@@ -5692,7 +6191,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5692
6191
  }, {
5693
6192
  key: "changeVideoLayout",
5694
6193
  value: function changeVideoLayout(layoutType) {
5695
- var _this51 = this;
6194
+ var _this52 = this;
5696
6195
 
5697
6196
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5698
6197
  var main = renderInfo.main,
@@ -5750,7 +6249,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5750
6249
 
5751
6250
  this.lastVideoLayoutInfo = (0, _cloneDeep2.default)(layoutInfo);
5752
6251
  this.locusInfo.once(_constants.LOCUSINFO.EVENTS.CONTROLS_MEETING_LAYOUT_UPDATED, function (envelope) {
5753
- _triggerProxy.default.trigger(_this51, {
6252
+ _triggerProxy.default.trigger(_this52, {
5754
6253
  file: 'meeting/index',
5755
6254
  function: 'changeVideoLayout'
5756
6255
  }, _constants.EVENT_TRIGGERS.MEETING_CONTROLS_LAYOUT_UPDATE, {
@@ -5765,7 +6264,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5765
6264
  content: layoutInfo.content
5766
6265
  }).then(function (response) {
5767
6266
  if (response && response.body && response.body.locus) {
5768
- _this51.locusInfo.onFullLocus(response.body.locus);
6267
+ _this52.locusInfo.onFullLocus(response.body.locus);
5769
6268
  }
5770
6269
  }).catch(function (error) {
5771
6270
  _loggerProxy.default.logger.error('Meeting:index#changeVideoLayout --> Error ', error);
@@ -5782,7 +6281,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5782
6281
  }, {
5783
6282
  key: "setLocalVideoQuality",
5784
6283
  value: function setLocalVideoQuality(level) {
5785
- var _this52 = this;
6284
+ var _this53 = this;
5786
6285
 
5787
6286
  _loggerProxy.default.logger.log("Meeting:index#setLocalVideoQuality --> Setting quality to ".concat(level));
5788
6287
 
@@ -5814,34 +6313,34 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5814
6313
 
5815
6314
  if (isBrowser('chrome') && this.mediaProperties.videoTrack) _media.default.stopTracks(this.mediaProperties.videoTrack);
5816
6315
  return this.getMediaStreams(mediaDirection, _constants.VIDEO_RESOLUTIONS[level]).then( /*#__PURE__*/function () {
5817
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(_ref13) {
5818
- var _ref15, localStream;
6316
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(_ref14) {
6317
+ var _ref16, localStream;
5819
6318
 
5820
- return _regenerator.default.wrap(function _callee6$(_context6) {
6319
+ return _regenerator.default.wrap(function _callee8$(_context8) {
5821
6320
  while (1) {
5822
- switch (_context6.prev = _context6.next) {
6321
+ switch (_context8.prev = _context8.next) {
5823
6322
  case 0:
5824
- _ref15 = (0, _slicedToArray2.default)(_ref13, 1), localStream = _ref15[0];
5825
- _context6.next = 3;
5826
- return _this52.updateVideo({
6323
+ _ref16 = (0, _slicedToArray2.default)(_ref14, 1), localStream = _ref16[0];
6324
+ _context8.next = 3;
6325
+ return _this53.updateVideo({
5827
6326
  sendVideo: true,
5828
6327
  receiveVideo: true,
5829
6328
  stream: localStream
5830
6329
  });
5831
6330
 
5832
6331
  case 3:
5833
- return _context6.abrupt("return", localStream);
6332
+ return _context8.abrupt("return", localStream);
5834
6333
 
5835
6334
  case 4:
5836
6335
  case "end":
5837
- return _context6.stop();
6336
+ return _context8.stop();
5838
6337
  }
5839
6338
  }
5840
- }, _callee6);
6339
+ }, _callee8);
5841
6340
  }));
5842
6341
 
5843
- return function (_x4) {
5844
- return _ref14.apply(this, arguments);
6342
+ return function (_x5) {
6343
+ return _ref15.apply(this, arguments);
5845
6344
  };
5846
6345
  }());
5847
6346
  }
@@ -5887,7 +6386,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5887
6386
  }, {
5888
6387
  key: "setMeetingQuality",
5889
6388
  value: function setMeetingQuality(level) {
5890
- var _this53 = this;
6389
+ var _this54 = this;
5891
6390
 
5892
6391
  _loggerProxy.default.logger.log("Meeting:index#setMeetingQuality --> Setting quality to ".concat(level));
5893
6392
 
@@ -5912,18 +6411,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5912
6411
  receiveVideo = _this$mediaProperties4.receiveVideo,
5913
6412
  sendVideo = _this$mediaProperties4.sendVideo;
5914
6413
  return (sendVideo ? this.setLocalVideoQuality(level) : _promise.default.resolve()).then(function () {
5915
- return receiveAudio || receiveVideo ? _this53.setRemoteQualityLevel(level) : _promise.default.resolve();
6414
+ return receiveAudio || receiveVideo ? _this54.setRemoteQualityLevel(level) : _promise.default.resolve();
5916
6415
  }).catch(function (error) {
5917
6416
  // From troubleshooting it seems that the stream itself doesn't change the max-fs if the peer connection isn't stable
5918
- _this53.mediaProperties.setLocalQualityLevel(previousLevel.local);
6417
+ _this54.mediaProperties.setLocalQualityLevel(previousLevel.local);
5919
6418
 
5920
- _this53.mediaProperties.setRemoteQualityLevel(previousLevel.remote);
6419
+ _this54.mediaProperties.setRemoteQualityLevel(previousLevel.remote);
5921
6420
 
5922
6421
  _loggerProxy.default.logger.error("Meeting:index#setMeetingQuality --> ".concat(error.message));
5923
6422
 
5924
6423
  _metrics.default.sendBehavioralMetric(_constants2.default.SET_MEETING_QUALITY_FAILURE, {
5925
- correlation_id: _this53.correlationId,
5926
- locus_id: _this53.locusUrl.split('/').pop(),
6424
+ correlation_id: _this54.correlationId,
6425
+ locus_id: _this54.locusUrl.split('/').pop(),
5927
6426
  reason: error.message,
5928
6427
  stack: error.stack
5929
6428
  }, {
@@ -5934,6 +6433,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5934
6433
  });
5935
6434
  }
5936
6435
  /**
6436
+ *
6437
+ * NOTE: this method can only be used with transcoded meetings, for multistream use publishTrack()
6438
+ *
5937
6439
  * @param {Object} options parameter
5938
6440
  * @param {Boolean} options.sendAudio send audio from the display share
5939
6441
  * @param {Boolean} options.sendShare send video from the display share
@@ -5947,7 +6449,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5947
6449
  }, {
5948
6450
  key: "shareScreen",
5949
6451
  value: function shareScreen() {
5950
- var _this54 = this;
6452
+ var _this55 = this;
5951
6453
 
5952
6454
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5953
6455
 
@@ -5956,12 +6458,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5956
6458
  var shareConstraints = _objectSpread({
5957
6459
  sendShare: true,
5958
6460
  sendAudio: false
5959
- }, options);
6461
+ }, options); // @ts-ignore - config coming from registerPlugin
6462
+
5960
6463
 
5961
6464
  return _media.default.getDisplayMedia(shareConstraints, this.config).then(function (shareStream) {
5962
- return _this54.updateShare({
6465
+ return _this55.updateShare({
5963
6466
  sendShare: true,
5964
- receiveShare: _this54.mediaProperties.mediaDirection.receiveShare,
6467
+ receiveShare: _this55.mediaProperties.mediaDirection.receiveShare,
5965
6468
  stream: shareStream
5966
6469
  });
5967
6470
  }).catch(function (error) {
@@ -5973,8 +6476,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5973
6476
  // TODO: The getDisplayMedia errors need to be moved inside `media.getDisplayMedia`
5974
6477
  var metricName = _constants2.default.GET_DISPLAY_MEDIA_FAILURE;
5975
6478
  var data = {
5976
- correlation_id: _this54.correlationId,
5977
- locus_id: _this54.locusUrl.split('/').pop(),
6479
+ correlation_id: _this55.correlationId,
6480
+ locus_id: _this55.locusUrl.split('/').pop(),
5978
6481
  reason: error.message,
5979
6482
  stack: error.stack
5980
6483
  };
@@ -6053,9 +6556,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6053
6556
 
6054
6557
  }, {
6055
6558
  key: "handleMediaLogging",
6056
- value: function handleMediaLogging(_ref16) {
6057
- var audioTrack = _ref16.audioTrack,
6058
- videoTrack = _ref16.videoTrack;
6559
+ value: function handleMediaLogging(_ref17) {
6560
+ var audioTrack = _ref17.audioTrack,
6561
+ videoTrack = _ref17.videoTrack;
6059
6562
 
6060
6563
  _util.default.handleVideoLogging(videoTrack);
6061
6564
 
@@ -6270,7 +6773,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6270
6773
  }, {
6271
6774
  key: "endMeetingForAll",
6272
6775
  value: function endMeetingForAll() {
6273
- var _this55 = this;
6776
+ var _this56 = this;
6274
6777
 
6275
6778
  _metrics.default.postEvent({
6276
6779
  event: _config.eventType.LEAVE,
@@ -6289,31 +6792,31 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6289
6792
  });
6290
6793
 
6291
6794
  return _util.default.endMeetingForAll(this).then(function (end) {
6292
- _this55.meetingFiniteStateMachine.end();
6795
+ _this56.meetingFiniteStateMachine.end();
6293
6796
 
6294
- _this55.clearMeetingData(); // upload logs on leave irrespective of meeting delete
6797
+ _this56.clearMeetingData(); // upload logs on leave irrespective of meeting delete
6295
6798
 
6296
6799
 
6297
- _triggerProxy.default.trigger(_this55, {
6800
+ _triggerProxy.default.trigger(_this56, {
6298
6801
  file: 'meeting/index',
6299
6802
  function: 'endMeetingForAll'
6300
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this55);
6803
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this56);
6301
6804
 
6302
6805
  return end;
6303
6806
  }).catch(function (error) {
6304
- _this55.meetingFiniteStateMachine.fail(error);
6807
+ _this56.meetingFiniteStateMachine.fail(error);
6305
6808
 
6306
6809
  _loggerProxy.default.logger.error('Meeting:index#endMeetingForAll --> Failed to end meeting ', error); // upload logs on leave irrespective of meeting delete
6307
6810
 
6308
6811
 
6309
- _triggerProxy.default.trigger(_this55, {
6812
+ _triggerProxy.default.trigger(_this56, {
6310
6813
  file: 'meeting/index',
6311
6814
  function: 'endMeetingForAll'
6312
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this55);
6815
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this56);
6313
6816
 
6314
6817
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_END_ALL_FAILURE, {
6315
- correlation_id: _this55.correlationId,
6316
- locus_id: _this55.locusUrl.split('/').pop(),
6818
+ correlation_id: _this56.correlationId,
6819
+ locus_id: _this56.locusUrl.split('/').pop(),
6317
6820
  reason: error.message,
6318
6821
  stack: error.stack,
6319
6822
  code: error.code
@@ -6352,43 +6855,43 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6352
6855
  }, {
6353
6856
  key: "internal_enableBNR",
6354
6857
  value: function () {
6355
- var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(audioTrack) {
6858
+ var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(audioTrack) {
6356
6859
  var bnrAudioTrack;
6357
- return _regenerator.default.wrap(function _callee7$(_context7) {
6860
+ return _regenerator.default.wrap(function _callee9$(_context9) {
6358
6861
  while (1) {
6359
- switch (_context7.prev = _context7.next) {
6862
+ switch (_context9.prev = _context9.next) {
6360
6863
  case 0:
6361
- _context7.prev = 0;
6864
+ _context9.prev = 0;
6362
6865
 
6363
6866
  _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
6364
6867
 
6365
- _context7.next = 4;
6868
+ _context9.next = 4;
6366
6869
  return _internalMediaCore.Media.Effects.BNR.enableBNR(audioTrack);
6367
6870
 
6368
6871
  case 4:
6369
- bnrAudioTrack = _context7.sent;
6872
+ bnrAudioTrack = _context9.sent;
6370
6873
 
6371
6874
  _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
6372
6875
 
6373
- return _context7.abrupt("return", bnrAudioTrack);
6876
+ return _context9.abrupt("return", bnrAudioTrack);
6374
6877
 
6375
6878
  case 9:
6376
- _context7.prev = 9;
6377
- _context7.t0 = _context7["catch"](0);
6879
+ _context9.prev = 9;
6880
+ _context9.t0 = _context9["catch"](0);
6378
6881
 
6379
- _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context7.t0);
6882
+ _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context9.t0);
6380
6883
 
6381
- throw _context7.t0;
6884
+ throw _context9.t0;
6382
6885
 
6383
6886
  case 13:
6384
6887
  case "end":
6385
- return _context7.stop();
6888
+ return _context9.stop();
6386
6889
  }
6387
6890
  }
6388
- }, _callee7, null, [[0, 9]]);
6891
+ }, _callee9, null, [[0, 9]]);
6389
6892
  }));
6390
6893
 
6391
- function internal_enableBNR(_x5) {
6894
+ function internal_enableBNR(_x6) {
6392
6895
  return _internal_enableBNR.apply(this, arguments);
6393
6896
  }
6394
6897