@webex/plugin-meetings 3.0.0-beta.16 → 3.0.0-beta.161

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 (424) hide show
  1. package/README.md +45 -1
  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 +359 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +212 -0
  9. package/dist/breakouts/breakout.js.map +1 -0
  10. package/dist/breakouts/collection.js +23 -0
  11. package/dist/breakouts/collection.js.map +1 -0
  12. package/dist/breakouts/edit-lock-error.js +52 -0
  13. package/dist/breakouts/edit-lock-error.js.map +1 -0
  14. package/dist/breakouts/events.js +43 -0
  15. package/dist/breakouts/events.js.map +1 -0
  16. package/dist/breakouts/index.js +1046 -0
  17. package/dist/breakouts/index.js.map +1 -0
  18. package/dist/breakouts/request.js +78 -0
  19. package/dist/breakouts/request.js.map +1 -0
  20. package/dist/breakouts/utils.js +67 -0
  21. package/dist/breakouts/utils.js.map +1 -0
  22. package/dist/common/errors/webex-errors.js +3 -2
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/logs/logger-proxy.js +1 -1
  25. package/dist/common/logs/logger-proxy.js.map +1 -1
  26. package/dist/config.js +6 -8
  27. package/dist/config.js.map +1 -1
  28. package/dist/constants.js +175 -26
  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 +300 -0
  39. package/dist/controls-options-manager/util.js.map +1 -0
  40. package/dist/index.js +77 -0
  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 +214 -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 +92 -2
  49. package/dist/locus-info/controlsUtils.js.map +1 -1
  50. package/dist/locus-info/index.js +317 -24
  51. package/dist/locus-info/index.js.map +1 -1
  52. package/dist/locus-info/mediaSharesUtils.js +43 -1
  53. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  54. package/dist/locus-info/parser.js +2 -1
  55. package/dist/locus-info/parser.js.map +1 -1
  56. package/dist/locus-info/selfUtils.js +97 -14
  57. package/dist/locus-info/selfUtils.js.map +1 -1
  58. package/dist/media/index.js +39 -134
  59. package/dist/media/index.js.map +1 -1
  60. package/dist/media/properties.js +19 -97
  61. package/dist/media/properties.js.map +1 -1
  62. package/dist/mediaQualityMetrics/config.js +505 -493
  63. package/dist/mediaQualityMetrics/config.js.map +1 -1
  64. package/dist/meeting/in-meeting-actions.js +79 -1
  65. package/dist/meeting/in-meeting-actions.js.map +1 -1
  66. package/dist/meeting/index.js +2349 -2178
  67. package/dist/meeting/index.js.map +1 -1
  68. package/dist/meeting/locusMediaRequest.js +291 -0
  69. package/dist/meeting/locusMediaRequest.js.map +1 -0
  70. package/dist/meeting/muteState.js +229 -124
  71. package/dist/meeting/muteState.js.map +1 -1
  72. package/dist/meeting/request.js +191 -167
  73. package/dist/meeting/request.js.map +1 -1
  74. package/dist/meeting/request.type.js.map +1 -1
  75. package/dist/meeting/util.js +444 -443
  76. package/dist/meeting/util.js.map +1 -1
  77. package/dist/meeting-info/meeting-info-v2.js +157 -49
  78. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  79. package/dist/meeting-info/utilv2.js +20 -5
  80. package/dist/meeting-info/utilv2.js.map +1 -1
  81. package/dist/meetings/collection.js +22 -0
  82. package/dist/meetings/collection.js.map +1 -1
  83. package/dist/meetings/index.js +365 -73
  84. package/dist/meetings/index.js.map +1 -1
  85. package/dist/meetings/meetings.types.js +7 -0
  86. package/dist/meetings/meetings.types.js.map +1 -0
  87. package/dist/meetings/request.js +16 -12
  88. package/dist/meetings/request.js.map +1 -1
  89. package/dist/meetings/util.js +88 -1
  90. package/dist/meetings/util.js.map +1 -1
  91. package/dist/member/index.js +43 -0
  92. package/dist/member/index.js.map +1 -1
  93. package/dist/member/types.js +15 -0
  94. package/dist/member/types.js.map +1 -0
  95. package/dist/member/util.js +97 -3
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/collection.js +10 -0
  98. package/dist/members/collection.js.map +1 -1
  99. package/dist/members/index.js +94 -11
  100. package/dist/members/index.js.map +1 -1
  101. package/dist/members/request.js +109 -39
  102. package/dist/members/request.js.map +1 -1
  103. package/dist/members/types.js +15 -0
  104. package/dist/members/types.js.map +1 -0
  105. package/dist/members/util.js +316 -233
  106. package/dist/members/util.js.map +1 -1
  107. package/dist/metrics/config.js +50 -14
  108. package/dist/metrics/config.js.map +1 -1
  109. package/dist/metrics/constants.js +3 -5
  110. package/dist/metrics/constants.js.map +1 -1
  111. package/dist/metrics/index.js +48 -29
  112. package/dist/metrics/index.js.map +1 -1
  113. package/dist/multistream/mediaRequestManager.js +265 -36
  114. package/dist/multistream/mediaRequestManager.js.map +1 -1
  115. package/dist/multistream/receiveSlot.js +52 -19
  116. package/dist/multistream/receiveSlot.js.map +1 -1
  117. package/dist/multistream/receiveSlotManager.js +53 -33
  118. package/dist/multistream/receiveSlotManager.js.map +1 -1
  119. package/dist/multistream/remoteMedia.js +44 -18
  120. package/dist/multistream/remoteMedia.js.map +1 -1
  121. package/dist/multistream/remoteMediaGroup.js +60 -3
  122. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  123. package/dist/multistream/remoteMediaManager.js +322 -103
  124. package/dist/multistream/remoteMediaManager.js.map +1 -1
  125. package/dist/networkQualityMonitor/index.js +4 -2
  126. package/dist/networkQualityMonitor/index.js.map +1 -1
  127. package/dist/reachability/index.js +117 -60
  128. package/dist/reachability/index.js.map +1 -1
  129. package/dist/reachability/request.js +12 -5
  130. package/dist/reachability/request.js.map +1 -1
  131. package/dist/reactions/constants.js +13 -0
  132. package/dist/reactions/constants.js.map +1 -0
  133. package/dist/reactions/reactions.js +2 -2
  134. package/dist/reactions/reactions.js.map +1 -1
  135. package/dist/reactions/reactions.type.js +18 -18
  136. package/dist/reactions/reactions.type.js.map +1 -1
  137. package/dist/reconnection-manager/index.js +190 -145
  138. package/dist/reconnection-manager/index.js.map +1 -1
  139. package/dist/recording-controller/enums.js +17 -0
  140. package/dist/recording-controller/enums.js.map +1 -0
  141. package/dist/recording-controller/index.js +343 -0
  142. package/dist/recording-controller/index.js.map +1 -0
  143. package/dist/recording-controller/util.js +63 -0
  144. package/dist/recording-controller/util.js.map +1 -0
  145. package/dist/roap/index.js +21 -29
  146. package/dist/roap/index.js.map +1 -1
  147. package/dist/roap/request.js +127 -92
  148. package/dist/roap/request.js.map +1 -1
  149. package/dist/roap/turnDiscovery.js +135 -53
  150. package/dist/roap/turnDiscovery.js.map +1 -1
  151. package/dist/statsAnalyzer/global.js +1 -93
  152. package/dist/statsAnalyzer/global.js.map +1 -1
  153. package/dist/statsAnalyzer/index.js +329 -314
  154. package/dist/statsAnalyzer/index.js.map +1 -1
  155. package/dist/statsAnalyzer/mqaUtil.js +103 -54
  156. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  157. package/dist/types/annotation/annotation.types.d.ts +43 -0
  158. package/dist/types/annotation/constants.d.ts +31 -0
  159. package/dist/types/annotation/index.d.ts +124 -0
  160. package/dist/types/breakouts/breakout.d.ts +8 -0
  161. package/dist/types/breakouts/collection.d.ts +5 -0
  162. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  163. package/dist/types/breakouts/events.d.ts +2 -0
  164. package/dist/types/breakouts/index.d.ts +5 -0
  165. package/dist/types/breakouts/request.d.ts +22 -0
  166. package/dist/types/breakouts/utils.d.ts +15 -0
  167. package/dist/types/common/browser-detection.d.ts +9 -0
  168. package/dist/types/common/collection.d.ts +48 -0
  169. package/dist/types/common/config.d.ts +2 -0
  170. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  171. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  172. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  173. package/dist/types/common/errors/media.d.ts +15 -0
  174. package/dist/types/common/errors/parameter.d.ts +15 -0
  175. package/dist/types/common/errors/password-error.d.ts +15 -0
  176. package/dist/types/common/errors/permission.d.ts +14 -0
  177. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  178. package/dist/types/common/errors/reconnection.d.ts +15 -0
  179. package/dist/types/common/errors/stats.d.ts +15 -0
  180. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  181. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  182. package/dist/types/common/events/events-scope.d.ts +17 -0
  183. package/dist/types/common/events/events.d.ts +12 -0
  184. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  185. package/dist/types/common/events/util.d.ts +2 -0
  186. package/dist/types/common/logs/logger-config.d.ts +2 -0
  187. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  188. package/dist/types/common/logs/request.d.ts +34 -0
  189. package/dist/types/common/queue.d.ts +32 -0
  190. package/dist/types/config.d.ts +72 -0
  191. package/dist/types/constants.d.ts +987 -0
  192. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  193. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  194. package/dist/types/controls-options-manager/index.d.ts +136 -0
  195. package/dist/types/controls-options-manager/types.d.ts +43 -0
  196. package/dist/types/controls-options-manager/util.d.ts +1 -0
  197. package/dist/types/index.d.ts +7 -0
  198. package/dist/types/interpretation/collection.d.ts +5 -0
  199. package/dist/types/interpretation/index.d.ts +5 -0
  200. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  201. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  202. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  203. package/dist/types/locus-info/fullState.d.ts +2 -0
  204. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  205. package/dist/types/locus-info/index.d.ts +315 -0
  206. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  207. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  208. package/dist/types/locus-info/parser.d.ts +212 -0
  209. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  210. package/dist/types/media/index.d.ts +34 -0
  211. package/dist/types/media/properties.d.ts +86 -0
  212. package/dist/types/media/util.d.ts +2 -0
  213. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  214. package/dist/types/meeting/in-meeting-actions.d.ts +149 -0
  215. package/dist/types/meeting/index.d.ts +1524 -0
  216. package/dist/types/meeting/locusMediaRequest.d.ts +70 -0
  217. package/dist/types/meeting/muteState.d.ts +184 -0
  218. package/dist/types/meeting/request.d.ts +270 -0
  219. package/dist/types/meeting/request.type.d.ts +11 -0
  220. package/dist/types/meeting/state.d.ts +9 -0
  221. package/dist/types/meeting/util.d.ts +75 -0
  222. package/dist/types/meeting-info/collection.d.ts +20 -0
  223. package/dist/types/meeting-info/index.d.ts +57 -0
  224. package/dist/types/meeting-info/meeting-info-v2.d.ts +122 -0
  225. package/dist/types/meeting-info/request.d.ts +22 -0
  226. package/dist/types/meeting-info/util.d.ts +2 -0
  227. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  228. package/dist/types/meetings/collection.d.ts +31 -0
  229. package/dist/types/meetings/index.d.ts +364 -0
  230. package/dist/types/meetings/meetings.types.d.ts +4 -0
  231. package/dist/types/meetings/request.d.ts +27 -0
  232. package/dist/types/meetings/util.d.ts +18 -0
  233. package/dist/types/member/index.d.ts +158 -0
  234. package/dist/types/member/types.d.ts +21 -0
  235. package/dist/types/member/util.d.ts +2 -0
  236. package/dist/types/members/collection.d.ts +29 -0
  237. package/dist/types/members/index.d.ts +353 -0
  238. package/dist/types/members/request.d.ts +114 -0
  239. package/dist/types/members/types.d.ts +24 -0
  240. package/dist/types/members/util.d.ts +210 -0
  241. package/dist/types/metrics/config.d.ts +195 -0
  242. package/dist/types/metrics/constants.d.ts +55 -0
  243. package/dist/types/metrics/index.d.ts +169 -0
  244. package/dist/types/multistream/mediaRequestManager.d.ts +118 -0
  245. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  246. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  247. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  248. package/dist/types/multistream/remoteMediaGroup.d.ts +47 -0
  249. package/dist/types/multistream/remoteMediaManager.d.ts +277 -0
  250. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  251. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  252. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  253. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  254. package/dist/types/reachability/index.d.ts +152 -0
  255. package/dist/types/reachability/request.d.ts +37 -0
  256. package/dist/types/reactions/constants.d.ts +3 -0
  257. package/dist/types/reactions/reactions.d.ts +4 -0
  258. package/dist/types/reactions/reactions.type.d.ts +52 -0
  259. package/dist/types/reconnection-manager/index.d.ts +126 -0
  260. package/dist/types/recording-controller/enums.d.ts +7 -0
  261. package/dist/types/recording-controller/index.d.ts +193 -0
  262. package/dist/types/recording-controller/util.d.ts +13 -0
  263. package/dist/types/roap/index.d.ts +77 -0
  264. package/dist/types/roap/request.d.ts +36 -0
  265. package/dist/types/roap/turnDiscovery.d.ts +91 -0
  266. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  267. package/dist/types/statsAnalyzer/index.d.ts +200 -0
  268. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  269. package/dist/types/transcription/index.d.ts +64 -0
  270. package/package.json +28 -21
  271. package/src/annotation/annotation.types.ts +52 -0
  272. package/src/annotation/constants.ts +36 -0
  273. package/src/annotation/index.ts +343 -0
  274. package/src/breakouts/README.md +220 -0
  275. package/src/breakouts/breakout.ts +180 -0
  276. package/src/breakouts/collection.ts +19 -0
  277. package/src/breakouts/edit-lock-error.ts +25 -0
  278. package/src/breakouts/events.ts +37 -0
  279. package/src/breakouts/index.ts +921 -0
  280. package/src/breakouts/request.ts +55 -0
  281. package/src/breakouts/utils.ts +57 -0
  282. package/src/common/errors/webex-errors.ts +6 -2
  283. package/src/common/logs/logger-proxy.ts +1 -1
  284. package/src/config.ts +5 -7
  285. package/src/constants.ts +165 -20
  286. package/src/controls-options-manager/constants.ts +5 -0
  287. package/src/controls-options-manager/enums.ts +18 -0
  288. package/src/controls-options-manager/index.ts +278 -0
  289. package/src/controls-options-manager/types.ts +59 -0
  290. package/src/controls-options-manager/util.ts +286 -0
  291. package/src/index.ts +34 -0
  292. package/src/interpretation/README.md +51 -0
  293. package/src/interpretation/collection.ts +19 -0
  294. package/src/interpretation/index.ts +182 -0
  295. package/src/interpretation/siLanguage.ts +18 -0
  296. package/src/locus-info/controlsUtils.ts +110 -0
  297. package/src/locus-info/index.ts +339 -21
  298. package/src/locus-info/mediaSharesUtils.ts +48 -0
  299. package/src/locus-info/parser.ts +2 -1
  300. package/src/locus-info/selfUtils.ts +86 -2
  301. package/src/media/index.ts +70 -142
  302. package/src/media/properties.ts +41 -104
  303. package/src/mediaQualityMetrics/config.ts +379 -377
  304. package/src/meeting/in-meeting-actions.ts +156 -0
  305. package/src/meeting/index.ts +1779 -1741
  306. package/src/meeting/locusMediaRequest.ts +309 -0
  307. package/src/meeting/muteState.ts +228 -132
  308. package/src/meeting/request.ts +100 -91
  309. package/src/meeting/request.type.ts +2 -0
  310. package/src/meeting/util.ts +422 -421
  311. package/src/meeting-info/meeting-info-v2.ts +134 -13
  312. package/src/meeting-info/utilv2.ts +13 -3
  313. package/src/meetings/collection.ts +20 -0
  314. package/src/meetings/index.ts +385 -83
  315. package/src/meetings/meetings.types.ts +12 -0
  316. package/src/meetings/request.ts +3 -1
  317. package/src/meetings/util.ts +103 -4
  318. package/src/member/index.ts +42 -0
  319. package/src/member/types.ts +24 -0
  320. package/src/member/util.ts +95 -1
  321. package/src/members/collection.ts +8 -0
  322. package/src/members/index.ts +108 -6
  323. package/src/members/request.ts +98 -17
  324. package/src/members/types.ts +28 -0
  325. package/src/members/util.ts +319 -240
  326. package/src/metrics/config.ts +49 -10
  327. package/src/metrics/constants.ts +2 -4
  328. package/src/metrics/index.ts +43 -27
  329. package/src/multistream/mediaRequestManager.ts +337 -63
  330. package/src/multistream/receiveSlot.ts +68 -26
  331. package/src/multistream/receiveSlotManager.ts +61 -38
  332. package/src/multistream/remoteMedia.ts +29 -3
  333. package/src/multistream/remoteMediaGroup.ts +61 -2
  334. package/src/multistream/remoteMediaManager.ts +260 -66
  335. package/src/networkQualityMonitor/index.ts +6 -6
  336. package/src/reachability/index.ts +75 -25
  337. package/src/reachability/request.ts +10 -5
  338. package/src/reactions/constants.ts +4 -0
  339. package/src/reactions/reactions.ts +4 -4
  340. package/src/reactions/reactions.type.ts +28 -3
  341. package/src/reconnection-manager/index.ts +53 -32
  342. package/src/recording-controller/enums.ts +8 -0
  343. package/src/recording-controller/index.ts +315 -0
  344. package/src/recording-controller/util.ts +58 -0
  345. package/src/roap/index.ts +21 -30
  346. package/src/roap/request.ts +51 -52
  347. package/src/roap/turnDiscovery.ts +51 -27
  348. package/src/statsAnalyzer/global.ts +1 -94
  349. package/src/statsAnalyzer/index.ts +380 -390
  350. package/src/statsAnalyzer/mqaUtil.ts +106 -99
  351. package/test/integration/spec/converged-space-meetings.js +233 -0
  352. package/test/integration/spec/journey.js +331 -254
  353. package/test/integration/spec/space-meeting.js +77 -4
  354. package/test/unit/spec/annotation/index.ts +436 -0
  355. package/test/unit/spec/breakouts/breakout.ts +233 -0
  356. package/test/unit/spec/breakouts/collection.ts +15 -0
  357. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  358. package/test/unit/spec/breakouts/events.ts +77 -0
  359. package/test/unit/spec/breakouts/index.ts +1790 -0
  360. package/test/unit/spec/breakouts/request.ts +104 -0
  361. package/test/unit/spec/breakouts/utils.js +72 -0
  362. package/test/unit/spec/controls-options-manager/index.js +287 -0
  363. package/test/unit/spec/controls-options-manager/util.js +518 -0
  364. package/test/unit/spec/fixture/locus.js +1 -0
  365. package/test/unit/spec/interpretation/collection.ts +15 -0
  366. package/test/unit/spec/interpretation/index.ts +329 -0
  367. package/test/unit/spec/interpretation/siLanguage.ts +26 -0
  368. package/test/unit/spec/locus-info/controlsUtils.js +323 -30
  369. package/test/unit/spec/locus-info/index.js +680 -4
  370. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  371. package/test/unit/spec/locus-info/selfConstant.js +48 -0
  372. package/test/unit/spec/locus-info/selfUtils.js +275 -0
  373. package/test/unit/spec/media/index.ts +118 -22
  374. package/test/unit/spec/media/properties.ts +9 -9
  375. package/test/unit/spec/meeting/in-meeting-actions.ts +76 -0
  376. package/test/unit/spec/meeting/index.js +2695 -1513
  377. package/test/unit/spec/meeting/locusMediaRequest.ts +436 -0
  378. package/test/unit/spec/meeting/muteState.js +370 -208
  379. package/test/unit/spec/meeting/request.js +354 -42
  380. package/test/unit/spec/meeting/utils.js +270 -156
  381. package/test/unit/spec/meeting-info/meetinginfov2.js +383 -5
  382. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  383. package/test/unit/spec/meetings/collection.js +14 -0
  384. package/test/unit/spec/meetings/index.js +866 -120
  385. package/test/unit/spec/meetings/utils.js +206 -2
  386. package/test/unit/spec/member/index.js +31 -0
  387. package/test/unit/spec/member/util.js +408 -32
  388. package/test/unit/spec/members/index.js +320 -1
  389. package/test/unit/spec/members/request.js +206 -27
  390. package/test/unit/spec/members/utils.js +184 -0
  391. package/test/unit/spec/metrics/index.js +98 -0
  392. package/test/unit/spec/multistream/mediaRequestManager.ts +1012 -109
  393. package/test/unit/spec/multistream/receiveSlot.ts +77 -18
  394. package/test/unit/spec/multistream/receiveSlotManager.ts +69 -39
  395. package/test/unit/spec/multistream/remoteMedia.ts +32 -2
  396. package/test/unit/spec/multistream/remoteMediaGroup.ts +271 -5
  397. package/test/unit/spec/multistream/remoteMediaManager.ts +672 -65
  398. package/test/unit/spec/networkQualityMonitor/index.js +4 -4
  399. package/test/unit/spec/reachability/index.ts +176 -25
  400. package/test/unit/spec/reachability/request.js +66 -0
  401. package/test/unit/spec/reconnection-manager/index.js +46 -13
  402. package/test/unit/spec/recording-controller/index.js +231 -0
  403. package/test/unit/spec/recording-controller/util.js +102 -0
  404. package/test/unit/spec/roap/index.ts +21 -51
  405. package/test/unit/spec/roap/request.ts +187 -0
  406. package/test/unit/spec/roap/turnDiscovery.ts +73 -34
  407. package/test/unit/spec/stats-analyzer/index.js +94 -43
  408. package/test/utils/constants.js +9 -0
  409. package/test/utils/integrationTestUtils.js +46 -0
  410. package/test/utils/testUtils.js +0 -45
  411. package/test/utils/webex-config.js +4 -0
  412. package/test/utils/webex-test-users.js +7 -3
  413. package/tsconfig.json +6 -0
  414. package/dist/media/internal-media-core-wrapper.js +0 -18
  415. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  416. package/dist/meeting/effectsState.js +0 -262
  417. package/dist/meeting/effectsState.js.map +0 -1
  418. package/dist/multistream/multistreamMedia.js +0 -106
  419. package/dist/multistream/multistreamMedia.js.map +0 -1
  420. package/src/index.js +0 -15
  421. package/src/media/internal-media-core-wrapper.ts +0 -9
  422. package/src/meeting/effectsState.ts +0 -211
  423. package/src/multistream/multistreamMedia.ts +0 -93
  424. package/test/unit/spec/meeting/effectsState.js +0 -281
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.ReceiveSlotEvents = exports.ReceiveSlot = void 0;
10
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
10
11
  var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
