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

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 (422) hide show
  1. package/README.md +45 -7
  2. package/dist/annotation/annotation.types.js +7 -0
  3. package/dist/annotation/annotation.types.js.map +1 -0
  4. package/dist/annotation/constants.js +49 -0
  5. package/dist/annotation/constants.js.map +1 -0
  6. package/dist/annotation/index.js +342 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +114 -14
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/edit-lock-error.js +52 -0
  11. package/dist/breakouts/edit-lock-error.js.map +1 -0
  12. package/dist/breakouts/events.js +45 -0
  13. package/dist/breakouts/events.js.map +1 -0
  14. package/dist/breakouts/index.js +841 -19
  15. package/dist/breakouts/index.js.map +1 -1
  16. package/dist/breakouts/request.js +78 -0
  17. package/dist/breakouts/request.js.map +1 -0
  18. package/dist/breakouts/utils.js +67 -0
  19. package/dist/breakouts/utils.js.map +1 -0
  20. package/dist/common/errors/webex-errors.js +3 -2
  21. package/dist/common/errors/webex-errors.js.map +1 -1
  22. package/dist/common/logs/logger-proxy.js +1 -1
  23. package/dist/common/logs/logger-proxy.js.map +1 -1
  24. package/dist/common/queue.js +24 -9
  25. package/dist/common/queue.js.map +1 -1
  26. package/dist/config.js +3 -8
  27. package/dist/config.js.map +1 -1
  28. package/dist/constants.js +179 -30
  29. package/dist/constants.js.map +1 -1
  30. package/dist/controls-options-manager/constants.js +14 -0
  31. package/dist/controls-options-manager/constants.js.map +1 -0
  32. package/dist/controls-options-manager/enums.js +27 -0
  33. package/dist/controls-options-manager/enums.js.map +1 -0
  34. package/dist/controls-options-manager/index.js +297 -0
  35. package/dist/controls-options-manager/index.js.map +1 -0
  36. package/dist/controls-options-manager/types.js +7 -0
  37. package/dist/controls-options-manager/types.js.map +1 -0
  38. package/dist/controls-options-manager/util.js +319 -0
  39. package/dist/controls-options-manager/util.js.map +1 -0
  40. package/dist/index.js +106 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/interpretation/collection.js +23 -0
  43. package/dist/interpretation/collection.js.map +1 -0
  44. package/dist/interpretation/index.js +366 -0
  45. package/dist/interpretation/index.js.map +1 -0
  46. package/dist/interpretation/siLanguage.js +25 -0
  47. package/dist/interpretation/siLanguage.js.map +1 -0
  48. package/dist/locus-info/controlsUtils.js +91 -2
  49. package/dist/locus-info/controlsUtils.js.map +1 -1
  50. package/dist/locus-info/index.js +359 -64
  51. package/dist/locus-info/index.js.map +1 -1
  52. package/dist/locus-info/infoUtils.js +7 -1
  53. package/dist/locus-info/infoUtils.js.map +1 -1
  54. package/dist/locus-info/mediaSharesUtils.js +43 -1
  55. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  56. package/dist/locus-info/parser.js +219 -63
  57. package/dist/locus-info/parser.js.map +1 -1
  58. package/dist/locus-info/selfUtils.js +89 -14
  59. package/dist/locus-info/selfUtils.js.map +1 -1
  60. package/dist/media/index.js +48 -135
  61. package/dist/media/index.js.map +1 -1
  62. package/dist/media/properties.js +29 -90
  63. package/dist/media/properties.js.map +1 -1
  64. package/dist/mediaQualityMetrics/config.js +505 -493
  65. package/dist/mediaQualityMetrics/config.js.map +1 -1
  66. package/dist/meeting/in-meeting-actions.js +90 -2
  67. package/dist/meeting/in-meeting-actions.js.map +1 -1
  68. package/dist/meeting/index.js +2770 -2547
  69. package/dist/meeting/index.js.map +1 -1
  70. package/dist/meeting/locusMediaRequest.js +291 -0
  71. package/dist/meeting/locusMediaRequest.js.map +1 -0
  72. package/dist/meeting/muteState.js +229 -124
  73. package/dist/meeting/muteState.js.map +1 -1
  74. package/dist/meeting/request.js +199 -193
  75. package/dist/meeting/request.js.map +1 -1
  76. package/dist/meeting/util.js +532 -414
  77. package/dist/meeting/util.js.map +1 -1
  78. package/dist/meeting-info/index.js +48 -7
  79. package/dist/meeting-info/index.js.map +1 -1
  80. package/dist/meeting-info/meeting-info-v2.js +171 -51
  81. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  82. package/dist/meeting-info/utilv2.js +20 -5
  83. package/dist/meeting-info/utilv2.js.map +1 -1
  84. package/dist/meetings/collection.js +22 -0
  85. package/dist/meetings/collection.js.map +1 -1
  86. package/dist/meetings/index.js +357 -66
  87. package/dist/meetings/index.js.map +1 -1
  88. package/dist/meetings/meetings.types.js +7 -0
  89. package/dist/meetings/meetings.types.js.map +1 -0
  90. package/dist/meetings/request.js +2 -0
  91. package/dist/meetings/request.js.map +1 -1
  92. package/dist/meetings/util.js +88 -1
  93. package/dist/meetings/util.js.map +1 -1
  94. package/dist/member/index.js +49 -0
  95. package/dist/member/index.js.map +1 -1
  96. package/dist/member/types.js +25 -0
  97. package/dist/member/types.js.map +1 -0
  98. package/dist/member/util.js +121 -25
  99. package/dist/member/util.js.map +1 -1
  100. package/dist/members/collection.js +10 -0
  101. package/dist/members/collection.js.map +1 -1
  102. package/dist/members/index.js +86 -5
  103. package/dist/members/index.js.map +1 -1
  104. package/dist/members/request.js +106 -38
  105. package/dist/members/request.js.map +1 -1
  106. package/dist/members/types.js +15 -0
  107. package/dist/members/types.js.map +1 -0
  108. package/dist/members/util.js +316 -233
  109. package/dist/members/util.js.map +1 -1
  110. package/dist/metrics/constants.js +3 -5
  111. package/dist/metrics/constants.js.map +1 -1
  112. package/dist/metrics/index.js +1 -468
  113. package/dist/metrics/index.js.map +1 -1
  114. package/dist/multistream/mediaRequestManager.js +238 -49
  115. package/dist/multistream/mediaRequestManager.js.map +1 -1
  116. package/dist/multistream/receiveSlot.js +49 -16
  117. package/dist/multistream/receiveSlot.js.map +1 -1
  118. package/dist/multistream/receiveSlotManager.js +52 -34
  119. package/dist/multistream/receiveSlotManager.js.map +1 -1
  120. package/dist/multistream/remoteMedia.js +44 -18
  121. package/dist/multistream/remoteMedia.js.map +1 -1
  122. package/dist/multistream/remoteMediaGroup.js +60 -3
  123. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  124. package/dist/multistream/remoteMediaManager.js +173 -59
  125. package/dist/multistream/remoteMediaManager.js.map +1 -1
  126. package/dist/networkQualityMonitor/index.js +4 -2
  127. package/dist/networkQualityMonitor/index.js.map +1 -1
  128. package/dist/reachability/index.js +72 -27
  129. package/dist/reachability/index.js.map +1 -1
  130. package/dist/reachability/request.js +12 -5
  131. package/dist/reachability/request.js.map +1 -1
  132. package/dist/reconnection-manager/index.js +196 -155
  133. package/dist/reconnection-manager/index.js.map +1 -1
  134. package/dist/recording-controller/index.js +21 -2
  135. package/dist/recording-controller/index.js.map +1 -1
  136. package/dist/recording-controller/util.js +9 -8
  137. package/dist/recording-controller/util.js.map +1 -1
  138. package/dist/roap/index.js +21 -29
  139. package/dist/roap/index.js.map +1 -1
  140. package/dist/roap/request.js +110 -89
  141. package/dist/roap/request.js.map +1 -1
  142. package/dist/roap/turnDiscovery.js +93 -36
  143. package/dist/roap/turnDiscovery.js.map +1 -1
  144. package/dist/rtcMetrics/constants.js +12 -0
  145. package/dist/rtcMetrics/constants.js.map +1 -0
  146. package/dist/rtcMetrics/index.js +117 -0
  147. package/dist/rtcMetrics/index.js.map +1 -0
  148. package/dist/statsAnalyzer/global.js +1 -93
  149. package/dist/statsAnalyzer/global.js.map +1 -1
  150. package/dist/statsAnalyzer/index.js +326 -311
  151. package/dist/statsAnalyzer/index.js.map +1 -1
  152. package/dist/statsAnalyzer/mqaUtil.js +90 -53
  153. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  154. package/dist/types/annotation/annotation.types.d.ts +42 -0
  155. package/dist/types/annotation/constants.d.ts +31 -0
  156. package/dist/types/annotation/index.d.ts +117 -0
  157. package/dist/types/breakouts/breakout.d.ts +8 -0
  158. package/dist/types/breakouts/collection.d.ts +5 -0
  159. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  160. package/dist/types/breakouts/events.d.ts +8 -0
  161. package/dist/types/breakouts/index.d.ts +5 -0
  162. package/dist/types/breakouts/request.d.ts +22 -0
  163. package/dist/types/breakouts/utils.d.ts +15 -0
  164. package/dist/types/common/browser-detection.d.ts +9 -0
  165. package/dist/types/common/collection.d.ts +48 -0
  166. package/dist/types/common/config.d.ts +2 -0
  167. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  168. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  169. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  170. package/dist/types/common/errors/media.d.ts +15 -0
  171. package/dist/types/common/errors/parameter.d.ts +15 -0
  172. package/dist/types/common/errors/password-error.d.ts +15 -0
  173. package/dist/types/common/errors/permission.d.ts +14 -0
  174. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  175. package/dist/types/common/errors/reconnection.d.ts +15 -0
  176. package/dist/types/common/errors/stats.d.ts +15 -0
  177. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  178. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  179. package/dist/types/common/events/events-scope.d.ts +17 -0
  180. package/dist/types/common/events/events.d.ts +12 -0
  181. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  182. package/dist/types/common/events/util.d.ts +2 -0
  183. package/dist/types/common/logs/logger-config.d.ts +2 -0
  184. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  185. package/dist/types/common/logs/request.d.ts +34 -0
  186. package/dist/types/common/queue.d.ts +34 -0
  187. package/dist/types/config.d.ts +72 -0
  188. package/dist/types/constants.d.ts +1020 -0
  189. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  190. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  191. package/dist/types/controls-options-manager/index.d.ts +136 -0
  192. package/dist/types/controls-options-manager/types.d.ts +43 -0
  193. package/dist/types/controls-options-manager/util.d.ts +1 -0
  194. package/dist/types/index.d.ts +7 -0
  195. package/dist/types/interpretation/collection.d.ts +5 -0
  196. package/dist/types/interpretation/index.d.ts +5 -0
  197. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  198. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  199. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  200. package/dist/types/locus-info/fullState.d.ts +2 -0
  201. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  202. package/dist/types/locus-info/index.d.ts +322 -0
  203. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  204. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  205. package/dist/types/locus-info/parser.d.ts +271 -0
  206. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  207. package/dist/types/media/index.d.ts +34 -0
  208. package/dist/types/media/properties.d.ts +93 -0
  209. package/dist/types/media/util.d.ts +2 -0
  210. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  211. package/dist/types/meeting/in-meeting-actions.d.ts +163 -0
  212. package/dist/types/meeting/index.d.ts +1482 -0
  213. package/dist/types/meeting/locusMediaRequest.d.ts +72 -0
  214. package/dist/types/meeting/muteState.d.ts +184 -0
  215. package/dist/types/meeting/request.d.ts +257 -0
  216. package/dist/types/meeting/request.type.d.ts +11 -0
  217. package/dist/types/meeting/state.d.ts +9 -0
  218. package/dist/types/meeting/util.d.ts +79 -0
  219. package/dist/types/meeting-info/collection.d.ts +20 -0
  220. package/dist/types/meeting-info/index.d.ts +62 -0
  221. package/dist/types/meeting-info/meeting-info-v2.d.ts +122 -0
  222. package/dist/types/meeting-info/request.d.ts +22 -0
  223. package/dist/types/meeting-info/util.d.ts +2 -0
  224. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  225. package/dist/types/meetings/collection.d.ts +31 -0
  226. package/dist/types/meetings/index.d.ts +367 -0
  227. package/dist/types/meetings/meetings.types.d.ts +4 -0
  228. package/dist/types/meetings/request.d.ts +27 -0
  229. package/dist/types/meetings/util.d.ts +18 -0
  230. package/dist/types/member/index.d.ts +159 -0
  231. package/dist/types/member/types.d.ts +32 -0
  232. package/dist/types/member/util.d.ts +2 -0
  233. package/dist/types/members/collection.d.ts +29 -0
  234. package/dist/types/members/index.d.ts +353 -0
  235. package/dist/types/members/request.d.ts +114 -0
  236. package/dist/types/members/types.d.ts +24 -0
  237. package/dist/types/members/util.d.ts +210 -0
  238. package/dist/types/metrics/constants.d.ts +55 -0
  239. package/dist/types/metrics/index.d.ts +45 -0
  240. package/dist/types/multistream/mediaRequestManager.d.ts +118 -0
  241. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  242. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  243. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  244. package/dist/types/multistream/remoteMediaGroup.d.ts +47 -0
  245. package/dist/types/multistream/remoteMediaManager.d.ts +277 -0
  246. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  247. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  248. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  249. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  250. package/dist/types/reachability/index.d.ts +152 -0
  251. package/dist/types/reachability/request.d.ts +37 -0
  252. package/dist/types/reactions/constants.d.ts +3 -0
  253. package/dist/types/reactions/reactions.d.ts +4 -0
  254. package/dist/types/reactions/reactions.type.d.ts +52 -0
  255. package/dist/types/reconnection-manager/index.d.ts +126 -0
  256. package/dist/types/recording-controller/enums.d.ts +7 -0
  257. package/dist/types/recording-controller/index.d.ts +207 -0
  258. package/dist/types/recording-controller/util.d.ts +14 -0
  259. package/dist/types/roap/index.d.ts +77 -0
  260. package/dist/types/roap/request.d.ts +36 -0
  261. package/dist/types/roap/turnDiscovery.d.ts +91 -0
  262. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  263. package/dist/types/rtcMetrics/index.d.ts +46 -0
  264. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  265. package/dist/types/statsAnalyzer/index.d.ts +200 -0
  266. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  267. package/dist/types/transcription/index.d.ts +64 -0
  268. package/package.json +23 -20
  269. package/src/annotation/annotation.types.ts +50 -0
  270. package/src/annotation/constants.ts +36 -0
  271. package/src/annotation/index.ts +328 -0
  272. package/src/breakouts/README.md +44 -14
  273. package/src/breakouts/breakout.ts +87 -9
  274. package/src/breakouts/edit-lock-error.ts +25 -0
  275. package/src/breakouts/events.ts +56 -0
  276. package/src/breakouts/index.ts +710 -10
  277. package/src/breakouts/request.ts +55 -0
  278. package/src/breakouts/utils.ts +57 -0
  279. package/src/common/errors/webex-errors.ts +6 -2
  280. package/src/common/logs/logger-proxy.ts +1 -1
  281. package/src/common/queue.ts +22 -8
  282. package/src/config.ts +2 -7
  283. package/src/constants.ts +165 -21
  284. package/src/controls-options-manager/constants.ts +5 -0
  285. package/src/controls-options-manager/enums.ts +18 -0
  286. package/src/controls-options-manager/index.ts +278 -0
  287. package/src/controls-options-manager/types.ts +59 -0
  288. package/src/controls-options-manager/util.ts +300 -0
  289. package/src/index.ts +39 -0
  290. package/src/interpretation/README.md +60 -0
  291. package/src/interpretation/collection.ts +19 -0
  292. package/src/interpretation/index.ts +332 -0
  293. package/src/interpretation/siLanguage.ts +18 -0
  294. package/src/locus-info/controlsUtils.ts +108 -0
  295. package/src/locus-info/index.ts +383 -61
  296. package/src/locus-info/infoUtils.ts +10 -2
  297. package/src/locus-info/mediaSharesUtils.ts +48 -0
  298. package/src/locus-info/parser.ts +224 -39
  299. package/src/locus-info/selfUtils.ts +81 -5
  300. package/src/media/index.ts +87 -140
  301. package/src/media/properties.ts +49 -90
  302. package/src/mediaQualityMetrics/config.ts +379 -377
  303. package/src/meeting/in-meeting-actions.ts +179 -3
  304. package/src/meeting/index.ts +2099 -2083
  305. package/src/meeting/locusMediaRequest.ts +311 -0
  306. package/src/meeting/muteState.ts +228 -132
  307. package/src/meeting/request.ts +105 -115
  308. package/src/meeting/util.ts +511 -397
  309. package/src/meeting-info/index.ts +54 -8
  310. package/src/meeting-info/meeting-info-v2.ts +148 -14
  311. package/src/meeting-info/utilv2.ts +13 -3
  312. package/src/meetings/collection.ts +20 -0
  313. package/src/meetings/index.ts +392 -84
  314. package/src/meetings/meetings.types.ts +12 -0
  315. package/src/meetings/request.ts +2 -0
  316. package/src/meetings/util.ts +103 -4
  317. package/src/member/index.ts +49 -0
  318. package/src/member/types.ts +38 -0
  319. package/src/member/util.ts +127 -25
  320. package/src/members/collection.ts +8 -0
  321. package/src/members/index.ts +107 -6
  322. package/src/members/request.ts +97 -17
  323. package/src/members/types.ts +28 -0
  324. package/src/members/util.ts +319 -240
  325. package/src/metrics/constants.ts +2 -4
  326. package/src/metrics/index.ts +1 -490
  327. package/src/multistream/mediaRequestManager.ts +289 -79
  328. package/src/multistream/receiveSlot.ts +55 -18
  329. package/src/multistream/receiveSlotManager.ts +46 -24
  330. package/src/multistream/remoteMedia.ts +27 -2
  331. package/src/multistream/remoteMediaGroup.ts +59 -0
  332. package/src/multistream/remoteMediaManager.ts +113 -32
  333. package/src/networkQualityMonitor/index.ts +6 -6
  334. package/src/reachability/index.ts +62 -15
  335. package/src/reachability/request.ts +10 -5
  336. package/src/reconnection-manager/index.ts +68 -43
  337. package/src/recording-controller/index.ts +20 -3
  338. package/src/recording-controller/util.ts +26 -9
  339. package/src/roap/index.ts +21 -30
  340. package/src/roap/request.ts +101 -95
  341. package/src/roap/turnDiscovery.ts +47 -25
  342. package/src/rtcMetrics/constants.ts +3 -0
  343. package/src/rtcMetrics/index.ts +100 -0
  344. package/src/statsAnalyzer/global.ts +1 -94
  345. package/src/statsAnalyzer/index.ts +376 -386
  346. package/src/statsAnalyzer/mqaUtil.ts +100 -99
  347. package/test/integration/spec/converged-space-meetings.js +233 -0
  348. package/test/integration/spec/journey.js +336 -259
  349. package/test/integration/spec/space-meeting.js +77 -4
  350. package/test/unit/spec/annotation/index.ts +418 -0
  351. package/test/unit/spec/breakouts/breakout.ts +142 -24
  352. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  353. package/test/unit/spec/breakouts/events.ts +89 -0
  354. package/test/unit/spec/breakouts/index.ts +1545 -48
  355. package/test/unit/spec/breakouts/request.ts +104 -0
  356. package/test/unit/spec/breakouts/utils.js +72 -0
  357. package/test/unit/spec/common/queue.js +31 -2
  358. package/test/unit/spec/controls-options-manager/index.js +287 -0
  359. package/test/unit/spec/controls-options-manager/util.js +582 -0
  360. package/test/unit/spec/fixture/locus.js +1 -0
  361. package/test/unit/spec/interpretation/collection.ts +15 -0
  362. package/test/unit/spec/interpretation/index.ts +589 -0
  363. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  364. package/test/unit/spec/locus-info/controlsUtils.js +316 -43
  365. package/test/unit/spec/locus-info/index.js +1169 -36
  366. package/test/unit/spec/locus-info/infoUtils.js +37 -15
  367. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  368. package/test/unit/spec/locus-info/parser.js +62 -22
  369. package/test/unit/spec/locus-info/selfConstant.js +27 -4
  370. package/test/unit/spec/locus-info/selfUtils.js +208 -17
  371. package/test/unit/spec/media/index.ts +138 -28
  372. package/test/unit/spec/meeting/in-meeting-actions.ts +89 -3
  373. package/test/unit/spec/meeting/index.js +3573 -1663
  374. package/test/unit/spec/meeting/locusMediaRequest.ts +438 -0
  375. package/test/unit/spec/meeting/muteState.js +370 -208
  376. package/test/unit/spec/meeting/request.js +339 -44
  377. package/test/unit/spec/meeting/utils.js +456 -53
  378. package/test/unit/spec/meeting-info/index.js +181 -0
  379. package/test/unit/spec/meeting-info/meetinginfov2.js +383 -5
  380. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  381. package/test/unit/spec/meetings/collection.js +14 -0
  382. package/test/unit/spec/meetings/index.js +867 -125
  383. package/test/unit/spec/meetings/utils.js +206 -2
  384. package/test/unit/spec/member/index.js +58 -4
  385. package/test/unit/spec/member/util.js +479 -35
  386. package/test/unit/spec/members/index.js +319 -1
  387. package/test/unit/spec/members/request.js +206 -27
  388. package/test/unit/spec/members/utils.js +184 -0
  389. package/test/unit/spec/metrics/index.js +1 -50
  390. package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
  391. package/test/unit/spec/multistream/receiveSlot.ts +72 -13
  392. package/test/unit/spec/multistream/receiveSlotManager.ts +58 -28
  393. package/test/unit/spec/multistream/remoteMedia.ts +30 -0
  394. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  395. package/test/unit/spec/multistream/remoteMediaManager.ts +318 -0
  396. package/test/unit/spec/networkQualityMonitor/index.js +4 -4
  397. package/test/unit/spec/reachability/index.ts +125 -8
  398. package/test/unit/spec/reachability/request.js +66 -0
  399. package/test/unit/spec/reconnection-manager/index.js +59 -6
  400. package/test/unit/spec/recording-controller/index.js +294 -218
  401. package/test/unit/spec/recording-controller/util.js +223 -96
  402. package/test/unit/spec/roap/index.ts +26 -51
  403. package/test/unit/spec/roap/request.ts +196 -85
  404. package/test/unit/spec/roap/turnDiscovery.ts +30 -7
  405. package/test/unit/spec/rtcMetrics/index.ts +60 -0
  406. package/test/unit/spec/stats-analyzer/index.js +92 -41
  407. package/test/utils/constants.js +9 -0
  408. package/test/utils/integrationTestUtils.js +46 -0
  409. package/test/utils/testUtils.js +0 -45
  410. package/test/utils/webex-config.js +4 -0
  411. package/test/utils/webex-test-users.js +6 -3
  412. package/dist/meeting/effectsState.js +0 -262
  413. package/dist/meeting/effectsState.js.map +0 -1
  414. package/dist/metrics/config.js +0 -299
  415. package/dist/metrics/config.js.map +0 -1
  416. package/dist/multistream/multistreamMedia.js +0 -110
  417. package/dist/multistream/multistreamMedia.js.map +0 -1
  418. package/src/index.js +0 -16
  419. package/src/meeting/effectsState.ts +0 -211
  420. package/src/metrics/config.ts +0 -495
  421. package/src/multistream/multistreamMedia.ts +0 -97
  422. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -5,107 +5,162 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
