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

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