11
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -25,7 +26,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
25
26
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
26
27
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
27
28
  var ReceiveSlotEvents = {
28
- SourceUpdate: 'sourceUpdate'
29
+ SourceUpdate: 'sourceUpdate',
30
+ MaxFsUpdate: 'maxFsUpdate'
29
31
  };
30
32
  exports.ReceiveSlotEvents = ReceiveSlotEvents;
31
33
  var receiveSlotCounter = 0;
@@ -43,8 +45,8 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
43
45
  * constructor - don't use it directly, you should always use meeting.receiveSlotManager.allocateSlot()
44
46
  * to create any receive slots
45
47
  *
46
- * @param {MC.MediaType} mediaType
47
- * @param {MC.ReceiveSlot} mcReceiveSlot
48
+ * @param {MediaType} mediaType
49
+ * @param {ReceiveSlot} mcReceiveSlot
48
50
  * @param {FindMemberIdCallback} findMemberIdCallback callback for finding memberId for given CSI
49
51
  */
50
52
  function ReceiveSlot(mediaType, mcReceiveSlot, findMemberIdCallback) {
@@ -95,6 +97,23 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
95
97
  return (0, _classPrivateFieldGet2.default)(this, _csi);
96
98
  }
97
99
 
100
+ /**
101
+ * Set the max frame size for this slot
102
+ * @param newFs frame size
103
+ */
104
+ }, {
105
+ key: "setMaxFs",
106
+ value: function setMaxFs(newFs) {
107
+ // emit event for media request manager to listen to
108
+
109
+ this.emit({
110
+ file: 'meeting/receiveSlot',
111
+ function: 'findMemberId'
112
+ }, ReceiveSlotEvents.MaxFsUpdate, {
113
+ maxFs: newFs
114
+ });
115
+ }
116
+
98
117
  /**
99
118
  * Getter for sourceState
100
119
  */
@@ -115,7 +134,7 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
115
134
  file: 'meeting/receiveSlot',
116
135
  function: 'setupEventListeners'
117
136
  };