5
5
  _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.createMuteState = exports.MuteState = void 0;
9
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
13
13
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
14
14
  var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
15
- var _permission = _interopRequireDefault(require("../common/errors/permission"));
16
- var _media = _interopRequireDefault(require("../media"));
17
15
  var _util = _interopRequireDefault(require("./util"));
18
16
  var _constants = require("../constants");
19
- /* Certain aspects of server interaction for video muting are not implemented as we currently don't support remote muting of video.
20
- If we ever need to support it, search for REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION string to find the places that need updating
21
- */
17
+ // eslint-disable-next-line import/prefer-default-export
18
+ var createMuteState = function createMuteState(type, meeting, enabled) {
19
+ // todo: remove the meeting argument (SPARK-399695)
22
20
 
23
- var createMuteState = function createMuteState(type, meeting, mediaDirection) {
24
- if (type === _constants.AUDIO && !mediaDirection.sendAudio) {
25
- return null;
26
- }
27
- if (type === _constants.VIDEO && !mediaDirection.sendVideo) {
28
- return null;
29
- }
30
21
  _loggerProxy.default.logger.info("Meeting:muteState#createMuteState --> ".concat(type, ": creating MuteState for meeting id ").concat(meeting === null || meeting === void 0 ? void 0 : meeting.id));
31
- return new MuteState(type, meeting);
22
+ var muteState = new MuteState(type, meeting, enabled);
23
+ return muteState;
32
24
  };
33
25
 
34
26
  /** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches
35
27
  the last requested state by the client.
36
28
 
37
29
  More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#
30
+
31
+ This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called
38
32
  */
33
+ exports.createMuteState = createMuteState;
39
34
  var MuteState = /*#__PURE__*/function () {
40
35
  /**
41
36
  * Constructor
42
37
  *
43
38
  * @param {String} type - audio or video
44
39
  * @param {Object} meeting - the meeting object (used for reading current remote mute status)
40
+ * @param {boolean} enabled - whether the client audio/video is enabled at all
45
41
  */
46
- function MuteState(type, meeting) {
42
+ function MuteState(type, meeting, enabled) {
43
+ var _meeting$remoteVideoM, _meeting$unmuteVideoA;
47
44
  (0, _classCallCheck2.default)(this, MuteState);
48
- (0, _defineProperty2.default)(this, "pendingPromiseReject", void 0);
49
- (0, _defineProperty2.default)(this, "pendingPromiseResolve", void 0);
50
45
  (0, _defineProperty2.default)(this, "state", void 0);
51
46
  (0, _defineProperty2.default)(this, "type", void 0);
47
+ (0, _defineProperty2.default)(this, "ignoreMuteStateChange", void 0);
52
48
  if (type !== _constants.AUDIO && type !== _constants.VIDEO) {
53
49
  throw new _parameter.default('Mute state is designed for handling audio or video only');
54
50
  }
55
51
  this.type = type;
52
+ this.ignoreMuteStateChange = false;
56
53
  this.state = {
57
54
  client: {
58
- localMute: false
55
+ enabled: enabled,
56
+ localMute: true
59
57
  },
60
58
  server: {
61
- localMute: false,
62
- // initial values available only for audio (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)
63
- remoteMute: type === _constants.AUDIO ? meeting.remoteMuted : false,
64
- unmuteAllowed: type === _constants.AUDIO ? meeting.unmuteAllowed : true
59
+ localMute: true,
60
+ // because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined
61
+ remoteMute: type === _constants.AUDIO ? meeting.remoteMuted : (_meeting$remoteVideoM = meeting.remoteVideoMuted) !== null && _meeting$remoteVideoM !== void 0 ? _meeting$remoteVideoM : false,
62
+ unmuteAllowed: type === _constants.AUDIO ? meeting.unmuteAllowed : (_meeting$unmuteVideoA = meeting.unmuteVideoAllowed) !== null && _meeting$unmuteVideoA !== void 0 ? _meeting$unmuteVideoA : true
65
63
  },
66
64
  syncToServerInProgress: false
67
65
  };
68
- // these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call
69
- this.pendingPromiseResolve = null;
70
- this.pendingPromiseReject = null;
71
66
  }
72
67
 
73
68
  /**
74
- * Handles mute/unmute request from the client/user. Returns a promise that's resolved once the server update is completed or
75
- * at the point that this request becomese superseded by another client request.
76
- *
77
- * The client doesn't have to wait for the returned promise to resolve before calling handleClientRequest() again. If
78
- * handleClientRequest() is called again before the previous one resolved, the MuteState class will make sure that eventually
79
- * the server state will match the last requested state from the client.
69
+ * Starts the mute state machine. Needs to be called after a new MuteState instance is created.
80
70
  *
81
- * @public
82
- * @memberof MuteState
83
- * @param {Object} [meeting] the meeting object
84
- * @param {Boolean} [mute] true for muting, false for unmuting request
85
- * @returns {Promise}
71
+ * @param {Object} meeting - the meeting object
72
+ * @returns {void}
86
73
  */
87
74
  (0, _createClass2.default)(MuteState, [{
88
- key: "handleClientRequest",
89
- value: function handleClientRequest(meeting, mute) {
90
- var _this = this;
91
- _loggerProxy.default.logger.info("Meeting:muteState#handleClientRequest --> ".concat(this.type, ": user requesting new mute state: ").concat(mute));
92
- if (!mute && !this.state.server.unmuteAllowed) {
93
- return _promise.default.reject(new _permission.default('User is not allowed to unmute self (hard mute feature is being used)'));
75
+ key: "init",
76
+ value: function init(meeting) {
77
+ var _meeting$mediaPropert, _meeting$mediaPropert2;
78
+ this.applyUnmuteAllowedToTrack(meeting);
79
+
80
+ // if we are remotely muted, we need to apply that to the local track now (mute on-entry)
81
+ if (this.state.server.remoteMute) {
82
+ this.muteLocalTrack(meeting, this.state.server.remoteMute, 'remotelyMuted');
83
+ }
84
+ var initialMute = this.type === _constants.AUDIO ? (_meeting$mediaPropert = meeting.mediaProperties.audioTrack) === null || _meeting$mediaPropert === void 0 ? void 0 : _meeting$mediaPropert.muted : (_meeting$mediaPropert2 = meeting.mediaProperties.videoTrack) === null || _meeting$mediaPropert2 === void 0 ? void 0 : _meeting$mediaPropert2.muted;
85
+ _loggerProxy.default.logger.info("Meeting:muteState#init --> ".concat(this.type, ": local track initial mute state: ").concat(initialMute));
86
+ if (initialMute !== undefined) {
87
+ this.state.client.localMute = initialMute;
88
+ } else {
89
+ // there is no track, so it's like we are locally muted
90
+ // (this is important especially for transcoded meetings, in which the SDP m-line direction always stays "sendrecv")
91
+ this.state.client.localMute = true;
92
+ }
93
+ this.applyClientStateToServer(meeting);
94
+ }
95
+
96
+ /**
97
+ * This method needs to be called whenever the local audio/video track has changed.
98
+ * It reapplies the remote mute state onto the new track and also reads the current
99
+ * local mute state from the track and updates the internal state machine and sends
100
+ * any required requests to the server.
101
+ *
102
+ * @param {Object} meeting - the meeting object
103
+ * @returns {void}
104
+ */
105
+ }, {
106
+ key: "handleLocalTrackChange",
107
+ value: function handleLocalTrackChange(meeting) {
108
+ return this.init(meeting);
109
+ }
110
+
111
+ /**
112
+ * Enables/disables audio/video
113
+ *
114
+ * @param {Object} meeting - the meeting object
115
+ * @param {boolean} enable
116
+ * @returns {void}
117
+ */
118
+ }, {
119
+ key: "enable",
120
+ value: function enable(meeting, _enable) {
121
+ this.state.client.enabled = _enable;
122
+ this.applyClientStateToServer(meeting);
123
+ }
124
+
125
+ /**
126
+ * Mutes/unmutes local track
127
+ *
128
+ * @param {Object} meeting - the meeting object
129
+ * @param {Boolean} mute - true to mute the track, false to unmute it
130
+ * @param {ServerMuteReason} reason - reason for muting/unmuting
131
+ * @returns {void}
132
+ */
133
+ }, {
134
+ key: "muteLocalTrack",
135
+ value: function muteLocalTrack(meeting, mute, reason) {
136
+ this.ignoreMuteStateChange = true;
137
+ if (this.type === _constants.AUDIO) {
138
+ var _meeting$mediaPropert3;
139
+ (_meeting$mediaPropert3 = meeting.mediaProperties.audioTrack) === null || _meeting$mediaPropert3 === void 0 ? void 0 : _meeting$mediaPropert3.setServerMuted(mute, reason);
140
+ } else {
141
+ var _meeting$mediaPropert4;
142
+ (_meeting$mediaPropert4 = meeting.mediaProperties.videoTrack) === null || _meeting$mediaPropert4 === void 0 ? void 0 : _meeting$mediaPropert4.setServerMuted(mute, reason);
94
143
  }
144
+ this.ignoreMuteStateChange = false;
145
+ }
95
146
 
96
- // we don't check if we're already in the same state, because even if we were, we would still have to apply the mute state locally,
97
- // because the client may have changed the audio/vidoe tracks
147
+ /**
148
+ * This method should be called when the local track mute state is changed
149
+ * @public
150
+ * @memberof MuteState
151
+ * @param {Object} [meeting] the meeting object
152
+ * @param {Boolean} [mute] true for muting, false for unmuting request
153
+ * @returns {void}
154
+ */
155
+ }, {
156
+ key: "handleLocalTrackMuteStateChange",
157
+ value: function handleLocalTrackMuteStateChange(meeting, mute) {
158
+ if (this.ignoreMuteStateChange) {
159
+ return;
160
+ }
161
+ _loggerProxy.default.logger.info("Meeting:muteState#handleLocalTrackMuteStateChange --> ".concat(this.type, ": local track new mute state: ").concat(mute));
98
162
  this.state.client.localMute = mute;
99
- this.applyClientStateLocally(meeting);
100
- return new _promise.default(function (resolve, reject) {
101
- if (_this.pendingPromiseResolve) {
102
- // resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one
103
- _this.pendingPromiseResolve();
104
- }
105
- _this.pendingPromiseResolve = resolve;
106
- _this.pendingPromiseReject = reject;
107
- _this.applyClientStateToServer(meeting);
108
- });
163
+ this.applyClientStateToServer(meeting);
109
164
  }
110
165
 
111
166
  /**
@@ -113,13 +168,25 @@ var MuteState = /*#__PURE__*/function () {
113
168
  *
114
169
  * @public
115
170
  * @param {Object} [meeting] the meeting object
171
+ * @param {ServerMuteReason} reason - reason why we're applying our client state to the local track
116
172
  * @memberof MuteState
117
173
  * @returns {void}
118
174
  */
119
175
  }, {
120
176
  key: "applyClientStateLocally",
121
- value: function applyClientStateLocally(meeting) {
122
- _media.default.setLocalTrack(!this.state.client.localMute, this.type === _constants.AUDIO ? meeting.mediaProperties.audioTrack : meeting.mediaProperties.videoTrack);
177
+ value: function applyClientStateLocally(meeting, reason) {
178
+ this.muteLocalTrack(meeting, this.state.client.localMute, reason);
179
+ }
180
+
181
+ /** Returns true if client is locally muted - it takes into account not just the client local mute state,
182
+ * but also whether audio/video is enabled at all
183
+ *
184
+ * @returns {boolean}
185
+ */
186
+ }, {
187
+ key: "getClientLocalMuteState",
188
+ value: function getClientLocalMuteState() {
189
+ return this.state.client.enabled ? this.state.client.localMute : true;
123
190
  }
124
191
 
125
192
  /**
@@ -133,22 +200,18 @@ var MuteState = /*#__PURE__*/function () {
133
200
  }, {
134
201
  key: "applyClientStateToServer",
135
202
  value: function applyClientStateToServer(meeting) {
136
- var _this2 = this;
203
+ var _this = this;
137
204
  if (this.state.syncToServerInProgress) {
138
205
  _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": request to server in progress, we need to wait for it to complete"));
139
206
  return;
140
207
  }
141
- var localMuteRequiresSync = this.state.client.localMute !== this.state.server.localMute;
142
- var remoteMuteRequiresSync = !this.state.client.localMute && this.state.server.remoteMute;
143
- _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": localMuteRequiresSync: ").concat(localMuteRequiresSync, " (").concat(this.state.client.localMute, " ?= ").concat(this.state.server.localMute, ")"));
208
+ var localMuteState = this.getClientLocalMuteState();
209
+ var localMuteRequiresSync = localMuteState !== this.state.server.localMute;
210
+ var remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;
211
+ _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": localMuteRequiresSync: ").concat(localMuteRequiresSync, " (").concat(localMuteState, " ?= ").concat(this.state.server.localMute, ")"));
144
212
  _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": remoteMuteRequiresSync: ").concat(remoteMuteRequiresSync));
145
213
  if (!localMuteRequiresSync && !remoteMuteRequiresSync) {
146
214
  _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": client state already matching server state, nothing to do"));
147
- if (this.pendingPromiseResolve) {
148
- this.pendingPromiseResolve();
149
- }
150
- this.pendingPromiseResolve = null;
151
- this.pendingPromiseReject = null;
152
215
  return;
153
216
  }
154
217
  this.state.syncToServerInProgress = true;
@@ -158,21 +221,18 @@ var MuteState = /*#__PURE__*/function () {
158
221
  localMuteSyncPromise.then(function () {
159
222
  return (
160
223
  // then follow it up with remote mute sync
161
- remoteMuteRequiresSync ? _this2.sendRemoteMuteRequestToServer(meeting) : _promise.default.resolve()
224
+ remoteMuteRequiresSync ? _this.sendRemoteMuteRequestToServer(meeting) : _promise.default.resolve()
162
225
  );
163
226
  }).then(function () {
164
- _this2.state.syncToServerInProgress = false;
165
- _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(_this2.type, ": sync with server completed"));
227
+ _this.state.syncToServerInProgress = false;
228
+ _loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(_this.type, ": sync with server completed"));
166
229
 
167
230
  // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync
168
- _this2.applyClientStateToServer(meeting);
231
+ _this.applyClientStateToServer(meeting);
169
232
  }).catch(function (e) {
170
- _this2.state.syncToServerInProgress = false;
171
- if (_this2.pendingPromiseReject) {
172
- _this2.pendingPromiseReject(e);
173
- }
174
- _this2.pendingPromiseResolve = null;
175
- _this2.pendingPromiseReject = null;
233
+ _this.state.syncToServerInProgress = false;
234
+ _loggerProxy.default.logger.warn("Meeting:muteState#applyClientStateToServer --> ".concat(_this.type, ": error: ").concat(e));
235
+ _this.applyServerMuteToLocalTrack(meeting, 'clientRequestFailed');
176
236
  });
177
237
  }
178
238
 
@@ -187,19 +247,19 @@ var MuteState = /*#__PURE__*/function () {
187
247
  }, {
188
248
  key: "sendLocalMuteRequestToServer",
189
249
  value: function sendLocalMuteRequestToServer(meeting) {
190
- var _meeting$audio,
191
- _meeting$video,
192
- _this3 = this;
193
- var audioMuted = this.type === _constants.AUDIO ? this.state.client.localMute : (_meeting$audio = meeting.audio) === null || _meeting$audio === void 0 ? void 0 : _meeting$audio.state.client.localMute;
194
- var videoMuted = this.type === _constants.VIDEO ? this.state.client.localMute : (_meeting$video = meeting.video) === null || _meeting$video === void 0 ? void 0 : _meeting$video.state.client.localMute;
250
+ var _this2 = this;
251
+ var audioMuted = this.type === _constants.AUDIO ? this.getClientLocalMuteState() : undefined;
252
+ var videoMuted = this.type === _constants.VIDEO ? this.getClientLocalMuteState() : undefined;
195
253
  _loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(this.type, ": sending local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") to server"));
196
- return _util.default.remoteUpdateAudioVideo(audioMuted, videoMuted, meeting).then(function (locus) {
197
- _loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this3.type, ": local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") applied to server"));
198
- _this3.state.server.localMute = _this3.type === _constants.AUDIO ? audioMuted : videoMuted;
199
- meeting.locusInfo.onFullLocus(locus);
254
+ return _util.default.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted).then(function (locus) {
255
+ _loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this2.type, ": local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") applied to server"));
256
+ _this2.state.server.localMute = _this2.type === _constants.AUDIO ? audioMuted : videoMuted;
257
+ if (locus) {
258
+ meeting.locusInfo.handleLocusDelta(locus, meeting);
259
+ }
200
260
  return locus;
201
261
  }).catch(function (remoteUpdateError) {
202
- _loggerProxy.default.logger.warn("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this3.type, ": failed to apply local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") to server: ").concat(remoteUpdateError));
262
+ _loggerProxy.default.logger.warn("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this2.type, ": failed to apply local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") to server: ").concat(remoteUpdateError));
203
263
  return _promise.default.reject(remoteUpdateError);
204
264
  });