118
- this.mcReceiveSlot.on(_internalMediaCore.MediaConnection.ReceiveSlotEvents.SourceUpdate, function (state, csi) {
137
+ this.mcReceiveSlot.on(_internalMediaCore.ReceiveSlotEvents.SourceUpdate, function (state, csi) {
119
138
  _loggerProxy.default.logger.log("ReceiveSlot#setupEventListeners --> got source update on receive slot ".concat(_this2.id, ", mediaType=").concat(_this2.mediaType, ", csi=").concat(csi, ", state=").concat(state));
120
139
  (0, _classPrivateFieldSet2.default)(_this2, _memberId, csi ? _this2.findMemberIdCallback(csi) : undefined);
121
140
  (0, _classPrivateFieldSet2.default)(_this2, _csi, csi);
@@ -128,6 +147,35 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
128
147
  });
129
148
  }
130
149
 
150
+ /** Tries to find the member id for this receive slot if it hasn't got one */
151
+ }, {
152
+ key: "findMemberId",
153
+ value: function findMemberId() {
154
+ if ((0, _classPrivateFieldGet2.default)(this, _memberId) === undefined && (0, _classPrivateFieldGet2.default)(this, _csi)) {
155
+ (0, _classPrivateFieldSet2.default)(this, _memberId, this.findMemberIdCallback((0, _classPrivateFieldGet2.default)(this, _csi)));
156
+ if ((0, _classPrivateFieldGet2.default)(this, _memberId)) {
157
+ // if we found the memberId, simulate source update so that the client app knows that something's changed
158
+ this.emit({
159
+ file: 'meeting/receiveSlot',
160
+ function: 'findMemberId'
161
+ }, ReceiveSlotEvents.SourceUpdate, {
162
+ state: (0, _classPrivateFieldGet2.default)(this, _sourceState),
163
+ csi: (0, _classPrivateFieldGet2.default)(this, _csi),
164
+ memberId: (0, _classPrivateFieldGet2.default)(this, _memberId)
165
+ });
166
+ }
167
+ }
168
+ }
169
+
170
+ /**
171
+ * @returns {string} a log message used to identify the receive slot
172
+ */
173
+ }, {
174
+ key: "logString",
175
+ get: function get() {
176
+ return "ReceiveSlot - ".concat(this.id, ": ").concat((0, _stringify.default)(this.mcReceiveSlot.id));
177
+ }
178
+
131
179
  /**
132
180
  * The MediaStream object associated with this slot.
133
181
  *
@@ -147,21 +195,6 @@ var ReceiveSlot = /*#__PURE__*/function (_EventsScope) {
147
195
  get: function get() {
148
196
  return this.mcReceiveSlot;
149
197
  }
150
-
151
- /**
152
- * Resets the source state to the default 'no source' value.
153
- * This function should be called on receive slots that are
154
- * no longer part of a media request. It's needed because WCME
155
- * does not send any more events on such slots, so the sourceState
156
- * value would not represent the truth anymore.
157
- */
158
- }, {
159
- key: "resetSourceState",
160
- value: function resetSourceState() {
161
- (0, _classPrivateFieldSet2.default)(this, _sourceState, 'no source');
162
- (0, _classPrivateFieldSet2.default)(this, _csi, undefined);
163
- (0, _classPrivateFieldSet2.default)(this, _memberId, undefined);
164
- }
165
198
  }]);
166
199
  return ReceiveSlot;
167
200
  }(_eventsScope.default);
@@ -1 +1 @@
1
- {"version":3,"names":["ReceiveSlotEvents","SourceUpdate","receiveSlotCounter","ReceiveSlot","mediaType","mcReceiveSlot","findMemberIdCallback","id","setupEventListeners","scope","file","function","on","MC","state","csi","LoggerProxy","logger","log","undefined","emit","memberId","stream","EventsScope"],"sources":["receiveSlot.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {MediaConnection as MC} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nexport const ReceiveSlotEvents = {\n SourceUpdate: 'sourceUpdate',\n};\n\nexport type SourceState = MC.SourceState;\nexport type CSI = number;\nexport type MemberId = string;\nexport type ReceiveSlotId = string;\n\nlet receiveSlotCounter = 0;\n\nexport type FindMemberIdCallback = (csi: CSI) => MemberId | undefined;\n\n/**\n * Class representing a receive slot. A single receive slot is able to receive a single track\n * for example some participant's main video or audio\n */\nexport class ReceiveSlot extends EventsScope {\n private readonly mcReceiveSlot: MC.ReceiveSlot;\n\n private readonly findMemberIdCallback: FindMemberIdCallback;\n\n public readonly id: ReceiveSlotId;\n\n public readonly mediaType: MC.MediaType;\n\n #memberId?: MemberId;\n\n #csi?: CSI;\n\n #sourceState: MC.SourceState;\n\n /**\n * constructor - don't use it directly, you should always use meeting.receiveSlotManager.allocateSlot()\n * to create any receive slots\n *\n * @param {MC.MediaType} mediaType\n * @param {MC.ReceiveSlot} mcReceiveSlot\n * @param {FindMemberIdCallback} findMemberIdCallback callback for finding memberId for given CSI\n */\n constructor(\n mediaType: MC.MediaType,\n mcReceiveSlot: MC.ReceiveSlot,\n findMemberIdCallback: FindMemberIdCallback\n ) {\n super();\n\n receiveSlotCounter += 1;\n\n this.findMemberIdCallback = findMemberIdCallback;\n this.mediaType = mediaType;\n this.mcReceiveSlot = mcReceiveSlot;\n this.#sourceState = 'no source';\n this.id = `r${receiveSlotCounter}`;\n\n this.setupEventListeners();\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.#memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.#csi;\n }\n\n /**\n * Getter for sourceState\n */\n public get sourceState() {\n return this.#sourceState;\n }\n\n /**\n * registers event handlers with the underlying ReceiveSlot\n */\n setupEventListeners() {\n const scope = {\n file: 'meeting/receiveSlot',\n function: 'setupEventListeners',\n };\n\n this.mcReceiveSlot.on(\n MC.ReceiveSlotEvents.SourceUpdate,\n (state: MC.SourceState, csi?: number) => {\n LoggerProxy.logger.log(\n `ReceiveSlot#setupEventListeners --> got source update on receive slot ${this.id}, mediaType=${this.mediaType}, csi=${csi}, state=${state}`\n );\n this.#memberId = csi ? this.findMemberIdCallback(csi) : undefined;\n this.#csi = csi;\n this.#sourceState = state;\n\n this.emit(scope, ReceiveSlotEvents.SourceUpdate, {\n state: this.#sourceState,\n csi: this.#csi,\n memberId: this.#memberId,\n });\n }\n );\n }\n\n /**\n * The MediaStream object associated with this slot.\n *\n * @returns {MediaStream} The MediaStreamTrack.\n */\n get stream(): MediaStream {\n return this.mcReceiveSlot.stream;\n }\n\n /**\n * The underlying WCME receive slot\n */\n get wcmeReceiveSlot(): MC.ReceiveSlot {\n return this.mcReceiveSlot;\n }\n\n /**\n * Resets the source state to the default 'no source' value.\n * This function should be called on receive slots that are\n * no longer part of a media request. It's needed because WCME\n * does not send any more events on such slots, so the sourceState\n * value would not represent the truth anymore.\n */\n public resetSourceState() {\n this.#sourceState = 'no source';\n this.#csi = undefined;\n this.#memberId = undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAEA;AACA;AAAwD;AAAA;AAAA;AAAA;AAEjD,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAE;AAChB,CAAC;AAAC;AAOF,IAAIC,kBAAkB,GAAG,CAAC;AAAC;AAAA;AAAA;AAI3B;AACA;AACA;AACA;AAHA,IAIaC,WAAW;EAAA;EAAA;EAetB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,qBACEC,SAAuB,EACvBC,aAA6B,EAC7BC,oBAA0C,EAC1C;IAAA;IAAA;IACA;IAAQ;IAAA;IAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAERJ,kBAAkB,IAAI,CAAC;IAEvB,MAAKI,oBAAoB,GAAGA,oBAAoB;IAChD,MAAKF,SAAS,GAAGA,SAAS;IAC1B,MAAKC,aAAa,GAAGA,aAAa;IAClC,+FAAoB,WAAW;IAC/B,MAAKE,EAAE,cAAOL,kBAAkB,CAAE;IAElC,MAAKM,mBAAmB,EAAE;IAAC;EAC7B;;EAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAsB;MACpB,2CAAO,IAAI;IACb;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAiB;MACf,2CAAO,IAAI;IACb;;IAEA;AACF;AACA;EAFE;IAAA;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","mediaType","mcReceiveSlot","findMemberIdCallback","id","setupEventListeners","newFs","emit","file","function","maxFs","scope","on","WcmeReceiveSlotEvents","state","csi","LoggerProxy","logger","log","undefined","memberId","stream","EventsScope"],"sources":["receiveSlot.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {\n MediaType,\n ReceiveSlot as WcmeReceiveSlot,\n ReceiveSlotEvents as WcmeReceiveSlotEvents,\n StreamState,\n} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nexport const ReceiveSlotEvents = {\n SourceUpdate: 'sourceUpdate',\n MaxFsUpdate: 'maxFsUpdate',\n};\n\nexport type {StreamState} from '@webex/internal-media-core';\nexport type CSI = number;\nexport type MemberId = string;\nexport type ReceiveSlotId = string;\n\nlet receiveSlotCounter = 0;\n\nexport type FindMemberIdCallback = (csi: CSI) => MemberId | undefined;\n\n/**\n * Class representing a receive slot. A single receive slot is able to receive a single track\n * for example some participant's main video or audio\n */\nexport class ReceiveSlot extends EventsScope {\n private readonly mcReceiveSlot: WcmeReceiveSlot;\n\n private readonly findMemberIdCallback: FindMemberIdCallback;\n\n public readonly id: ReceiveSlotId;\n\n public readonly mediaType: MediaType;\n\n #memberId?: MemberId;\n\n #csi?: CSI;\n\n #sourceState: StreamState;\n\n /**\n * constructor - don't use it directly, you should always use meeting.receiveSlotManager.allocateSlot()\n * to create any receive slots\n *\n * @param {MediaType} mediaType\n * @param {ReceiveSlot} mcReceiveSlot\n * @param {FindMemberIdCallback} findMemberIdCallback callback for finding memberId for given CSI\n */\n constructor(\n mediaType: MediaType,\n mcReceiveSlot: WcmeReceiveSlot,\n findMemberIdCallback: FindMemberIdCallback\n ) {\n super();\n\n receiveSlotCounter += 1;\n\n this.findMemberIdCallback = findMemberIdCallback;\n this.mediaType = mediaType;\n this.mcReceiveSlot = mcReceiveSlot;\n this.#sourceState = 'no source';\n this.id = `r${receiveSlotCounter}`;\n\n this.setupEventListeners();\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.#memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.#csi;\n }\n\n /**\n * Set the max frame size for this slot\n * @param newFs frame size\n */\n public setMaxFs(newFs) {\n // emit event for media request manager to listen to\n\n this.emit(\n {\n file: 'meeting/receiveSlot',\n function: 'findMemberId',\n },\n ReceiveSlotEvents.MaxFsUpdate,\n {\n maxFs: newFs,\n }\n );\n }\n\n /**\n * Getter for sourceState\n */\n public get sourceState() {\n return this.#sourceState;\n }\n\n /**\n * registers event handlers with the underlying ReceiveSlot\n */\n private setupEventListeners() {\n const scope = {\n file: 'meeting/receiveSlot',\n function: 'setupEventListeners',\n };\n\n this.mcReceiveSlot.on(\n WcmeReceiveSlotEvents.SourceUpdate,\n (state: StreamState, csi?: number) => {\n LoggerProxy.logger.log(\n `ReceiveSlot#setupEventListeners --> got source update on receive slot ${this.id}, mediaType=${this.mediaType}, csi=${csi}, state=${state}`\n );\n this.#memberId = csi ? this.findMemberIdCallback(csi) : undefined;\n this.#csi = csi;\n this.#sourceState = state;\n\n this.emit(scope, ReceiveSlotEvents.SourceUpdate, {\n state: this.#sourceState,\n csi: this.#csi,\n memberId: this.#memberId,\n });\n }\n );\n }\n\n /** Tries to find the member id for this receive slot if it hasn't got one */\n public findMemberId() {\n if (this.#memberId === undefined && this.#csi) {\n this.#memberId = this.findMemberIdCallback(this.#csi);\n\n if (this.#memberId) {\n // if we found the memberId, simulate source update so that the client app knows that something's changed\n this.emit(\n {\n file: 'meeting/receiveSlot',\n function: 'findMemberId',\n },\n ReceiveSlotEvents.SourceUpdate,\n {\n state: this.#sourceState,\n csi: this.#csi,\n memberId: this.#memberId,\n }\n );\n }\n }\n }\n\n /**\n * @returns {string} a log message used to identify the receive slot\n */\n public get logString() {\n return `ReceiveSlot - ${this.id}: ${JSON.stringify(this.mcReceiveSlot.id)}`;\n }\n\n /**\n * The MediaStream object associated with this slot.\n *\n * @returns {MediaStream} The MediaStreamTrack.\n */\n get stream(): MediaStream {\n return this.mcReceiveSlot.stream;\n }\n\n /**\n * The underlying WCME receive slot\n */\n get wcmeReceiveSlot(): WcmeReceiveSlot {\n return this.mcReceiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;AAOA;AACA;AAAwD;AAAA;AAAA;AAAA;AAEjD,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAE,cAAc;EAC5BC,WAAW,EAAE;AACf,CAAC;AAAC;AAOF,IAAIC,kBAAkB,GAAG,CAAC;AAAC;AAAA;AAAA;AAI3B;AACA;AACA;AACA;AAHA,IAIaC,WAAW;EAAA;EAAA;EAetB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,qBACEC,SAAoB,EACpBC,aAA8B,EAC9BC,oBAA0C,EAC1C;IAAA;IAAA;IACA;IAAQ;IAAA;IAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IAERJ,kBAAkB,IAAI,CAAC;IAEvB,MAAKI,oBAAoB,GAAGA,oBAAoB;IAChD,MAAKF,SAAS,GAAGA,SAAS;IAC1B,MAAKC,aAAa,GAAGA,aAAa;IAClC,+FAAoB,WAAW;IAC/B,MAAKE,EAAE,cAAOL,kBAAkB,CAAE;IAElC,MAAKM,mBAAmB,EAAE;IAAC;EAC7B;;EAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAsB;MACpB,2CAAO,IAAI;IACb;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAiB;MACf,2CAAO,IAAI;IACb;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,kBAAgBC,KAAK,EAAE;MACrB;;MAEA,IAAI,CAACC,IAAI,CACP;QACEC,IAAI,EAAE,qBAAqB;QAC3BC,QAAQ,EAAE;MACZ,CAAC,EACDb,iBAAiB,CAACE,WAAW,EAC7B;QACEY,KAAK,EAAEJ;MACT,CAAC,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AEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAuB;MACrB,+BAAwB,IAAI,CAAChB,EAAE,eAAK,wBAAe,IAAI,CAACF,aAAa,CAACE,EAAE,CAAC;IAC3E;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,KAKA,eAA0B;MACxB,OAAO,IAAI,CAACF,aAAa,CAACmB,MAAM;IAClC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAuC;MACrC,OAAO,IAAI,CAACnB,aAAa;IAC3B;EAAC;EAAA;AAAA,EAzJ8BoB,oBAAW;AAAA"}
@@ -6,9 +6,9 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.ReceiveSlotManager = void 0;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
10
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
9
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
10
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
13
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
14
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -27,62 +27,52 @@ var ReceiveSlotManager = /*#__PURE__*/function () {
27
27
  * Constructor
28
28
  * @param {Meeting} meeting
29
29
  */
30
- function ReceiveSlotManager(meeting) {
30
+ function ReceiveSlotManager(createSlotCallback, findMemberIdByCsiCallback) {
31
31
  var _this$allocatedSlots, _this$freeSlots;
32
32
  (0, _classCallCheck2.default)(this, ReceiveSlotManager);
33
33
  (0, _defineProperty2.default)(this, "allocatedSlots", void 0);
34
34
  (0, _defineProperty2.default)(this, "freeSlots", void 0);
35
- (0, _defineProperty2.default)(this, "meeting", void 0);
36
- this.allocatedSlots = (_this$allocatedSlots = {}, (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaConnection.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaConnection.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaConnection.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaConnection.MediaType.VideoSlides, []), _this$allocatedSlots);
37
- this.freeSlots = (_this$freeSlots = {}, (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaConnection.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaConnection.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaConnection.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaConnection.MediaType.VideoSlides, []), _this$freeSlots);
38
- this.meeting = meeting;
35
+ (0, _defineProperty2.default)(this, "createSlotCallback", void 0);
36
+ (0, _defineProperty2.default)(this, "findMemberIdByCsiCallback", void 0);
37
+ this.allocatedSlots = (_this$allocatedSlots = {}, (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$allocatedSlots, _internalMediaCore.MediaType.VideoSlides, []), _this$allocatedSlots);
38
+ this.freeSlots = (_this$freeSlots = {}, (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$freeSlots, _internalMediaCore.MediaType.VideoSlides, []), _this$freeSlots);
39
+ this.createSlotCallback = createSlotCallback;
40
+ this.findMemberIdByCsiCallback = findMemberIdByCsiCallback;
39
41
  }
40
42
 
41
43
  /**
42
44
  * Creates a new receive slot or returns one from the existing pool of free slots
43
45
  *
44
- * @param {MC.MediaType} mediaType
46
+ * @param {MediaType} mediaType
45
47
  * @returns {Promise<ReceiveSlot>}
46
48
  */
47
49
  (0, _createClass2.default)(ReceiveSlotManager, [{
48
50
  key: "allocateSlot",
49
51
  value: function () {
50
52
  var _allocateSlot = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(mediaType) {
51
- var _this$meeting,
52
- _this$meeting$mediaPr,
53
- _this = this;
54
53
  var availableSlot, wcmeReceiveSlot, receiveSlot;
55
54
  return _regenerator.default.wrap(function _callee$(_context) {
56
55
  while (1) switch (_context.prev = _context.next) {
57
56
  case 0:
58
- if ((_this$meeting = this.meeting) !== null && _this$meeting !== void 0 && (_this$meeting$mediaPr = _this$meeting.mediaProperties) !== null && _this$meeting$mediaPr !== void 0 && _this$meeting$mediaPr.webrtcMediaConnection) {
59
- _context.next = 2;
60
- break;
61
- }
62
- return _context.abrupt("return", _promise.default.reject(new Error('Webrtc media connection is missing')));
63
- case 2:
64
57
  // try to use one of the free ones
65
58
  availableSlot = this.freeSlots[mediaType].pop();
66
59
  if (!availableSlot) {
67
- _context.next = 7;
60
+ _context.next = 5;
68
61
  break;
69
62
  }
70
63
  this.allocatedSlots[mediaType].push(availableSlot);
71
64
  _loggerProxy.default.logger.log("receive slot re-used: ".concat(availableSlot.id));
72
65
  return _context.abrupt("return", availableSlot);
66
+ case 5:
67
+ _context.next = 7;
68
+ return this.createSlotCallback(mediaType);
73
69
  case 7:
74
- _context.next = 9;
75
- return this.meeting.mediaProperties.webrtcMediaConnection.createReceiveSlot(mediaType);
76
- case 9:
77
70
  wcmeReceiveSlot = _context.sent;
78
- receiveSlot = new _receiveSlot.ReceiveSlot(mediaType, wcmeReceiveSlot, function (csi) {
79
- var _this$meeting$members;
80
- return (_this$meeting$members = _this.meeting.members.findMemberByCsi(csi)) === null || _this$meeting$members === void 0 ? void 0 : _this$meeting$members.id;
81
- });
71
+ receiveSlot = new _receiveSlot.ReceiveSlot(mediaType, wcmeReceiveSlot, this.findMemberIdByCsiCallback);
82
72
  this.allocatedSlots[mediaType].push(receiveSlot);
83
73
  _loggerProxy.default.logger.log("new receive slot allocated: ".concat(receiveSlot.id));
84
74
  return _context.abrupt("return", receiveSlot);
85
- case 14:
75
+ case 12:
86
76
  case "end":
87
77
  return _context.stop();
88
78
  }
@@ -119,8 +109,8 @@ var ReceiveSlotManager = /*#__PURE__*/function () {
119
109
  key: "reset",
120
110
  value: function reset() {
121
111
  var _this$allocatedSlots2, _this$freeSlots2;
122
- this.allocatedSlots = (_this$allocatedSlots2 = {}, (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaConnection.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaConnection.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaConnection.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaConnection.MediaType.VideoSlides, []), _this$allocatedSlots2);
123
- this.freeSlots = (_this$freeSlots2 = {}, (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaConnection.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaConnection.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaConnection.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaConnection.MediaType.VideoSlides, []), _this$freeSlots2);
112
+ this.allocatedSlots = (_this$allocatedSlots2 = {}, (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$allocatedSlots2, _internalMediaCore.MediaType.VideoSlides, []), _this$allocatedSlots2);
113
+ this.freeSlots = (_this$freeSlots2 = {}, (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaType.AudioMain, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaType.VideoMain, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaType.AudioSlides, []), (0, _defineProperty2.default)(_this$freeSlots2, _internalMediaCore.MediaType.VideoSlides, []), _this$freeSlots2);
124
114
  }
125
115
 
126
116
  /**
@@ -131,17 +121,17 @@ var ReceiveSlotManager = /*#__PURE__*/function () {
131
121
  }, {
132
122
  key: "getStats",
133
123
  value: function getStats() {
134
- var _this2 = this;
124
+ var _this = this;
135
125
  var numAllocatedSlots = {};
136
126
  var numFreeSlots = {};
137
127
  (0, _keys.default)(this.allocatedSlots).forEach(function (key) {
138
- if (_this2.allocatedSlots[key].length > 0) {
139
- numAllocatedSlots[key] = _this2.allocatedSlots[key].length;
128
+ if (_this.allocatedSlots[key].length > 0) {
129
+ numAllocatedSlots[key] = _this.allocatedSlots[key].length;
140
130
  }
141
131
  });
142
132
  (0, _keys.default)(this.freeSlots).forEach(function (key) {
143
- if (_this2.freeSlots[key].length > 0) {
144
- numFreeSlots[key] = _this2.freeSlots[key].length;
133
+ if (_this.freeSlots[key].length > 0) {
134
+ numFreeSlots[key] = _this.freeSlots[key].length;
145
135
  }
146
136
  });
147
137
  return {
@@ -149,6 +139,36 @@ var ReceiveSlotManager = /*#__PURE__*/function () {
149
139
  numFreeSlots: numFreeSlots
150
140
  };
151
141
  }
142
+
143
+ /**
144
+ * Tries to find the member id on all allocated receive slots
145
+ * This function should be called when new members are added to the meeting.
146
+ */
147
+ }, {
148
+ key: "updateMemberIds",
149
+ value: function updateMemberIds() {
150
+ var _this2 = this;
151
+ (0, _keys.default)(this.allocatedSlots).forEach(function (key) {
152
+ _this2.allocatedSlots[key].forEach(function (slot) {
153
+ slot.findMemberId();
154
+ });
155
+ });
156
+ }
157
+
158
+ /**
159
+ * Find a receive slot by a ssrc.
160
+ *
161
+ * @param ssrc - The ssrc of the receive slot to find.
162
+ * @returns - The receive slot with this ssrc, undefined if not found.
163
+ */
164
+ }, {
165
+ key: "findReceiveSlotBySsrc",
166
+ value: function findReceiveSlotBySsrc(ssrc) {
167
+ return (0, _values.default)(this.allocatedSlots).flat().find(function (r) {
168
+ var _r$wcmeReceiveSlot, _r$wcmeReceiveSlot$id;
169
+ return ssrc && ((_r$wcmeReceiveSlot = r.wcmeReceiveSlot) === null || _r$wcmeReceiveSlot === void 0 ? void 0 : (_r$wcmeReceiveSlot$id = _r$wcmeReceiveSlot.id) === null || _r$wcmeReceiveSlot$id === void 0 ? void 0 : _r$wcmeReceiveSlot$id.ssrc) === ssrc;
170
+ });
171
+ }
152
172
  }]);
153
173
  return ReceiveSlotManager;
154
174
  }();
@@ -1 +1 @@
1
- {"version":3,"names":["ReceiveSlotManager","meeting","allocatedSlots","MC","MediaType","AudioMain","VideoMain","AudioSlides","VideoSlides","freeSlots","mediaType","mediaProperties","webrtcMediaConnection","reject","Error","availableSlot","pop","push","LoggerProxy","logger","log","id","createReceiveSlot","wcmeReceiveSlot","receiveSlot","ReceiveSlot","csi","members","findMemberByCsi","slot","idx","findIndex","allocatedSlot","splice","warn","numAllocatedSlots","numFreeSlots","forEach","key","length"],"sources":["receiveSlotManager.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\n/* eslint-disable import/prefer-default-export */\nimport {MediaConnection as MC} from '@webex/internal-media-core';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport Meeting from '../meeting';\n\nimport {CSI, ReceiveSlot} from './receiveSlot';\n\n/**\n * Manages all receive slots used by a meeting. WMCE receive slots cannot be ever deleted,\n * so this manager has a pool in order to re-use the slots that were released earlier.\n */\nexport class ReceiveSlotManager {\n private allocatedSlots: {[key in MC.MediaType]: ReceiveSlot[]};\n\n private freeSlots: {[key in MC.MediaType]: ReceiveSlot[]};\n\n private meeting: Meeting;\n\n /**\n * Constructor\n * @param {Meeting} meeting\n */\n constructor(meeting) {\n this.allocatedSlots = {\n [MC.MediaType.AudioMain]: [],\n [MC.MediaType.VideoMain]: [],\n [MC.MediaType.AudioSlides]: [],\n [MC.MediaType.VideoSlides]: [],\n };\n this.freeSlots = {\n [MC.MediaType.AudioMain]: [],\n [MC.MediaType.VideoMain]: [],\n [MC.MediaType.AudioSlides]: [],\n [MC.MediaType.VideoSlides]: [],\n };\n this.meeting = meeting;\n }\n\n /**\n * Creates a new receive slot or returns one from the existing pool of free slots\n *\n * @param {MC.MediaType} mediaType\n * @returns {Promise<ReceiveSlot>}\n */\n async allocateSlot(mediaType: MC.MediaType): Promise<ReceiveSlot> {\n if (!this.meeting?.mediaProperties?.webrtcMediaConnection) {\n return Promise.reject(new Error('Webrtc media connection is missing'));\n }\n\n // try to use one of the free ones\n const availableSlot = this.freeSlots[mediaType].pop();\n\n if (availableSlot) {\n this.allocatedSlots[mediaType].push(availableSlot);\n\n LoggerProxy.logger.log(`receive slot re-used: ${availableSlot.id}`);\n\n return availableSlot;\n }\n\n // we have to create a new one\n const wcmeReceiveSlot =\n await this.meeting.mediaProperties.webrtcMediaConnection.createReceiveSlot(mediaType);\n\n const receiveSlot = new ReceiveSlot(\n mediaType,\n wcmeReceiveSlot,\n (csi: CSI) => this.meeting.members.findMemberByCsi(csi)?.id\n );\n\n this.allocatedSlots[mediaType].push(receiveSlot);\n LoggerProxy.logger.log(`new receive slot allocated: ${receiveSlot.id}`);\n\n return receiveSlot;\n }\n\n /**\n * Releases the slot back to the pool so it can be re-used by others in the future\n * @param {ReceiveSlot} slot\n */\n releaseSlot(slot: ReceiveSlot) {\n const idx = this.allocatedSlots[slot.mediaType].findIndex(\n (allocatedSlot) => allocatedSlot === slot\n );\n\n if (idx >= 0) {\n this.allocatedSlots[slot.mediaType].splice(idx, 1);\n this.freeSlots[slot.mediaType].push(slot);\n LoggerProxy.logger.log(`receive slot released: ${slot.id}`);\n } else {\n LoggerProxy.logger.warn(\n 'ReceiveSlotManager#releaseSlot --> trying to release a slot that is not managed by this ReceiveSlotManager'\n );\n }\n }\n\n /**\n * Resets the slot manager - this method should be called when the media connection is torn down\n */\n reset() {\n this.allocatedSlots = {\n [MC.MediaType.AudioMain]: [],\n [MC.MediaType.VideoMain]: [],\n [MC.MediaType.AudioSlides]: [],\n [MC.MediaType.VideoSlides]: [],\n };\n this.freeSlots = {\n [MC.MediaType.AudioMain]: [],\n [MC.MediaType.VideoMain]: [],\n [MC.MediaType.AudioSlides]: [],\n [MC.MediaType.VideoSlides]: [],\n };\n }\n\n /**\n * Returns statistics about the managed slots\n *\n * @returns {Object}\n */\n getStats() {\n const numAllocatedSlots = {};\n const numFreeSlots = {};\n\n Object.keys(this.allocatedSlots).forEach((key) => {\n if (this.allocatedSlots[key].length > 0) {\n numAllocatedSlots[key] = this.allocatedSlots[key].length;\n }\n });\n\n Object.keys(this.freeSlots).forEach((key) => {\n if (this.freeSlots[key].length > 0) {\n numFreeSlots[key] = this.freeSlots[key].length;\n }\n });\n\n return {\n numAllocatedSlots,\n numFreeSlots,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;AAEA;AAGA;AAPA;AACA;AAQA;AACA;AACA;AACA;AAHA,IAIaA,kBAAkB;EAO7B;AACF;AACA;AACA;EACE,4BAAYC,OAAO,EAAE;IAAA;IAAA;IAAA;IAAA;IAAA;IACnB,IAAI,CAACC,cAAc,mFAChBC,kCAAE,CAACC,SAAS,CAACC,SAAS,EAAG,EAAE,uDAC3BF,kCAAE,CAACC,SAAS,CAACE,SAAS,EAAG,EAAE,uDAC3BH,kCAAE,CAACC,SAAS,CAACG,WAAW,EAAG,EAAE,uDAC7BJ,kCAAE,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BF,kCAAE,CAACC,SAAS,CAACE,SAAS,EAAG,EAAE,mDAC3BH,kCAAE,CAACC,SAAS,CAACG,WAAW,EAAG,EAAE,mDAC7BJ,kCAAE,CAACC,SAAS,CAACI,WAAW,EAAG,EAAE,oBAC/B;IACH;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,OAKA,oBAAW;MAAA;MACT,IAAM2B,iBAAiB,GAAG,CAAC,CAAC;MAC5B,IAAMC,YAAY,GAAG,CAAC,CAAC;MAEvB,mBAAY,IAAI,CAAClC,cAAc,CAAC,CAACmC,OAAO,CAAC,UAACC,GAAG,EAAK;QAChD,IAAI,MAAI,CAACpC,cAAc,CAACoC,GAAG,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;UACvCJ,iBAAiB,CAACG,GAAG,CAAC,GAAG,MAAI,CAACpC,cAAc,CAACoC,GAAG,CAAC,CAACC,MAAM;QAC1D;MACF,CAAC,CAAC;MAEF,mBAAY,IAAI,CAAC9B,SAAS,CAAC,CAAC4B,OAAO,CAAC,UAACC,GAAG,EAAK;QAC3C,IAAI,MAAI,CAAC7B,SAAS,CAAC6B,GAAG,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;UAClCH,YAAY,CAACE,GAAG,CAAC,GAAG,MAAI,CAAC7B,SAAS,CAAC6B,GAAG,CAAC,CAACC,MAAM;QAChD;MACF,CAAC,CAAC;MAEF,OAAO;QACLJ,iBAAiB,EAAjBA,iBAAiB;QACjBC,YAAY,EAAZA;MACF,CAAC;IACH;EAAC;EAAA;AAAA;AAAA"}
1
+ {"version":3,"names":["ReceiveSlotManager","createSlotCallback","findMemberIdByCsiCallback","allocatedSlots","MediaType","AudioMain","VideoMain","AudioSlides","VideoSlides","freeSlots","mediaType","availableSlot","pop","push","LoggerProxy","logger","log","id","wcmeReceiveSlot","receiveSlot","ReceiveSlot","slot","idx","findIndex","allocatedSlot","splice","warn","numAllocatedSlots","numFreeSlots","forEach","key","length","findMemberId","ssrc","flat","find","r"],"sources":["receiveSlotManager.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\n/* eslint-disable import/prefer-default-export */\nimport {MediaType, ReceiveSlot as WcmeReceiveSlot} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {FindMemberIdCallback, ReceiveSlot} from './receiveSlot';\n\nexport type CreateSlotCallback = (mediaType: MediaType) => Promise<WcmeReceiveSlot>;\n\nexport type {CSI, FindMemberIdCallback} from './receiveSlot';\n\n/**\n * Manages all receive slots used by a meeting. WMCE receive slots cannot be ever deleted,\n * so this manager has a pool in order to re-use the slots that were released earlier.\n */\nexport class ReceiveSlotManager {\n private allocatedSlots: {[key in MediaType]: ReceiveSlot[]};\n\n private freeSlots: {[key in MediaType]: ReceiveSlot[]};\n\n private createSlotCallback: CreateSlotCallback;\n\n private findMemberIdByCsiCallback: FindMemberIdCallback;\n\n /**\n * Constructor\n * @param {Meeting} meeting\n */\n constructor(\n createSlotCallback: CreateSlotCallback,\n findMemberIdByCsiCallback: FindMemberIdCallback\n ) {\n this.allocatedSlots = {\n [MediaType.AudioMain]: [],\n [MediaType.VideoMain]: [],\n [MediaType.AudioSlides]: [],\n [MediaType.VideoSlides]: [],\n };\n this.freeSlots = {\n [MediaType.AudioMain]: [],\n [MediaType.VideoMain]: [],\n [MediaType.AudioSlides]: [],\n [MediaType.VideoSlides]: [],\n };\n this.createSlotCallback = createSlotCallback;\n this.findMemberIdByCsiCallback = findMemberIdByCsiCallback;\n }\n\n /**\n * Creates a new receive slot or returns one from the existing pool of free slots\n *\n * @param {MediaType} mediaType\n * @returns {Promise<ReceiveSlot>}\n */\n async allocateSlot(mediaType: MediaType): Promise<ReceiveSlot> {\n // try to use one of the free ones\n const availableSlot = this.freeSlots[mediaType].pop();\n\n if (availableSlot) {\n this.allocatedSlots[mediaType].push(availableSlot);\n\n LoggerProxy.logger.log(`receive slot re-used: ${availableSlot.id}`);\n\n return availableSlot;\n }\n\n // we have to create a new one\n const wcmeReceiveSlot = await this.createSlotCallback(mediaType);\n\n const receiveSlot = new ReceiveSlot(mediaType, wcmeReceiveSlot, this.findMemberIdByCsiCallback);\n\n this.allocatedSlots[mediaType].push(receiveSlot);\n LoggerProxy.logger.log(`new receive slot allocated: ${receiveSlot.id}`);\n\n return receiveSlot;\n }\n\n /**\n * Releases the slot back to the pool so it can be re-used by others in the future\n * @param {ReceiveSlot} slot\n */\n releaseSlot(slot: ReceiveSlot) {\n const idx = this.allocatedSlots[slot.mediaType].findIndex(\n (allocatedSlot) => allocatedSlot === slot\n );\n\n if (idx >= 0) {\n this.allocatedSlots[slot.mediaType].splice(idx, 1);\n this.freeSlots[slot.mediaType].push(slot);\n LoggerProxy.logger.log(`receive slot released: ${slot.id}`);\n } else {\n LoggerProxy.logger.warn(\n 'ReceiveSlotManager#releaseSlot --> trying to release a slot that is not managed by this ReceiveSlotManager'\n );\n }\n }\n\n /**\n * Resets the slot manager - this method should be called when the media connection is torn down\n */\n reset() {\n this.allocatedSlots = {\n [MediaType.AudioMain]: [],\n [MediaType.VideoMain]: [],\n [MediaType.AudioSlides]: [],\n [MediaType.VideoSlides]: [],\n };\n this.freeSlots = {\n [MediaType.AudioMain]: [],\n [MediaType.VideoMain]: [],\n [MediaType.AudioSlides]: [],\n [MediaType.VideoSlides]: [],\n };\n }\n\n /**\n * Returns statistics about the managed slots\n *\n * @returns {Object}\n */\n getStats() {\n const numAllocatedSlots = {};\n const numFreeSlots = {};\n\n Object.keys(this.allocatedSlots).forEach((key) => {\n if (this.allocatedSlots[key].length > 0) {\n numAllocatedSlots[key] = this.allocatedSlots[key].length;\n }\n });\n\n Object.keys(this.freeSlots).forEach((key) => {\n if (this.freeSlots[key].length > 0) {\n numFreeSlots[key] = this.freeSlots[key].length;\n }\n });\n\n return {\n numAllocatedSlots,\n numFreeSlots,\n };\n }\n\n /**\n * Tries to find the member id on all allocated receive slots\n * This function should be called when new members are added to the meeting.\n */\n updateMemberIds() {\n Object.keys(this.allocatedSlots).forEach((key) => {\n this.allocatedSlots[key].forEach((slot: ReceiveSlot) => {\n slot.findMemberId();\n });\n });\n }\n\n /**\n * Find a receive slot by a ssrc.\n *\n * @param ssrc - The ssrc of the receive slot to find.\n * @returns - The receive slot with this ssrc, undefined if not found.\n */\n findReceiveSlotBySsrc(ssrc: number): ReceiveSlot | undefined {\n return Object.values(this.allocatedSlots)\n .flat()\n .find((r) => ssrc && r.wcmeReceiveSlot?.id?.ssrc === ssrc);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;AACA;AAEA;AALA;AACA;AAUA;AACA;AACA;AACA;AAHA,IAIaA,kBAAkB;EAS7B;AACF;AACA;AACA;EACE,4BACEC,kBAAsC,EACtCC,yBAA+C,EAC/C;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IACA,IAAI,CAACC,cAAc,mFAChBC,4BAAS,CAACC,SAAS,EAAG,EAAE,uDACxBD,4BAAS,CAACE,SAAS,EAAG,EAAE,uDACxBF,4BAAS,CAACG,WAAW,EAAG,EAAE,uDAC1BH,4BAAS,CAACI,WAAW,EAAG,EAAE,wBAC5B;IACD,IAAI,CAACC,SAAS,yEACXL,4BAAS,CAACC,SAAS,EAAG,EAAE,kDACxBD,4BAAS,CAACE,SAAS,EAAG,EAAE,kDACxBF,4BAAS,CAACG,WAAW,EAAG,EAAE,kDAC1BH,4BAAS,CAACI,WAAW,EAAG,EAAE,mBAC5B;IACD,IAAI,CAACP,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,yBAAyB,GAAGA,yBAAyB;EAC5D;;EAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA;MAAA,4FAMA,iBAAmBQ,SAAoB;QAAA;QAAA;UAAA;YAAA;cACrC;cACMC,aAAa,GAAG,IAAI,CAACF,SAAS,CAACC,SAAS,CAAC,CAACE,GAAG,EAAE;cAAA,KAEjDD,aAAa;gBAAA;gBAAA;cAAA;cACf,IAAI,CAACR,cAAc,CAACO,SAAS,CAAC,CAACG,IAAI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AACC,GAAG,EAAK;QAChD,MAAI,CAAC3B,cAAc,CAAC2B,GAAG,CAAC,CAACD,OAAO,CAAC,UAACR,IAAiB,EAAK;UACtDA,IAAI,CAACW,YAAY,EAAE;QACrB,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA,OAMA,+BAAsBC,IAAY,EAA2B;MAC3D,OAAO,qBAAc,IAAI,CAAC9B,cAAc,CAAC,CACtC+B,IAAI,EAAE,CACNC,IAAI,CAAC,UAACC,CAAC;QAAA;QAAA,OAAKH,IAAI,IAAI,uBAAAG,CAAC,CAAClB,eAAe,gFAAjB,mBAAmBD,EAAE,0DAArB,sBAAuBgB,IAAI,MAAKA,IAAI;MAAA,EAAC;IAC9D;EAAC;EAAA;AAAA;AAAA"}
@@ -96,20 +96,46 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
96
96
  }
97
97
 
98
98
  /**
99
- * Invalidates the remote media by clearing the reference to a receive slot and
100
- * cancelling the media request.
101
- * After this call the remote media is unusable.
102
- *
103
- * @param {boolean} commit - whether to commit the cancellation of the media request
104
- * @internal
99
+ * Supply the width and height of the video element
100
+ * to restrict the requested resolution to this size
101
+ * @param width width of the video element
102
+ * @param height height of the video element
105
103
  */
106
104
  (0, _createClass2.default)(RemoteMedia, [{
105
+ key: "setSizeHint",
106
+ value: function setSizeHint(width, height) {
107
+ var _this$receiveSlot;
108
+ // only base on height for now
109
+ var fs;
110
+ if (height < 135) {
111
+ fs = 60;
112
+ } else if (height < 270) {
113
+ fs = 240;
114
+ } else if (height < 540) {
115
+ fs = 920;
116
+ } else if (height <= 720) {
117
+ fs = 3600;
118
+ } else {
119
+ fs = 8192;
120
+ }
121
+ (_this$receiveSlot = this.receiveSlot) === null || _this$receiveSlot === void 0 ? void 0 : _this$receiveSlot.setMaxFs(fs);
122
+ }
123
+
124
+ /**
125
+ * Invalidates the remote media by clearing the reference to a receive slot and
126
+ * cancelling the media request.
127
+ * After this call the remote media is unusable.
128
+ *
129
+ * @param {boolean} commit - whether to commit the cancellation of the media request
130
+ * @internal
131
+ */
132
+ }, {
107
133
  key: "stop",
108
134
  value: function stop() {
109
- var _this$receiveSlot;
135
+ var _this$receiveSlot2;
110
136
  var commit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
111
137
  this.cancelMediaRequest(commit);
112
- (_this$receiveSlot = this.receiveSlot) === null || _this$receiveSlot === void 0 ? void 0 : _this$receiveSlot.removeAllListeners();
138
+ (_this$receiveSlot2 = this.receiveSlot) === null || _this$receiveSlot2 === void 0 ? void 0 : _this$receiveSlot2.removeAllListeners();
113
139
  this.receiveSlot = undefined;
114
140
  this.emit({
115
141
  file: 'multistream/remoteMedia',
@@ -184,8 +210,8 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
184
210
  }, {
185
211
  key: "mediaType",
186
212
  get: function get() {
187
- var _this$receiveSlot2;
188
- return (_this$receiveSlot2 = this.receiveSlot) === null || _this$receiveSlot2 === void 0 ? void 0 : _this$receiveSlot2.mediaType;
213
+ var _this$receiveSlot3;
214
+ return (_this$receiveSlot3 = this.receiveSlot) === null || _this$receiveSlot3 === void 0 ? void 0 : _this$receiveSlot3.mediaType;
189
215
  }
190
216
 
191
217
  /**
@@ -194,8 +220,8 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
194
220
  }, {
195
221
  key: "memberId",
196
222
  get: function get() {
197
- var _this$receiveSlot3;
198
- return (_this$receiveSlot3 = this.receiveSlot) === null || _this$receiveSlot3 === void 0 ? void 0 : _this$receiveSlot3.memberId;
223
+ var _this$receiveSlot4;
224
+ return (_this$receiveSlot4 = this.receiveSlot) === null || _this$receiveSlot4 === void 0 ? void 0 : _this$receiveSlot4.memberId;
199
225
  }
200
226
 
201
227
  /**
@@ -204,8 +230,8 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
204
230
  }, {
205
231
  key: "csi",
206
232
  get: function get() {
207
- var _this$receiveSlot4;
208
- return (_this$receiveSlot4 = this.receiveSlot) === null || _this$receiveSlot4 === void 0 ? void 0 : _this$receiveSlot4.csi;
233
+ var _this$receiveSlot5;
234
+ return (_this$receiveSlot5 = this.receiveSlot) === null || _this$receiveSlot5 === void 0 ? void 0 : _this$receiveSlot5.csi;
209
235
  }
210
236
 
211
237
  /**
@@ -214,8 +240,8 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
214
240
  }, {
215
241
  key: "sourceState",
216
242
  get: function get() {
217
- var _this$receiveSlot5;
218
- return (_this$receiveSlot5 = this.receiveSlot) === null || _this$receiveSlot5 === void 0 ? void 0 : _this$receiveSlot5.sourceState;
243
+ var _this$receiveSlot6;
244
+ return (_this$receiveSlot6 = this.receiveSlot) === null || _this$receiveSlot6 === void 0 ? void 0 : _this$receiveSlot6.sourceState;
219
245
  }
220
246
 
221
247
  /**
@@ -224,8 +250,8 @@ var RemoteMedia = /*#__PURE__*/function (_EventsScope) {
224
250
  }, {
225
251
  key: "stream",
226
252
  get: function get() {
227
- var _this$receiveSlot6;
228
- return (_this$receiveSlot6 = this.receiveSlot) === null || _this$receiveSlot6 === void 0 ? void 0 : _this$receiveSlot6.stream;
253
+ var _this$receiveSlot7;
254
+ return (_this$receiveSlot7 = this.receiveSlot) === null || _this$receiveSlot7 === void 0 ? void 0 : _this$receiveSlot7.stream;
229
255
  }
230
256
 
231
257
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["RemoteMediaEvents","SourceUpdate","ReceiveSlotEvents","Stopped","getMaxFs","paneSize","maxFs","LoggerProxy","logger","warn","remoteMediaCounter","RemoteMedia","receiveSlot","mediaRequestManager","options","setupEventListeners","id","commit","cancelMediaRequest","removeAllListeners","undefined","emit","file","function","csi","mediaRequestId","Error","addRequest","policyInfo","policy","receiveSlots","codecInfo","resolution","codec","cancelRequest","scope","on","data","mediaType","memberId","sourceState","stream","EventsScope"],"sources":["remoteMedia.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';\n\nexport const RemoteMediaEvents = {\n SourceUpdate: ReceiveSlotEvents.SourceUpdate,\n Stopped: 'stopped',\n};\n\nexport type RemoteVideoResolution =\n | 'thumbnail' // the smallest possible resolution, 90p or less\n | 'very small' // 180p or less\n | 'small' // 360p or less\n | 'medium' // 720p or less\n | 'large' // 1080p or less\n | 'best'; // highest possible resolution\n\n/**\n * Converts pane size into h264 maxFs\n * @param {PaneSize} paneSize\n * @returns {number}\n */\nexport function getMaxFs(paneSize: RemoteVideoResolution): number {\n let maxFs;\n\n switch (paneSize) {\n case 'thumbnail':\n maxFs = 60;\n break;\n case 'very small':\n maxFs = 240;\n break;\n case 'small':\n maxFs = 920;\n break;\n case 'medium':\n maxFs = 3600;\n break;\n case 'large':\n maxFs = 8192;\n break;\n case 'best':\n maxFs = 8192; // for now 'best' is 1080p, so same as 'large'\n break;\n default:\n LoggerProxy.logger.warn(\n `RemoteMedia#getMaxFs --> unsupported paneSize: ${paneSize}, using \"medium\" instead`\n );\n maxFs = 3600;\n }\n\n return maxFs;\n}\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MC.MediaType.VideoMain and MC.MediaType.VideoSlides\n};\n\nexport type RemoteMediaId = string;\n\nlet remoteMediaCounter = 0;\n\n/**\n * Class representing a remote audio/video stream.\n *\n * Internally it is associated with a specific receive slot\n * and a media request for it.\n */\nexport class RemoteMedia extends EventsScope {\n private receiveSlot?: ReceiveSlot;\n\n private readonly mediaRequestManager: MediaRequestManager;\n\n private readonly options: Options;\n\n private mediaRequestId?: MediaRequestId;\n\n public readonly id: RemoteMediaId;\n\n /**\n * Constructs RemoteMedia instance\n *\n * @param receiveSlot\n * @param mediaRequestManager\n * @param options\n */\n constructor(\n receiveSlot: ReceiveSlot,\n mediaRequestManager: MediaRequestManager,\n options?: Options\n ) {\n super();\n remoteMediaCounter += 1;\n this.receiveSlot = receiveSlot;\n this.mediaRequestManager = mediaRequestManager;\n this.options = options || {};\n this.setupEventListeners();\n this.id = `RM${remoteMediaCounter}-${this.receiveSlot.id}`;\n }\n\n /**\n * Invalidates the remote media by clearing the reference to a receive slot and\n * cancelling the media request.\n * After this call the remote media is unusable.\n *\n * @param {boolean} commit - whether to commit the cancellation of the media request\n * @internal\n */\n public stop(commit = true) {\n this.cancelMediaRequest(commit);\n this.receiveSlot?.removeAllListeners();\n this.receiveSlot = undefined;\n this.emit(\n {\n file: 'multistream/remoteMedia',\n function: 'stop',\n },\n RemoteMediaEvents.Stopped,\n {}\n );\n }\n\n /**\n * Sends a new media request. This method can only be used for receiver-selected policy,\n * because only in that policy we have a 1-1 relationship between RemoteMedia and MediaRequest\n * and the request id is then stored in this RemoteMedia instance.\n * For active-speaker policy, the same request is shared among many RemoteMedia instances,\n * so it's managed through RemoteMediaGroup\n *\n * @internal\n */\n public sendMediaRequest(csi: CSI, commit: boolean) {\n if (this.mediaRequestId) {\n this.cancelMediaRequest(false);\n }\n\n if (!this.receiveSlot) {\n throw new Error('sendMediaRequest() called on an invalidated RemoteMedia instance');\n }\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'receiver-selected',\n csi,\n },\n receiveSlots: [this.receiveSlot],\n codecInfo: this.options.resolution && {\n codec: 'h264',\n maxFs: getMaxFs(this.options.resolution),\n },\n },\n commit\n );\n }\n\n /**\n * @internal\n */\n public cancelMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * registers event listeners on the receive slot and forwards all the events\n */\n private setupEventListeners() {\n if (this.receiveSlot) {\n const scope = {\n file: 'multistream/remoteMedia',\n function: 'setupEventListeners',\n };\n\n this.receiveSlot.on(ReceiveSlotEvents.SourceUpdate, (data) => {\n this.emit(scope, RemoteMediaEvents.SourceUpdate, data);\n });\n }\n }\n\n /**\n * Getter for mediaType\n */\n public get mediaType() {\n return this.receiveSlot?.mediaType;\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.receiveSlot?.memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.receiveSlot?.csi;\n }\n\n /**\n * Getter for source state\n */\n public get sourceState() {\n return this.receiveSlot?.sourceState;\n }\n\n /**\n * Getter for remote media stream\n */\n public get stream() {\n return this.receiveSlot?.stream;\n }\n\n /**\n * @internal\n * @returns {ReceiveSlot}\n */\n public getUnderlyingReceiveSlot() {\n return this.receiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;AACA;AAGA;AAAkE;AAAA;AAE3D,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAEC,8BAAiB,CAACD,YAAY;EAC5CE,OAAO,EAAE;AACX,CAAC;AAAC;AAQU;;AAEZ;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQ,CAACC,QAA+B,EAAU;EAChE,IAAIC,KAAK;EAET,QAAQD,QAAQ;IACd,KAAK,WAAW;MACdC,KAAK,GAAG,EAAE;MACV;IACF,KAAK,YAAY;MACfA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,QAAQ;MACXA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,MAAM;MACTA,KAAK,GAAG,IAAI,CAAC,CAAC;MACd;IACF;MACEC,oBAAW,CAACC,MAAM,CAACC,IAAI,0DAC6BJ,QAAQ,gCAC3D;MACDC,KAAK,GAAG,IAAI;EAAC;EAGjB,OAAOA,KAAK;AACd;AAQA,IAAII,kBAAkB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA;AALA,IAMaC,WAAW;EAAA;EAAA;EAWtB;AACF;AACA;AACA;AAC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,eAAyB;MAAA;MACvB,6BAAO,IAAI,CAACZ,WAAW,uDAAhB,mBAAkB4B,WAAW;IACtC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAoB;MAAA;MAClB,6BAAO,IAAI,CAAC5B,WAAW,uDAAhB,mBAAkB6B,MAAM;IACjC;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,oCAAkC;MAChC,OAAO,IAAI,CAAC7B,WAAW;IACzB;EAAC;EAAA;AAAA,EA3J8B8B,oBAAW;AAAA"}
1
+ {"version":3,"names":["RemoteMediaEvents","SourceUpdate","ReceiveSlotEvents","Stopped","getMaxFs","paneSize","maxFs","LoggerProxy","logger","warn","remoteMediaCounter","RemoteMedia","receiveSlot","mediaRequestManager","options","setupEventListeners","id","width","height","fs","setMaxFs","commit","cancelMediaRequest","removeAllListeners","undefined","emit","file","function","csi","mediaRequestId","Error","addRequest","policyInfo","policy","receiveSlots","codecInfo","resolution","codec","cancelRequest","scope","on","data","mediaType","memberId","sourceState","stream","EventsScope"],"sources":["remoteMedia.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {MediaType, StreamState} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport EventsScope from '../common/events/events-scope';\n\nimport {MediaRequestId, MediaRequestManager} from './mediaRequestManager';\nimport {CSI, ReceiveSlot, ReceiveSlotEvents} from './receiveSlot';\n\nexport const RemoteMediaEvents = {\n SourceUpdate: ReceiveSlotEvents.SourceUpdate,\n Stopped: 'stopped',\n};\n\nexport type RemoteVideoResolution =\n | 'thumbnail' // the smallest possible resolution, 90p or less\n | 'very small' // 180p or less\n | 'small' // 360p or less\n | 'medium' // 720p or less\n | 'large' // 1080p or less\n | 'best'; // highest possible resolution\n\n/**\n * Converts pane size into h264 maxFs\n * @param {PaneSize} paneSize\n * @returns {number}\n */\nexport function getMaxFs(paneSize: RemoteVideoResolution): number {\n let maxFs;\n\n switch (paneSize) {\n case 'thumbnail':\n maxFs = 60;\n break;\n case 'very small':\n maxFs = 240;\n break;\n case 'small':\n maxFs = 920;\n break;\n case 'medium':\n maxFs = 3600;\n break;\n case 'large':\n maxFs = 8192;\n break;\n case 'best':\n maxFs = 8192; // for now 'best' is 1080p, so same as 'large'\n break;\n default:\n LoggerProxy.logger.warn(\n `RemoteMedia#getMaxFs --> unsupported paneSize: ${paneSize}, using \"medium\" instead`\n );\n maxFs = 3600;\n }\n\n return maxFs;\n}\n\ntype Options = {\n resolution?: RemoteVideoResolution; // applies only to groups of type MediaType.VideoMain and MediaType.VideoSlides\n};\n\nexport type RemoteMediaId = string;\n\nlet remoteMediaCounter = 0;\n\n/**\n * Class representing a remote audio/video stream.\n *\n * Internally it is associated with a specific receive slot\n * and a media request for it.\n */\nexport class RemoteMedia extends EventsScope {\n private receiveSlot?: ReceiveSlot;\n\n private readonly mediaRequestManager: MediaRequestManager;\n\n private readonly options: Options;\n\n private mediaRequestId?: MediaRequestId;\n\n public readonly id: RemoteMediaId;\n\n /**\n * Constructs RemoteMedia instance\n *\n * @param receiveSlot\n * @param mediaRequestManager\n * @param options\n */\n constructor(\n receiveSlot: ReceiveSlot,\n mediaRequestManager: MediaRequestManager,\n options?: Options\n ) {\n super();\n remoteMediaCounter += 1;\n this.receiveSlot = receiveSlot;\n this.mediaRequestManager = mediaRequestManager;\n this.options = options || {};\n this.setupEventListeners();\n this.id = `RM${remoteMediaCounter}-${this.receiveSlot.id}`;\n }\n\n /**\n * Supply the width and height of the video element\n * to restrict the requested resolution to this size\n * @param width width of the video element\n * @param height height of the video element\n */\n public setSizeHint(width, height) {\n // only base on height for now\n let fs: number;\n\n if (height < 135) {\n fs = 60;\n } else if (height < 270) {\n fs = 240;\n } else if (height < 540) {\n fs = 920;\n } else if (height <= 720) {\n fs = 3600;\n } else {\n fs = 8192;\n }\n\n this.receiveSlot?.setMaxFs(fs);\n }\n\n /**\n * Invalidates the remote media by clearing the reference to a receive slot and\n * cancelling the media request.\n * After this call the remote media is unusable.\n *\n * @param {boolean} commit - whether to commit the cancellation of the media request\n * @internal\n */\n public stop(commit = true) {\n this.cancelMediaRequest(commit);\n this.receiveSlot?.removeAllListeners();\n this.receiveSlot = undefined;\n this.emit(\n {\n file: 'multistream/remoteMedia',\n function: 'stop',\n },\n RemoteMediaEvents.Stopped,\n {}\n );\n }\n\n /**\n * Sends a new media request. This method can only be used for receiver-selected policy,\n * because only in that policy we have a 1-1 relationship between RemoteMedia and MediaRequest\n * and the request id is then stored in this RemoteMedia instance.\n * For active-speaker policy, the same request is shared among many RemoteMedia instances,\n * so it's managed through RemoteMediaGroup\n *\n * @internal\n */\n public sendMediaRequest(csi: CSI, commit: boolean) {\n if (this.mediaRequestId) {\n this.cancelMediaRequest(false);\n }\n\n if (!this.receiveSlot) {\n throw new Error('sendMediaRequest() called on an invalidated RemoteMedia instance');\n }\n\n this.mediaRequestId = this.mediaRequestManager.addRequest(\n {\n policyInfo: {\n policy: 'receiver-selected',\n csi,\n },\n receiveSlots: [this.receiveSlot],\n codecInfo: this.options.resolution && {\n codec: 'h264',\n maxFs: getMaxFs(this.options.resolution),\n },\n },\n commit\n );\n }\n\n /**\n * @internal\n */\n public cancelMediaRequest(commit: boolean) {\n if (this.mediaRequestId) {\n this.mediaRequestManager.cancelRequest(this.mediaRequestId, commit);\n this.mediaRequestId = undefined;\n }\n }\n\n /**\n * registers event listeners on the receive slot and forwards all the events\n */\n private setupEventListeners() {\n if (this.receiveSlot) {\n const scope = {\n file: 'multistream/remoteMedia',\n function: 'setupEventListeners',\n };\n\n this.receiveSlot.on(ReceiveSlotEvents.SourceUpdate, (data) => {\n this.emit(scope, RemoteMediaEvents.SourceUpdate, data);\n });\n }\n }\n\n /**\n * Getter for mediaType\n */\n public get mediaType(): MediaType {\n return this.receiveSlot?.mediaType;\n }\n\n /**\n * Getter for memberId\n */\n public get memberId() {\n return this.receiveSlot?.memberId;\n }\n\n /**\n * Getter for csi\n */\n public get csi() {\n return this.receiveSlot?.csi;\n }\n\n /**\n * Getter for source state\n */\n public get sourceState(): StreamState {\n return this.receiveSlot?.sourceState;\n }\n\n /**\n * Getter for remote media stream\n */\n public get stream() {\n return this.receiveSlot?.stream;\n }\n\n /**\n * @internal\n * @returns {ReceiveSlot}\n */\n public getUnderlyingReceiveSlot() {\n return this.receiveSlot;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AACA;AAGA;AAAkE;AAAA;AAE3D,IAAMA,iBAAiB,GAAG;EAC/BC,YAAY,EAAEC,8BAAiB,CAACD,YAAY;EAC5CE,OAAO,EAAE;AACX,CAAC;AAAC;AAQU;;AAEZ;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQ,CAACC,QAA+B,EAAU;EAChE,IAAIC,KAAK;EAET,QAAQD,QAAQ;IACd,KAAK,WAAW;MACdC,KAAK,GAAG,EAAE;MACV;IACF,KAAK,YAAY;MACfA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,GAAG;MACX;IACF,KAAK,QAAQ;MACXA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,OAAO;MACVA,KAAK,GAAG,IAAI;MACZ;IACF,KAAK,MAAM;MACTA,KAAK,GAAG,IAAI,CAAC,CAAC;MACd;IACF;MACEC,oBAAW,CAACC,MAAM,CAACC,IAAI,0DAC6BJ,QAAQ,gCAC3D;MACDC,KAAK,GAAG,IAAI;EAAC;EAGjB,OAAOA,KAAK;AACd;AAQA,IAAII,kBAAkB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA;AALA,IAMaC,WAAW;EAAA;EAAA;EAWtB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,qBACEC,WAAwB,EACxBC,mBAAwC,EACxCC,OAAiB,EACjB;IAAA;IAAA;IACA;IAAQ;IAAA;IAAA;IAAA;IAAA;IACRJ,kBAAkB,IAAI,CAAC;IACvB,MAAKE,WAAW,GAAGA,WAAW;IAC9B,MAAKC,mBAAmB,GAAGA,mBAAmB;IAC9C,M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BAAkB8B,SAAS;IACpC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAsB;MAAA;MACpB,6BAAO,IAAI,CAAC9B,WAAW,uDAAhB,mBAAkB+B,QAAQ;IACnC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAiB;MAAA;MACf,6BAAO,IAAI,CAAC/B,WAAW,uDAAhB,mBAAkBgB,GAAG;IAC9B;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAsC;MAAA;MACpC,6BAAO,IAAI,CAAChB,WAAW,uDAAhB,mBAAkBgC,WAAW;IACtC;;IAEA;AACF;AACA;EAFE;IAAA;IAAA,KAGA,eAAoB;MAAA;MAClB,6BAAO,IAAI,CAAChC,WAAW,uDAAhB,mBAAkBiC,MAAM;IACjC;;IAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,oCAAkC;MAChC,OAAO,IAAI,CAACjC,WAAW;IACzB;EAAC;EAAA;AAAA,EApL8BkC,oBAAW;AAAA"}
@@ -10,11 +10,9 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2
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
+ var _forEach2 = _interopRequireDefault(require("lodash/forEach"));
13
14
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
14
15
  var _remoteMedia = require("./remoteMedia");
15
- /* eslint-disable valid-jsdoc */
16
- /* eslint-disable require-jsdoc */
17
- /* eslint-disable import/prefer-default-export */
18
16
  var RemoteMediaGroup = /*#__PURE__*/function () {
19
17
  // id of the "active-speaker" media request id
20
18
 
@@ -61,6 +59,52 @@ var RemoteMediaGroup = /*#__PURE__*/function () {
61
59
  return [].concat((0, _toConsumableArray2.default)(this.unpinnedRemoteMedia), (0, _toConsumableArray2.default)(this.pinnedRemoteMedia));
62
60
  }
63
61
 
62
+ /**
63
+ * Sets CSIs for multiple RemoteMedia instances belonging to this RemoteMediaGroup.
64
+ * For each entry in the remoteMediaCsis array:
65
+ * - if csi is specified, the RemoteMedia instance is pinned to that CSI
66
+ * - if csi is undefined, the RemoteMedia instance is unpinned
67
+ * @internal
68
+ */
69
+ }, {
70
+ key: "setActiveSpeakerCsis",
71
+ value: function setActiveSpeakerCsis(remoteMediaCsis) {
72
+ var _this2 = this;
73
+ var commit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
74
+ (0, _forEach2.default)(remoteMediaCsis, function (_ref) {
75
+ var csi = _ref.csi,
76
+ remoteMedia = _ref.remoteMedia;
77
+ if (csi) {
78
+ if (!(_this2.pinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {
79
+ var unpinId = _this2.unpinnedRemoteMedia.indexOf(remoteMedia);
80
+ if (unpinId >= 0) {
81
+ _this2.unpinnedRemoteMedia.splice(unpinId, 1);
82
+ _this2.pinnedRemoteMedia.push(remoteMedia);
83
+ } else {
84
+ throw new Error("failed to pin a remote media object ".concat(remoteMedia.id, ", because it is not found in this remote media group"));
85
+ }
86
+ }
87
+ remoteMedia.sendMediaRequest(csi, false);
88
+ } else {
89
+ if (!(_this2.unpinnedRemoteMedia.indexOf(remoteMedia) >= 0)) {
90
+ var pinId = _this2.pinnedRemoteMedia.indexOf(remoteMedia);
91
+ if (pinId >= 0) {
92
+ _this2.pinnedRemoteMedia.splice(pinId, 1);
93
+ _this2.unpinnedRemoteMedia.push(remoteMedia);
94
+ } else {
95
+ throw new Error("failed to unpin a remote media object ".concat(remoteMedia.id, ", because it is not found in this remote media group"));
96
+ }
97
+ }
98
+ remoteMedia.cancelMediaRequest(false);
99
+ }
100
+ });
101
+ this.cancelActiveSpeakerMediaRequest(false);
102
+ this.sendActiveSpeakerMediaRequest(false);
103
+ if (commit) {
104
+ this.mediaRequestManager.commit();
105
+ }
106
+ }
107
+
64
108
  /**
65
109
  * Pins a specific remote media instance to a specfic CSI, so the media will
66
110
  * no longer come from active speaker, but from that CSI.
@@ -128,6 +172,19 @@ var RemoteMediaGroup = /*#__PURE__*/function () {
128
172
  }
129
173
  throw new Error("remote media object ".concat(remoteMedia.id, " not found in the group"));
130
174
  }
175
+
176
+ /**
177
+ * setPreferLiveVideo - sets preferLiveVideo to true/false
178
+ * @internal
179
+ */
180
+ }, {
181
+ key: "setPreferLiveVideo",
182
+ value: function setPreferLiveVideo(preferLiveVideo, commit) {
183
+ if (this.options.preferLiveVideo !== preferLiveVideo) {
184
+ this.options.preferLiveVideo = preferLiveVideo;
185
+ this.sendActiveSpeakerMediaRequest(commit);
186
+ }
187
+ }
131
188
  }, {
132
189
  key: "sendActiveSpeakerMediaRequest",
133
190
  value: function sendActiveSpeakerMediaRequest(commit) {