205
265
  }
@@ -215,22 +275,47 @@ var MuteState = /*#__PURE__*/function () {
215
275
  }, {
216
276
  key: "sendRemoteMuteRequestToServer",
217
277
  value: function sendRemoteMuteRequestToServer(meeting) {
218
- var _this4 = this;
278
+ var _this3 = this;
279
+ var remoteMute = this.getClientLocalMuteState();
280
+ _loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(this.type, ": sending remote mute:").concat(remoteMute, " to server"));
281
+ return meeting.members.muteMember(meeting.members.selfId, remoteMute, this.type === _constants.AUDIO).then(function () {
282
+ _loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this3.type, ": remote mute:").concat(remoteMute, " applied to server"));
283
+ _this3.state.server.remoteMute = remoteMute;
284
+ }).catch(function (remoteUpdateError) {
285
+ _loggerProxy.default.logger.warn("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this3.type, ": failed to apply remote mute ").concat(remoteMute, " to server: ").concat(remoteUpdateError));
286
+ return _promise.default.reject(remoteUpdateError);
287
+ });
288
+ }
289
+
290
+ /** Sets the mute state of the local track according to what server thinks is our state
291
+ * @param {Object} meeting - the meeting object
292
+ * @param {ServerMuteReason} serverMuteReason - reason why we're applying server mute to the local track
293
+ * @returns {void}
294
+ */
295
+ }, {
296
+ key: "applyServerMuteToLocalTrack",
297
+ value: function applyServerMuteToLocalTrack(meeting, serverMuteReason) {
298
+ var muted = this.state.server.localMute || this.state.server.remoteMute;
299
+
300
+ // update the local track mute state, but not this.state.client.localMute
301
+ this.muteLocalTrack(meeting, muted, serverMuteReason);
302
+ }
303
+
304
+ /** Applies the current value for unmute allowed to the underlying track
305
+ *
306
+ * @param {Meeting} meeting
307
+ * @returns {void}
308
+ */
309
+ }, {
310
+ key: "applyUnmuteAllowedToTrack",
311
+ value: function applyUnmuteAllowedToTrack(meeting) {
219
312
  if (this.type === _constants.AUDIO) {
220
- var remoteMute = this.state.client.localMute;
221
- _loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(this.type, ": sending remote mute:").concat(remoteMute, " to server"));
222
- return meeting.members.muteMember(meeting.members.selfId, remoteMute).then(function () {
223
- _loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this4.type, ": remote mute:").concat(remoteMute, " applied to server"));
224
- _this4.state.server.remoteMute = remoteMute;
225
- }).catch(function (remoteUpdateError) {
226
- _loggerProxy.default.logger.warn("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this4.type, ": failed to apply remote mute ").concat(remoteMute, " to server: ").concat(remoteUpdateError));
227
- return _promise.default.reject(remoteUpdateError);
228
- });
313
+ var _meeting$mediaPropert5;
314
+ (_meeting$mediaPropert5 = meeting.mediaProperties.audioTrack) === null || _meeting$mediaPropert5 === void 0 ? void 0 : _meeting$mediaPropert5.setUnmuteAllowed(this.state.server.unmuteAllowed);
315
+ } else {
316
+ var _meeting$mediaPropert6;
317
+ (_meeting$mediaPropert6 = meeting.mediaProperties.videoTrack) === null || _meeting$mediaPropert6 === void 0 ? void 0 : _meeting$mediaPropert6.setUnmuteAllowed(this.state.server.unmuteAllowed);
229
318
  }
230
-
231
- // for now we don't need to support remote muting of video (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)
232
- this.state.server.remoteMute = this.state.client.localMute;
233
- return _promise.default.resolve();
234
319
  }
235
320
 
236
321
  /**
@@ -238,16 +323,23 @@ var MuteState = /*#__PURE__*/function () {
238
323
  *
239
324
  * @public
240
325
  * @memberof MuteState
326
+ * @param {Meeting} meeting
241
327
  * @param {Boolean} [muted] true if user is remotely muted, false otherwise
242
328
  * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when "hard mute" feature is used)
243
329
  * @returns {undefined}
244
330
  */
245
331
  }, {
246
332
  key: "handleServerRemoteMuteUpdate",
247
- value: function handleServerRemoteMuteUpdate(muted, unmuteAllowed) {
333
+ value: function handleServerRemoteMuteUpdate(meeting, muted, unmuteAllowed) {
248
334
  _loggerProxy.default.logger.info("Meeting:muteState#handleServerRemoteMuteUpdate --> ".concat(this.type, ": updating server remoteMute to (").concat(muted, ")"));
249
- this.state.server.remoteMute = muted;
250
- this.state.server.unmuteAllowed = unmuteAllowed;
335
+ if (unmuteAllowed !== undefined) {
336
+ this.state.server.unmuteAllowed = unmuteAllowed;
337
+ this.applyUnmuteAllowedToTrack(meeting);
338
+ }
339
+ if (muted !== undefined) {
340
+ this.state.server.remoteMute = muted;
341
+ this.applyServerMuteToLocalTrack(meeting, 'remotelyMuted');
342
+ }
251
343
  }
252
344
 
253
345
  /**
@@ -261,20 +353,22 @@ var MuteState = /*#__PURE__*/function () {
261
353
  }, {
262
354
  key: "handleServerLocalUnmuteRequired",
263
355
  value: function handleServerLocalUnmuteRequired(meeting) {
264
- _loggerProxy.default.logger.info("Meeting:muteState#handleServerLocalUnmuteRequired --> ".concat(this.type, ": localAudioUnmuteRequired received -> doing local unmute"));
356
+ if (!this.state.client.enabled) {
357
+ _loggerProxy.default.logger.warn("Meeting:muteState#handleServerLocalUnmuteRequired --> ".concat(this.type, ": localAudioUnmuteRequired received while ").concat(this.type, " is disabled -> local unmute will not result in ").concat(this.type, " being sent"));
358
+ } else {
359
+ _loggerProxy.default.logger.info("Meeting:muteState#handleServerLocalUnmuteRequired --> ".concat(this.type, ": localAudioUnmuteRequired received -> doing local unmute"));
360
+ }
361
+
362
+ // todo: I'm seeing "you can now unmute yourself " popup when this happens - but same thing happens on web.w.c so we can ignore for now
265
363
  this.state.server.remoteMute = false;
266
364
  this.state.client.localMute = false;
267
- if (this.pendingPromiseReject) {
268
- this.pendingPromiseReject(new Error('Server requested local unmute - this overrides any client request in progress'));
269
- this.pendingPromiseResolve = null;
270
- this.pendingPromiseReject = null;
271
- }
272
- this.applyClientStateLocally(meeting);
365
+ this.applyClientStateLocally(meeting, 'localUnmuteRequired');
273
366
  this.applyClientStateToServer(meeting);
274
367
  }
275
368
 
276
369
  /**
277
- * Returns true if the user is locally or remotely muted
370
+ * Returns true if the user is locally or remotely muted.
371
+ * It only checks the mute status, ignoring the fact whether audio/video is enabled.
278
372
  *
279
373
  * @public
280
374
  * @memberof MuteState
@@ -287,34 +381,45 @@ var MuteState = /*#__PURE__*/function () {
287
381
  }
288
382
 
289
383
  /**
290
- * Returns true if the user is muted as a result of the client request (and not remotely muted)
384
+ * Returns true if the user is remotely muted
291
385
  *
292
386
  * @public
293
387
  * @memberof MuteState
294
388
  * @returns {Boolean}
295
389
  */
296
390
  }, {
297
- key: "isSelf",
298
- value: function isSelf() {
299
- return this.state.client.localMute && !this.state.server.remoteMute;
391
+ key: "isRemotelyMuted",
392
+ value: function isRemotelyMuted() {
393
+ return this.state.server.remoteMute;
300
394
  }
301
395
 
302
- // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes
396
+ /**
397
+ * Returns true if unmute is allowed
398
+ *
399
+ * @public
400
+ * @memberof MuteState
401
+ * @returns {Boolean}
402
+ */
303
403
  }, {
304
- key: "muted",
305
- get: function get() {
306
- return this.isMuted();
404
+ key: "isUnmuteAllowed",
405
+ value: function isUnmuteAllowed() {
406
+ return this.state.server.unmuteAllowed;
307
407
  }
308
408
 
309
- // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes
409
+ /**
410
+ * Returns true if the user is locally muted or audio/video is disabled
411
+ *
412
+ * @public
413
+ * @memberof MuteState
414
+ * @returns {Boolean}
415
+ */
310
416
  }, {
311
- key: "self",
312
- get: function get() {
313
- return this.isSelf();
417
+ key: "isLocallyMuted",
418
+ value: function isLocallyMuted() {
419
+ return this.getClientLocalMuteState();
314
420
  }
315
421
  }]);
316
422
  return MuteState;
317
423
  }();
318
- var _default = createMuteState;
319
- exports.default = _default;
424
+ exports.MuteState = MuteState;
320
425
  //# sourceMappingURL=muteState.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createMuteState","type","meeting","mediaDirection","AUDIO","sendAudio","VIDEO","sendVideo","LoggerProxy","logger","info","id","MuteState","ParameterError","state","client","localMute","server","remoteMute","remoteMuted","unmuteAllowed","syncToServerInProgress","pendingPromiseResolve","pendingPromiseReject","mute","reject","PermissionError","applyClientStateLocally","resolve","applyClientStateToServer","Media","setLocalTrack","mediaProperties","audioTrack","videoTrack","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","then","sendRemoteMuteRequestToServer","catch","e","audioMuted","audio","videoMuted","video","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","onFullLocus","remoteUpdateError","warn","members","muteMember","selfId","muted","Error","isMuted","isSelf"],"sources":["muteState.ts"],"sourcesContent":["import LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport PermissionError from '../common/errors/permission';\nimport Media from '../media';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n/* Certain aspects of server interaction for video muting are not implemented as we currently don't support remote muting of video.\n If we ever need to support it, search for REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION string to find the places that need updating\n*/\n\nconst createMuteState = (type, meeting, mediaDirection) => {\n if (type === AUDIO && !mediaDirection.sendAudio) {\n return null;\n }\n if (type === VIDEO && !mediaDirection.sendVideo) {\n return null;\n }\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n return new MuteState(type, meeting);\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n*/\nclass MuteState {\n pendingPromiseReject: any;\n pendingPromiseResolve: any;\n state: any;\n type: any;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n */\n constructor(type: string, meeting: any) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.state = {\n client: {\n localMute: false,\n },\n server: {\n localMute: false,\n // initial values available only for audio (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)\n remoteMute: type === AUDIO ? meeting.remoteMuted : false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : true,\n },\n syncToServerInProgress: false,\n };\n // these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n /**\n * Handles mute/unmute request from the client/user. Returns a promise that's resolved once the server update is completed or\n * at the point that this request becomese superseded by another client request.\n *\n * The client doesn't have to wait for the returned promise to resolve before calling handleClientRequest() again. If\n * handleClientRequest() is called again before the previous one resolved, the MuteState class will make sure that eventually\n * the server state will match the last requested state from the client.\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {Promise}\n */\n public handleClientRequest(meeting?: object, mute?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleClientRequest --> ${this.type}: user requesting new mute state: ${mute}`\n );\n\n if (!mute && !this.state.server.unmuteAllowed) {\n return Promise.reject(\n new PermissionError('User is not allowed to unmute self (hard mute feature is being used)')\n );\n }\n\n // we don't check if we're already in the same state, because even if we were, we would still have to apply the mute state locally,\n // because the client may have changed the audio/vidoe tracks\n this.state.client.localMute = mute;\n this.applyClientStateLocally(meeting);\n\n return new Promise((resolve, reject) => {\n if (this.pendingPromiseResolve) {\n // resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one\n this.pendingPromiseResolve();\n }\n this.pendingPromiseResolve = resolve;\n this.pendingPromiseReject = reject;\n this.applyClientStateToServer(meeting);\n });\n }\n\n /**\n * Applies the current mute state to the local track (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any) {\n Media.setLocalTrack(\n !this.state.client.localMute,\n this.type === AUDIO ? meeting.mediaProperties.audioTrack : meeting.mediaProperties.videoTrack\n );\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: object) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteRequiresSync = this.state.client.localMute !== this.state.server.localMute;\n const remoteMuteRequiresSync = !this.state.client.localMute && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${this.state.client.localMute} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n if (this.pendingPromiseResolve) {\n this.pendingPromiseResolve();\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n if (this.pendingPromiseReject) {\n this.pendingPromiseReject(e);\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted =\n this.type === AUDIO ? this.state.client.localMute : meeting.audio?.state.client.localMute;\n const videoMuted =\n this.type === VIDEO ? this.state.client.localMute : meeting.video?.state.client.localMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(audioMuted, videoMuted, meeting)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n meeting.locusInfo.onFullLocus(locus);\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n if (this.type === AUDIO) {\n const remoteMute = this.state.client.localMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n // for now we don't need to support remote muting of video (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)\n this.state.server.remoteMute = this.state.client.localMute;\n\n return Promise.resolve();\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n this.state.server.remoteMute = muted;\n this.state.server.unmuteAllowed = unmuteAllowed;\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting?: object) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute`\n );\n\n this.state.server.remoteMute = false;\n this.state.client.localMute = false;\n\n if (this.pendingPromiseReject) {\n this.pendingPromiseReject(\n new Error('Server requested local unmute - this overrides any client request in progress')\n );\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n this.applyClientStateLocally(meeting);\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is muted as a result of the client request (and not remotely muted)\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isSelf() {\n return this.state.client.localMute && !this.state.server.remoteMute;\n }\n\n // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes\n get muted() {\n return this.isMuted();\n }\n\n // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes\n get self() {\n return this.isSelf();\n }\n}\n\nexport default createMuteState;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,IAAI,EAAEC,OAAO,EAAEC,cAAc,EAAK;EACzD,IAAIF,IAAI,KAAKG,gBAAK,IAAI,CAACD,cAAc,CAACE,SAAS,EAAE;IAC/C,OAAO,IAAI;EACb;EACA,IAAIJ,IAAI,KAAKK,gBAAK,IAAI,CAACH,cAAc,CAACI,SAAS,EAAE;IAC/C,OAAO,IAAI;EACb;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,iDACoBT,IAAI,iDAAuCC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAES,EAAE,EAChG;EAED,OAAO,IAAIC,SAAS,CAACX,IAAI,EAAEC,OAAO,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA,IAKMU,SAAS;EAMb;AACF;AACA;AACA;AACA;AACA;EACE,mBAAYX,IAAY,EAAEC,OAAY,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IACtC,IAAID,IAAI,KAAKG,gBAAK,IAAIH,IAAI,KAAKK,gBAAK,EAAE;MACpC,MAAM,IAAIO,kBAAc,CAAC,yDAAyD,CAAC;IACrF;IACA,IAAI,CAACZ,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACa,KAAK,GAAG;MACXC,MAAM,EAAE;QACNC,SAAS,EAAE;MACb,CAAC;MACDC,MAAM,EAAE;QACND,SAAS,EAAE,KAAK;QAChB;QACAE,UAAU,EAAEjB,IAAI,KAAKG,gBAAK,GAAGF,OAAO,CAACiB,WAAW,GAAG,KAAK;QACxDC,aAAa,EAAEnB,IAAI,KAAKG,gBAAK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ClC;MAEA,IAAI,CAACI,uBAAuB,CAACzB,OAAO,CAAC;MACrC,IAAI,CAAC2B,wBAAwB,CAAC3B,OAAO,CAAC;IACxC;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,mBAAiB;MACf,OACE,IAAI,CAACY,KAAK,CAACC,MAAM,CAACC,SAAS,IAAI,IAAI,CAACF,KAAK,CAACG,MAAM,CAACD,SAAS,IAAI,IAAI,CAACF,KAAK,CAACG,MAAM,CAACC,UAAU;IAE9F;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,kBAAgB;MACd,OAAO,IAAI,CAACJ,KAAK,CAACC,MAAM,CAACC,SAAS,IAAI,CAAC,IAAI,CAACF,KAAK,CAACG,MAAM,CAACC,UAAU;IACrE;;IAEA;EAAA;IAAA;IAAA,KACA,eAAY;MACV,OAAO,IAAI,CAACyC,OAAO,EAAE;IACvB;;IAEA;EAAA;IAAA;IAAA,KACA,eAAW;MACT,OAAO,IAAI,CAACC,MAAM,EAAE;IACtB;EAAC;EAAA;AAAA;AAAA,eAGY5D,eAAe;AAAA"}
1
+ {"version":3,"names":["createMuteState","type","meeting","enabled","LoggerProxy","logger","info","id","muteState","MuteState","AUDIO","VIDEO","ParameterError","ignoreMuteStateChange","state","client","localMute","server","remoteMute","remoteMuted","remoteVideoMuted","unmuteAllowed","unmuteVideoAllowed","syncToServerInProgress","applyUnmuteAllowedToTrack","muteLocalTrack","initialMute","mediaProperties","audioTrack","muted","videoTrack","undefined","applyClientStateToServer","init","enable","mute","reason","setServerMuted","localMuteState","getClientLocalMuteState","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","resolve","then","sendRemoteMuteRequestToServer","catch","e","warn","applyServerMuteToLocalTrack","audioMuted","videoMuted","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","handleLocusDelta","remoteUpdateError","reject","members","muteMember","selfId","serverMuteReason","setUnmuteAllowed","applyClientStateLocally"],"sources":["muteState.ts"],"sourcesContent":["import {ServerMuteReason} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const createMuteState = (type, meeting, enabled: boolean) => {\n // todo: remove the meeting argument (SPARK-399695)\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n const muteState = new MuteState(type, meeting, enabled);\n\n return muteState;\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n\n This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called\n*/\nexport class MuteState {\n state: {\n client: {\n enabled: boolean; // indicates if audio/video is enabled at all or not\n localMute: boolean;\n };\n server: {localMute: boolean; remoteMute: boolean; unmuteAllowed: boolean};\n syncToServerInProgress: boolean;\n };\n\n type: any;\n ignoreMuteStateChange: boolean;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(type: string, meeting: any, enabled: boolean) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.ignoreMuteStateChange = false;\n this.state = {\n client: {\n enabled,\n localMute: true,\n },\n server: {\n localMute: true,\n // because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined\n remoteMute: type === AUDIO ? meeting.remoteMuted : meeting.remoteVideoMuted ?? false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : meeting.unmuteVideoAllowed ?? true,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Starts the mute state machine. Needs to be called after a new MuteState instance is created.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public init(meeting: any) {\n this.applyUnmuteAllowedToTrack(meeting);\n\n // if we are remotely muted, we need to apply that to the local track now (mute on-entry)\n if (this.state.server.remoteMute) {\n this.muteLocalTrack(meeting, this.state.server.remoteMute, 'remotelyMuted');\n }\n\n const initialMute =\n this.type === AUDIO\n ? meeting.mediaProperties.audioTrack?.muted\n : meeting.mediaProperties.videoTrack?.muted;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#init --> ${this.type}: local track initial mute state: ${initialMute}`\n );\n\n if (initialMute !== undefined) {\n this.state.client.localMute = initialMute;\n } else {\n // there is no track, so it's like we are locally muted\n // (this is important especially for transcoded meetings, in which the SDP m-line direction always stays \"sendrecv\")\n this.state.client.localMute = true;\n }\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * This method needs to be called whenever the local audio/video track has changed.\n * It reapplies the remote mute state onto the new track and also reads the current\n * local mute state from the track and updates the internal state machine and sends\n * any required requests to the server.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public handleLocalTrackChange(meeting: any) {\n return this.init(meeting);\n }\n\n /**\n * Enables/disables audio/video\n *\n * @param {Object} meeting - the meeting object\n * @param {boolean} enable\n * @returns {void}\n */\n public enable(meeting: any, enable: boolean) {\n this.state.client.enabled = enable;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Mutes/unmutes local track\n *\n * @param {Object} meeting - the meeting object\n * @param {Boolean} mute - true to mute the track, false to unmute it\n * @param {ServerMuteReason} reason - reason for muting/unmuting\n * @returns {void}\n */\n private muteLocalTrack(meeting: any, mute: boolean, reason: ServerMuteReason) {\n this.ignoreMuteStateChange = true;\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioTrack?.setServerMuted(mute, reason);\n } else {\n meeting.mediaProperties.videoTrack?.setServerMuted(mute, reason);\n }\n this.ignoreMuteStateChange = false;\n }\n\n /**\n * This method should be called when the local track mute state is changed\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {void}\n */\n public handleLocalTrackMuteStateChange(meeting?: object, mute?: boolean) {\n if (this.ignoreMuteStateChange) {\n return;\n }\n LoggerProxy.logger.info(\n `Meeting:muteState#handleLocalTrackMuteStateChange --> ${this.type}: local track new mute state: ${mute}`\n );\n\n this.state.client.localMute = mute;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Applies the current mute state to the local track (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @param {ServerMuteReason} reason - reason why we're applying our client state to the local track\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any, reason?: ServerMuteReason) {\n this.muteLocalTrack(meeting, this.state.client.localMute, reason);\n }\n\n /** Returns true if client is locally muted - it takes into account not just the client local mute state,\n * but also whether audio/video is enabled at all\n *\n * @returns {boolean}\n */\n private getClientLocalMuteState() {\n return this.state.client.enabled ? this.state.client.localMute : true;\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: any) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteState = this.getClientLocalMuteState();\n const localMuteRequiresSync = localMuteState !== this.state.server.localMute;\n const remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${localMuteState} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n LoggerProxy.logger.warn(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: error: ${e}`\n );\n\n this.applyServerMuteToLocalTrack(meeting, 'clientRequestFailed');\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted = this.type === AUDIO ? this.getClientLocalMuteState() : undefined;\n const videoMuted = this.type === VIDEO ? this.getClientLocalMuteState() : undefined;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n if (locus) {\n meeting.locusInfo.handleLocusDelta(locus, meeting);\n }\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n const remoteMute = this.getClientLocalMuteState();\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute, this.type === AUDIO)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /** Sets the mute state of the local track according to what server thinks is our state\n * @param {Object} meeting - the meeting object\n * @param {ServerMuteReason} serverMuteReason - reason why we're applying server mute to the local track\n * @returns {void}\n */\n private applyServerMuteToLocalTrack(meeting: any, serverMuteReason: ServerMuteReason) {\n const muted = this.state.server.localMute || this.state.server.remoteMute;\n\n // update the local track mute state, but not this.state.client.localMute\n this.muteLocalTrack(meeting, muted, serverMuteReason);\n }\n\n /** Applies the current value for unmute allowed to the underlying track\n *\n * @param {Meeting} meeting\n * @returns {void}\n */\n private applyUnmuteAllowedToTrack(meeting: any) {\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioTrack?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n } else {\n meeting.mediaProperties.videoTrack?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n }\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Meeting} meeting\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n if (unmuteAllowed !== undefined) {\n this.state.server.unmuteAllowed = unmuteAllowed;\n this.applyUnmuteAllowedToTrack(meeting);\n }\n if (muted !== undefined) {\n this.state.server.remoteMute = muted;\n this.applyServerMuteToLocalTrack(meeting, 'remotelyMuted');\n }\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting?: object) {\n if (!this.state.client.enabled) {\n LoggerProxy.logger.warn(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received while ${this.type} is disabled -> local unmute will not result in ${this.type} being sent`\n );\n } else {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute`\n );\n }\n\n // todo: I'm seeing \"you can now unmute yourself \" popup when this happens - but same thing happens on web.w.c so we can ignore for now\n this.state.server.remoteMute = false;\n this.state.client.localMute = false;\n\n this.applyClientStateLocally(meeting, 'localUnmuteRequired');\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted.\n * It only checks the mute status, ignoring the fact whether audio/video is enabled.\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isRemotelyMuted() {\n return this.state.server.remoteMute;\n }\n\n /**\n * Returns true if unmute is allowed\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isUnmuteAllowed() {\n return this.state.server.unmuteAllowed;\n }\n\n /**\n * Returns true if the user is locally muted or audio/video is disabled\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isLocallyMuted() {\n return this.getClientLocalMuteState();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA;AACA;AACA;AACA;AAEA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,IAAI,EAAEC,OAAO,EAAEC,OAAgB,EAAK;EAClE;;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,iDACoBL,IAAI,iDAAuCC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,EAAE,EAChG;EAED,IAAMC,SAAS,GAAG,IAAIC,SAAS,CAACR,IAAI,EAAEC,OAAO,EAAEC,OAAO,CAAC;EAEvD,OAAOK,SAAS;AAClB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAAA,IAOaC,SAAS;EAapB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,mBAAYR,IAAY,EAAEC,OAAY,EAAEC,OAAgB,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IACxD,IAAIF,IAAI,KAAKS,gBAAK,IAAIT,IAAI,KAAKU,gBAAK,EAAE;MACpC,MAAM,IAAIC,kBAAc,CAAC,yDAAyD,CAAC;IACrF;IACA,IAAI,CAACX,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACY,qBAAqB,GAAG,KAAK;IAClC,IAAI,CAACC,KAAK,GAAG;MACXC,MAAM,EAAE;QACNZ,OAAO,EAAPA,OAAO;QACPa,SAAS,EAAE;MACb,CAAC;MACDC,MAAM,EAAE;QACND,SAAS,EAAE,IAAI;QACf;QACAE,UAAU,EAAEjB,IAAI,KAAKS,gBAAK,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