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

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 (365) hide show
  1. package/UPGRADING.md +9 -9
  2. package/browsers.js +19 -24
  3. package/dist/breakouts/breakout.js +116 -0
  4. package/dist/breakouts/breakout.js.map +1 -0
  5. package/dist/breakouts/collection.js +23 -0
  6. package/dist/breakouts/collection.js.map +1 -0
  7. package/dist/breakouts/index.js +226 -0
  8. package/dist/breakouts/index.js.map +1 -0
  9. package/dist/common/browser-detection.js +1 -20
  10. package/dist/common/browser-detection.js.map +1 -1
  11. package/dist/common/collection.js +5 -20
  12. package/dist/common/collection.js.map +1 -1
  13. package/dist/common/config.js +0 -7
  14. package/dist/common/config.js.map +1 -1
  15. package/dist/common/errors/captcha-error.js +10 -24
  16. package/dist/common/errors/captcha-error.js.map +1 -1
  17. package/dist/common/errors/intent-to-join.js +11 -24
  18. package/dist/common/errors/intent-to-join.js.map +1 -1
  19. package/dist/common/errors/join-meeting.js +12 -25
  20. package/dist/common/errors/join-meeting.js.map +1 -1
  21. package/dist/common/errors/media.js +10 -24
  22. package/dist/common/errors/media.js.map +1 -1
  23. package/dist/common/errors/parameter.js +5 -33
  24. package/dist/common/errors/parameter.js.map +1 -1
  25. package/dist/common/errors/password-error.js +10 -24
  26. package/dist/common/errors/password-error.js.map +1 -1
  27. package/dist/common/errors/permission.js +9 -23
  28. package/dist/common/errors/permission.js.map +1 -1
  29. package/dist/common/errors/reconnection-in-progress.js +0 -17
  30. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  31. package/dist/common/errors/reconnection.js +10 -24
  32. package/dist/common/errors/reconnection.js.map +1 -1
  33. package/dist/common/errors/stats.js +10 -24
  34. package/dist/common/errors/stats.js.map +1 -1
  35. package/dist/common/errors/webex-errors.js +6 -41
  36. package/dist/common/errors/webex-errors.js.map +1 -1
  37. package/dist/common/errors/webex-meetings-error.js +5 -25
  38. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  39. package/dist/common/events/events-scope.js +0 -22
  40. package/dist/common/events/events-scope.js.map +1 -1
  41. package/dist/common/events/events.js +0 -23
  42. package/dist/common/events/events.js.map +1 -1
  43. package/dist/common/events/trigger-proxy.js +0 -12
  44. package/dist/common/events/trigger-proxy.js.map +1 -1
  45. package/dist/common/events/util.js +0 -15
  46. package/dist/common/events/util.js.map +1 -1
  47. package/dist/common/logs/logger-config.js +0 -4
  48. package/dist/common/logs/logger-config.js.map +1 -1
  49. package/dist/common/logs/logger-proxy.js +1 -8
  50. package/dist/common/logs/logger-proxy.js.map +1 -1
  51. package/dist/common/logs/request.js +37 -60
  52. package/dist/common/logs/request.js.map +1 -1
  53. package/dist/common/queue.js +4 -14
  54. package/dist/common/queue.js.map +1 -1
  55. package/dist/config.js +6 -6
  56. package/dist/config.js.map +1 -1
  57. package/dist/constants.js +88 -46
  58. package/dist/constants.js.map +1 -1
  59. package/dist/index.js +4 -18
  60. package/dist/index.js.map +1 -1
  61. package/dist/locus-info/controlsUtils.js +12 -29
  62. package/dist/locus-info/controlsUtils.js.map +1 -1
  63. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  64. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  65. package/dist/locus-info/fullState.js +0 -15
  66. package/dist/locus-info/fullState.js.map +1 -1
  67. package/dist/locus-info/hostUtils.js +4 -12
  68. package/dist/locus-info/hostUtils.js.map +1 -1
  69. package/dist/locus-info/index.js +184 -190
  70. package/dist/locus-info/index.js.map +1 -1
  71. package/dist/locus-info/infoUtils.js +3 -37
  72. package/dist/locus-info/infoUtils.js.map +1 -1
  73. package/dist/locus-info/mediaSharesUtils.js +12 -38
  74. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  75. package/dist/locus-info/parser.js +92 -118
  76. package/dist/locus-info/parser.js.map +1 -1
  77. package/dist/locus-info/selfUtils.js +34 -91
  78. package/dist/locus-info/selfUtils.js.map +1 -1
  79. package/dist/media/index.js +67 -111
  80. package/dist/media/index.js.map +1 -1
  81. package/dist/media/properties.js +80 -114
  82. package/dist/media/properties.js.map +1 -1
  83. package/dist/media/util.js +2 -9
  84. package/dist/media/util.js.map +1 -1
  85. package/dist/mediaQualityMetrics/config.js +10 -12
  86. package/dist/mediaQualityMetrics/config.js.map +1 -1
  87. package/dist/meeting/effectsState.js +125 -190
  88. package/dist/meeting/effectsState.js.map +1 -1
  89. package/dist/meeting/in-meeting-actions.js +5 -14
  90. package/dist/meeting/in-meeting-actions.js.map +1 -1
  91. package/dist/meeting/index.js +1692 -1925
  92. package/dist/meeting/index.js.map +1 -1
  93. package/dist/meeting/muteState.js +36 -77
  94. package/dist/meeting/muteState.js.map +1 -1
  95. package/dist/meeting/request.js +224 -230
  96. package/dist/meeting/request.js.map +1 -1
  97. package/dist/meeting/request.type.js +7 -0
  98. package/dist/meeting/request.type.js.map +1 -0
  99. package/dist/meeting/state.js +21 -31
  100. package/dist/meeting/state.js.map +1 -1
  101. package/dist/meeting/util.js +43 -215
  102. package/dist/meeting/util.js.map +1 -1
  103. package/dist/meeting-info/collection.js +6 -25
  104. package/dist/meeting-info/collection.js.map +1 -1
  105. package/dist/meeting-info/index.js +14 -32
  106. package/dist/meeting-info/index.js.map +1 -1
  107. package/dist/meeting-info/meeting-info-v2.js +193 -268
  108. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  109. package/dist/meeting-info/request.js +3 -15
  110. package/dist/meeting-info/request.js.map +1 -1
  111. package/dist/meeting-info/util.js +98 -183
  112. package/dist/meeting-info/util.js.map +1 -1
  113. package/dist/meeting-info/utilv2.js +137 -228
  114. package/dist/meeting-info/utilv2.js.map +1 -1
  115. package/dist/meetings/collection.js +5 -20
  116. package/dist/meetings/collection.js.map +1 -1
  117. package/dist/meetings/index.js +490 -560
  118. package/dist/meetings/index.js.map +1 -1
  119. package/dist/meetings/request.js +24 -41
  120. package/dist/meetings/request.js.map +1 -1
  121. package/dist/meetings/util.js +99 -155
  122. package/dist/meetings/util.js.map +1 -1
  123. package/dist/member/index.js +78 -86
  124. package/dist/member/index.js.map +1 -1
  125. package/dist/member/util.js +31 -68
  126. package/dist/member/util.js.map +1 -1
  127. package/dist/members/collection.js +3 -12
  128. package/dist/members/collection.js.map +1 -1
  129. package/dist/members/index.js +93 -200
  130. package/dist/members/index.js.map +1 -1
  131. package/dist/members/request.js +16 -39
  132. package/dist/members/request.js.map +1 -1
  133. package/dist/members/util.js +9 -38
  134. package/dist/members/util.js.map +1 -1
  135. package/dist/metrics/config.js +0 -2
  136. package/dist/metrics/config.js.map +1 -1
  137. package/dist/metrics/constants.js +1 -2
  138. package/dist/metrics/constants.js.map +1 -1
  139. package/dist/metrics/index.js +55 -135
  140. package/dist/metrics/index.js.map +1 -1
  141. package/dist/multistream/mediaRequestManager.js +57 -32
  142. package/dist/multistream/mediaRequestManager.js.map +1 -1
  143. package/dist/multistream/multistreamMedia.js +15 -21
  144. package/dist/multistream/multistreamMedia.js.map +1 -1
  145. package/dist/multistream/receiveSlot.js +10 -50
  146. package/dist/multistream/receiveSlot.js.map +1 -1
  147. package/dist/multistream/receiveSlotManager.js +45 -82
  148. package/dist/multistream/receiveSlotManager.js.map +1 -1
  149. package/dist/multistream/remoteMedia.js +18 -58
  150. package/dist/multistream/remoteMedia.js.map +1 -1
  151. package/dist/multistream/remoteMediaGroup.js +6 -40
  152. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  153. package/dist/multistream/remoteMediaManager.js +362 -416
  154. package/dist/multistream/remoteMediaManager.js.map +1 -1
  155. package/dist/networkQualityMonitor/index.js +36 -57
  156. package/dist/networkQualityMonitor/index.js.map +1 -1
  157. package/dist/personal-meeting-room/index.js +21 -45
  158. package/dist/personal-meeting-room/index.js.map +1 -1
  159. package/dist/personal-meeting-room/request.js +1 -31
  160. package/dist/personal-meeting-room/request.js.map +1 -1
  161. package/dist/personal-meeting-room/util.js +0 -13
  162. package/dist/personal-meeting-room/util.js.map +1 -1
  163. package/dist/reachability/index.js +138 -182
  164. package/dist/reachability/index.js.map +1 -1
  165. package/dist/reachability/request.js +3 -18
  166. package/dist/reachability/request.js.map +1 -1
  167. package/dist/reactions/constants.js +13 -0
  168. package/dist/reactions/constants.js.map +1 -0
  169. package/dist/reactions/reactions.js +109 -0
  170. package/dist/reactions/reactions.js.map +1 -0
  171. package/dist/reactions/reactions.type.js +36 -0
  172. package/dist/reactions/reactions.type.js.map +1 -0
  173. package/dist/reconnection-manager/index.js +322 -455
  174. package/dist/reconnection-manager/index.js.map +1 -1
  175. package/dist/recording-controller/enums.js +17 -0
  176. package/dist/recording-controller/enums.js.map +1 -0
  177. package/dist/recording-controller/index.js +343 -0
  178. package/dist/recording-controller/index.js.map +1 -0
  179. package/dist/recording-controller/util.js +63 -0
  180. package/dist/recording-controller/util.js.map +1 -0
  181. package/dist/roap/index.js +39 -64
  182. package/dist/roap/index.js.map +1 -1
  183. package/dist/roap/request.js +94 -113
  184. package/dist/roap/request.js.map +1 -1
  185. package/dist/roap/turnDiscovery.js +85 -94
  186. package/dist/roap/turnDiscovery.js.map +1 -1
  187. package/dist/statsAnalyzer/global.js +0 -2
  188. package/dist/statsAnalyzer/global.js.map +1 -1
  189. package/dist/statsAnalyzer/index.js +85 -175
  190. package/dist/statsAnalyzer/index.js.map +1 -1
  191. package/dist/statsAnalyzer/mqaUtil.js +72 -53
  192. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  193. package/dist/transcription/index.js +22 -47
  194. package/dist/transcription/index.js.map +1 -1
  195. package/internal-README.md +7 -6
  196. package/package.json +25 -20
  197. package/src/breakouts/README.md +190 -0
  198. package/src/breakouts/breakout.ts +110 -0
  199. package/src/breakouts/collection.ts +19 -0
  200. package/src/breakouts/index.ts +225 -0
  201. package/src/common/{browser-detection.js → browser-detection.ts} +9 -6
  202. package/src/common/collection.ts +9 -7
  203. package/src/common/{config.js → config.ts} +1 -1
  204. package/src/common/errors/{captcha-error.js → captcha-error.ts} +11 -7
  205. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +12 -7
  206. package/src/common/errors/{join-meeting.js → join-meeting.ts} +17 -8
  207. package/src/common/errors/{media.js → media.ts} +11 -7
  208. package/src/common/errors/parameter.ts +11 -7
  209. package/src/common/errors/{password-error.js → password-error.ts} +11 -7
  210. package/src/common/errors/{permission.js → permission.ts} +10 -6
  211. package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
  212. package/src/common/errors/{reconnection.js → reconnection.ts} +11 -7
  213. package/src/common/errors/{stats.js → stats.ts} +11 -7
  214. package/src/common/errors/{webex-errors.js → webex-errors.ts} +8 -7
  215. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +4 -2
  216. package/src/common/events/{events-scope.js → events-scope.ts} +6 -2
  217. package/src/common/events/{events.js → events.ts} +5 -1
  218. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +9 -5
  219. package/src/common/events/{util.js → util.ts} +2 -3
  220. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  221. package/src/common/logs/logger-proxy.ts +44 -0
  222. package/src/common/logs/{request.js → request.ts} +22 -9
  223. package/src/common/queue.ts +1 -2
  224. package/src/{config.js → config.ts} +17 -12
  225. package/src/constants.ts +40 -1
  226. package/src/index.js +2 -1
  227. package/src/locus-info/controlsUtils.ts +114 -0
  228. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  229. package/src/locus-info/{fullState.js → fullState.ts} +16 -12
  230. package/src/locus-info/{hostUtils.js → hostUtils.ts} +9 -8
  231. package/src/locus-info/{index.js → index.ts} +148 -64
  232. package/src/locus-info/{infoUtils.js → infoUtils.ts} +19 -8
  233. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +17 -17
  234. package/src/locus-info/{parser.js → parser.ts} +67 -79
  235. package/src/locus-info/{selfUtils.js → selfUtils.ts} +123 -68
  236. package/src/media/{index.js → index.ts} +181 -131
  237. package/src/media/{properties.js → properties.ts} +47 -28
  238. package/src/media/{util.js → util.ts} +2 -2
  239. package/src/mediaQualityMetrics/{config.js → config.ts} +46 -46
  240. package/src/meeting/{effectsState.js → effectsState.ts} +47 -41
  241. package/src/meeting/in-meeting-actions.ts +15 -3
  242. package/src/meeting/{index.js → index.ts} +2263 -1427
  243. package/src/meeting/{muteState.js → muteState.ts} +78 -42
  244. package/src/meeting/{request.js → request.ts} +292 -142
  245. package/src/meeting/request.type.ts +13 -0
  246. package/src/meeting/{state.js → state.ts} +50 -35
  247. package/src/meeting/{util.js → util.ts} +112 -115
  248. package/src/meeting-info/{collection.js → collection.ts} +6 -2
  249. package/src/meeting-info/{index.js → index.ts} +42 -36
  250. package/src/meeting-info/meeting-info-v2.ts +273 -0
  251. package/src/meeting-info/{request.js → request.ts} +14 -4
  252. package/src/meeting-info/{util.js → util.ts} +60 -51
  253. package/src/meeting-info/{utilv2.js → utilv2.ts} +65 -58
  254. package/src/meetings/{collection.js → collection.ts} +6 -3
  255. package/src/meetings/index.ts +1159 -0
  256. package/src/meetings/{request.js → request.ts} +32 -25
  257. package/src/meetings/{util.js → util.ts} +34 -32
  258. package/src/member/{index.js → index.ts} +102 -56
  259. package/src/member/{util.js → util.ts} +52 -25
  260. package/src/members/{collection.js → collection.ts} +2 -2
  261. package/src/members/{index.js → index.ts} +219 -142
  262. package/src/members/{request.js → request.ts} +60 -16
  263. package/src/members/{util.js → util.ts} +50 -48
  264. package/src/metrics/{config.js → config.ts} +254 -83
  265. package/src/metrics/{constants.js → constants.ts} +0 -2
  266. package/src/metrics/{index.js → index.ts} +106 -74
  267. package/src/multistream/mediaRequestManager.ts +81 -15
  268. package/src/multistream/multistreamMedia.ts +5 -0
  269. package/src/multistream/receiveSlot.ts +18 -12
  270. package/src/multistream/receiveSlotManager.ts +23 -21
  271. package/src/multistream/remoteMedia.ts +15 -5
  272. package/src/multistream/remoteMediaGroup.ts +4 -3
  273. package/src/multistream/remoteMediaManager.ts +153 -37
  274. package/src/networkQualityMonitor/{index.js → index.ts} +37 -25
  275. package/src/personal-meeting-room/{index.js → index.ts} +28 -19
  276. package/src/personal-meeting-room/{request.js → request.ts} +13 -4
  277. package/src/personal-meeting-room/{util.js → util.ts} +4 -4
  278. package/src/reachability/{index.js → index.ts} +99 -83
  279. package/src/reachability/request.ts +39 -33
  280. package/src/reactions/constants.ts +4 -0
  281. package/src/reactions/reactions.ts +104 -0
  282. package/src/reactions/reactions.type.ts +62 -0
  283. package/src/reconnection-manager/{index.js → index.ts} +195 -102
  284. package/src/recording-controller/enums.ts +8 -0
  285. package/src/recording-controller/index.ts +315 -0
  286. package/src/recording-controller/util.ts +58 -0
  287. package/src/roap/{index.js → index.ts} +73 -56
  288. package/src/roap/request.ts +157 -0
  289. package/src/roap/turnDiscovery.ts +77 -37
  290. package/src/statsAnalyzer/{global.js → global.ts} +30 -33
  291. package/src/statsAnalyzer/{index.js → index.ts} +468 -192
  292. package/src/statsAnalyzer/mqaUtil.ts +290 -0
  293. package/src/transcription/{index.js → index.ts} +46 -39
  294. package/test/integration/spec/journey.js +664 -463
  295. package/test/integration/spec/space-meeting.js +320 -206
  296. package/test/integration/spec/transcription.js +7 -8
  297. package/test/unit/spec/breakouts/breakout.ts +119 -0
  298. package/test/unit/spec/breakouts/collection.ts +15 -0
  299. package/test/unit/spec/breakouts/index.ts +293 -0
  300. package/test/unit/spec/common/browser-detection.js +9 -28
  301. package/test/unit/spec/fixture/locus.js +92 -90
  302. package/test/unit/spec/locus-info/controlsUtils.js +25 -5
  303. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  304. package/test/unit/spec/locus-info/index.js +104 -2
  305. package/test/unit/spec/locus-info/infoUtils.js +41 -32
  306. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  307. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  308. package/test/unit/spec/locus-info/parser.js +3 -9
  309. package/test/unit/spec/locus-info/selfConstant.js +97 -103
  310. package/test/unit/spec/locus-info/selfUtils.js +105 -12
  311. package/test/unit/spec/media/index.ts +31 -47
  312. package/test/unit/spec/media/properties.ts +9 -9
  313. package/test/unit/spec/meeting/effectsState.js +39 -45
  314. package/test/unit/spec/meeting/in-meeting-actions.ts +5 -2
  315. package/test/unit/spec/meeting/index.js +2017 -742
  316. package/test/unit/spec/meeting/muteState.js +42 -33
  317. package/test/unit/spec/meeting/request.js +115 -44
  318. package/test/unit/spec/meeting/utils.js +104 -171
  319. package/test/unit/spec/meeting-info/meetinginfov2.js +100 -73
  320. package/test/unit/spec/meeting-info/request.js +7 -9
  321. package/test/unit/spec/meeting-info/util.js +11 -12
  322. package/test/unit/spec/meeting-info/utilv2.js +110 -74
  323. package/test/unit/spec/meetings/collection.js +1 -1
  324. package/test/unit/spec/meetings/index.js +439 -257
  325. package/test/unit/spec/meetings/utils.js +14 -12
  326. package/test/unit/spec/member/index.js +0 -1
  327. package/test/unit/spec/member/util.js +31 -7
  328. package/test/unit/spec/members/index.js +104 -54
  329. package/test/unit/spec/members/request.js +29 -20
  330. package/test/unit/spec/members/utils.js +8 -5
  331. package/test/unit/spec/metrics/index.js +16 -21
  332. package/test/unit/spec/multistream/mediaRequestManager.ts +316 -50
  333. package/test/unit/spec/multistream/receiveSlot.ts +6 -6
  334. package/test/unit/spec/multistream/receiveSlotManager.ts +13 -13
  335. package/test/unit/spec/multistream/remoteMedia.ts +10 -2
  336. package/test/unit/spec/multistream/remoteMediaGroup.ts +5 -5
  337. package/test/unit/spec/multistream/remoteMediaManager.ts +412 -65
  338. package/test/unit/spec/networkQualityMonitor/index.js +21 -15
  339. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  340. package/test/unit/spec/reachability/index.ts +58 -26
  341. package/test/unit/spec/reconnection-manager/index.js +102 -9
  342. package/test/unit/spec/recording-controller/index.js +231 -0
  343. package/test/unit/spec/recording-controller/util.js +102 -0
  344. package/test/unit/spec/roap/index.ts +2 -1
  345. package/test/unit/spec/roap/request.ts +114 -0
  346. package/test/unit/spec/roap/turnDiscovery.ts +64 -45
  347. package/test/unit/spec/stats-analyzer/index.js +27 -22
  348. package/test/utils/cmr.js +44 -42
  349. package/test/utils/testUtils.js +83 -74
  350. package/test/utils/webex-config.js +18 -18
  351. package/test/utils/webex-test-users.js +54 -50
  352. package/tsconfig.json +6 -0
  353. package/dist/media/internal-media-core-wrapper.js +0 -22
  354. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  355. package/dist/peer-connection-manager/util.js +0 -124
  356. package/dist/peer-connection-manager/util.js.map +0 -1
  357. package/src/common/logs/logger-proxy.js +0 -33
  358. package/src/locus-info/controlsUtils.js +0 -102
  359. package/src/media/internal-media-core-wrapper.ts +0 -9
  360. package/src/meeting-info/meeting-info-v2.js +0 -255
  361. package/src/meetings/index.js +0 -1015
  362. package/src/peer-connection-manager/util.ts +0 -117
  363. package/src/roap/request.js +0 -127
  364. package/src/statsAnalyzer/mqaUtil.js +0 -173
  365. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
@@ -1,95 +1,60 @@
1
1
  "use strict";
2
2
 
3
3
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
-
5
4
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
6
-
7
5
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
8
-
9
6
  _Object$defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
-
13
9
  exports.RemoteMediaManager = exports.Event = exports.DefaultConfiguration = void 0;
14
-
15
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
-
17
11
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
18
-
19
12
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
20
-
21
13
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
22
-
23
14
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
24
-
25
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
26
-
27
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
28
-
29
17
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
30
-
31
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
32
-
33
19
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
34
-
35
20
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
36
-
37
21
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
38
-
39
22
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
40
-
41
23
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
42
-
43
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
44
-
45
25
  var _remove2 = _interopRequireDefault(require("lodash/remove"));
46
-
47
26
  var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
48
-
49
27
  var _internalMediaCore = require("@webex/internal-media-core");
50
-
51
28
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
52
-
53
29
  var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
54
-
55
30
  var _remoteMedia = require("./remoteMedia");
56
-
57
31
  var _remoteMediaGroup = require("./remoteMediaGroup");
58
-
59
32
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
60
-
61
33
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
62
-
63
34
  /* Predefined layouts: */
35
+
64
36
  // An "all equal" grid, with size up to 3 x 3 = 9:
65
37
  var AllEqualLayout = {
66
- screenShareVideo: {
67
- size: null
68
- },
69
38
  activeSpeakerVideoPaneGroups: [{
70
39
  id: 'main',
71
40
  numPanes: 9,
72
41
  size: 'best',
73
42
  priority: 255
74
43
  }]
75
- }; // A layout with just a single remote active speaker video pane:
44
+ };
76
45
 
46
+ // A layout with just a single remote active speaker video pane:
77
47
  var SingleLayout = {
78
- screenShareVideo: {
79
- size: null
80
- },
81
48
  activeSpeakerVideoPaneGroups: [{
82
49
  id: 'main',
83
50
  numPanes: 1,
84
51
  size: 'best',
85
52
  priority: 255
86
53
  }]
87
- }; // A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:
54
+ };
88
55
 
56
+ // A layout with 1 big pane for the highest priority active speaker and 5 small panes for other active speakers:
89
57
  var OnePlusFiveLayout = {
90
- screenShareVideo: {
91
- size: null
92
- },
93
58
  activeSpeakerVideoPaneGroups: [{
94
59
  id: 'mainBigOne',
95
60
  numPanes: 1,
@@ -101,12 +66,10 @@ var OnePlusFiveLayout = {
101
66
  size: 'very small',
102
67
  priority: 254
103
68
  }]
104
- }; // A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:
69
+ };
105
70
 
71
+ // A layout with 2 big panes for 2 main active speakers and a strip of 6 small panes for other active speakers:
106
72
  var TwoMainPlusSixSmallLayout = {
107
- screenShareVideo: {
108
- size: null
109
- },
110
73
  activeSpeakerVideoPaneGroups: [{
111
74
  id: 'mainGroupWith2BigPanes',
112
75
  numPanes: 2,
@@ -118,24 +81,21 @@ var TwoMainPlusSixSmallLayout = {
118
81
  size: 'small',
119
82
  priority: 254
120
83
  }]
121
- }; // A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:
84
+ };
122
85
 
86
+ // A strip of 8 small video panes (thumbnails) displayed at the top of a remote screenshare:
123
87
  var RemoteScreenShareWithSmallThumbnailsLayout = {
124
- screenShareVideo: {
125
- size: 'best'
126
- },
88
+ // screenShareVideo: {size: 'best'}, // todo: SPARK-393485: uncomment this once backend supports screen sharing
127
89
  activeSpeakerVideoPaneGroups: [{
128
90
  id: 'thumbnails',
129
91
  numPanes: 8,
130
92
  size: 'thumbnail',
131
93
  priority: 255
132
94
  }]
133
- }; // A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:
95
+ };
134
96
 
97
+ // A staged layout with 4 pre-selected meeting participants in the main 2x2 grid and 6 small panes for other active speakers at the top:
135
98
  var Stage2x2With6ThumbnailsLayout = {
136
- screenShareVideo: {
137
- size: null
138
- },
139
99
  activeSpeakerVideoPaneGroups: [{
140
100
  id: 'thumbnails',
141
101
  numPanes: 6,
@@ -160,17 +120,19 @@ var Stage2x2With6ThumbnailsLayout = {
160
120
  csi: undefined
161
121
  }]
162
122
  };
123
+
163
124
  /**
164
125
  * Default configuration:
165
126
  * - uses 3 audio streams
166
127
  * - prefers active speakers with live video (e.g. are not audio only or video muted) over active speakers without live video
167
128
  * - has a few layouts defined, including 1 that contains remote screen share (ScreenShareView)
168
129
  */
169
-
170
130
  var DefaultConfiguration = {
171
131
  audio: {
172
- numOfActiveSpeakerStreams: 3
132
+ numOfActiveSpeakerStreams: 3,
133
+ numOfScreenShareStreams: 0 // todo: SPARK-393485: change to 1 once backend supports screen sharing
173
134
  },
135
+
174
136
  video: {
175
137
  preferLiveVideo: true,
176
138
  initialLayoutId: 'AllEqual',
@@ -181,22 +143,16 @@ var DefaultConfiguration = {
181
143
  Stage: Stage2x2With6ThumbnailsLayout,
182
144
  ScreenShareView: RemoteScreenShareWithSmallThumbnailsLayout
183
145
  }
184
- },
185
- screenShare: {
186
- audio: true,
187
- video: true
188
146
  }
189
147
  };
190
148
  exports.DefaultConfiguration = DefaultConfiguration;
191
149
  var Event;
192
150
  exports.Event = Event;
193
-
194
151
  (function (Event) {
195
152
  Event["AudioCreated"] = "AudioCreated";
196
- Event["ScreenShareAudioCreated"] = "ScreenShareCreated";
153
+ Event["ScreenShareAudioCreated"] = "ScreenShareAudioCreated";
197
154
  Event["VideoLayoutChanged"] = "VideoLayoutChanged";
198
155
  })(Event || (exports.Event = Event = {}));
199
-
200
156
  /**
201
157
  * A helper class that manages all remote audio/video streams in order to achieve a predefined set of layouts.
202
158
  * It also creates a fixed number of audio streams and these don't change during the meeting.
@@ -207,9 +163,7 @@ exports.Event = Event;
207
163
  */
208
164
  var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
209
165
  (0, _inherits2.default)(RemoteMediaManager, _EventsScope);
210
-
211
166
  var _super = _createSuper(RemoteMediaManager);
212
-
213
167
  /**
214
168
  * Constructor
215
169
  *
@@ -219,7 +173,6 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
219
173
  */
220
174
  function RemoteMediaManager(receiveSlotManager, mediaRequestManagers) {
221
175
  var _this;
222
-
223
176
  var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DefaultConfiguration;
224
177
  (0, _classCallCheck2.default)(this, RemoteMediaManager);
225
178
  _this = _super.call(this);
@@ -241,15 +194,19 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
241
194
  video: {
242
195
  activeSpeakerGroups: {},
243
196
  memberPanes: {}
197
+ },
198
+ screenShare: {
199
+ audio: undefined,
200
+ video: undefined
244
201
  }
245
202
  };
246
-
247
203
  _this.checkConfigValidity();
248
-
249
204
  _this.slots = {
250
205
  audio: [],
251
- screenShareAudio: undefined,
252
- screenShareVideo: undefined,
206
+ screenShare: {
207
+ audio: [],
208
+ video: undefined
209
+ },
253
210
  video: {
254
211
  unused: [],
255
212
  activeSpeaker: [],
@@ -260,27 +217,23 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
260
217
  activeSpeaker: {},
261
218
  receiverSelected: {}
262
219
  };
263
-
264
220
  _loggerProxy.default.logger.log("RemoteMediaManager#constructor --> RemoteMediaManager created with config: ".concat((0, _stringify.default)(_this.config)));
265
-
266
221
  return _this;
267
222
  }
223
+
268
224
  /**
269
225
  * Checks if configuration is valid, throws an error if it's not
270
226
  */
271
-
272
-
273
227
  (0, _createClass2.default)(RemoteMediaManager, [{
274
228
  key: "checkConfigValidity",
275
229
  value: function checkConfigValidity() {
276
230
  if (!(this.config.video.initialLayoutId in this.config.video.layouts)) {
277
231
  throw new Error("invalid config: initialLayoutId \"".concat(this.config.video.initialLayoutId, "\" doesn't match any of the layouts"));
278
- } // check if each layout is valid
279
-
232
+ }
280
233
 
234
+ // check if each layout is valid
281
235
  (0, _values.default)(this.config.video.layouts).forEach(function (layout) {
282
236
  var _layout$activeSpeaker, _layout$memberVideoPa;
283
-
284
237
  var groupIds = {};
285
238
  var paneIds = {};
286
239
  var groupPriorites = {};
@@ -288,186 +241,172 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
288
241
  if (groupIds[group.id]) {
289
242
  throw new Error("invalid config: duplicate active speaker video pane group id: ".concat(group.id));
290
243
  }
291
-
292
244
  groupIds[group.id] = true;
293
-
294
245
  if (groupPriorites[group.priority]) {
295
246
  throw new Error("invalid config: multiple active speaker video pane groups have same priority: ".concat(group.priority));
296
247
  }
297
-
298
248
  groupPriorites[group.priority] = true;
299
249
  });
300
250
  (_layout$memberVideoPa = layout.memberVideoPanes) === null || _layout$memberVideoPa === void 0 ? void 0 : _layout$memberVideoPa.forEach(function (pane) {
301
251
  if (paneIds[pane.id]) {
302
252
  throw new Error("invalid config: duplicate member video pane id: ".concat(pane.id));
303
253
  }
304
-
305
254
  paneIds[pane.id] = true;
306
255
  });
307
256
  });
308
257
  }
258
+
309
259
  /**
310
260
  * Starts the RemoteMediaManager.
311
261
  *
312
262
  * @returns {Promise}
313
263
  */
314
-
315
264
  }, {
316
265
  key: "start",
317
266
  value: function () {
318
267
  var _start = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
319
268
  return _regenerator.default.wrap(function _callee$(_context) {
320
- while (1) {
321
- switch (_context.prev = _context.next) {
322
- case 0:
323
- if (!this.started) {
324
- _context.next = 2;
325
- break;
326
- }
327
-
328
- throw new Error('start() failure: already started');
329
-
330
- case 2:
331
- this.started = true;
332
- _context.next = 5;
333
- return this.createAudioMedia();
334
-
335
- case 5:
336
- _context.next = 7;
337
- return this.preallocateVideoReceiveSlots();
338
-
339
- case 7:
340
- _context.next = 9;
341
- return this.setLayout(this.config.video.initialLayoutId);
342
-
343
- case 9:
344
- case "end":
345
- return _context.stop();
346
- }
269
+ while (1) switch (_context.prev = _context.next) {
270
+ case 0:
271
+ if (!this.started) {
272
+ _context.next = 2;
273
+ break;
274
+ }
275
+ throw new Error('start() failure: already started');
276
+ case 2:
277
+ this.started = true;
278
+ _context.next = 5;
279
+ return this.createAudioMedia();
280
+ case 5:
281
+ _context.next = 7;
282
+ return this.createScreenShareReceiveSlots();
283
+ case 7:
284
+ this.createScreenShareAudioMedia();
285
+ _context.next = 10;
286
+ return this.preallocateVideoReceiveSlots();
287
+ case 10:
288
+ _context.next = 12;
289
+ return this.setLayout(this.config.video.initialLayoutId);
290
+ case 12:
291
+ case "end":
292
+ return _context.stop();
347
293
  }
348
294
  }, _callee, this);
349
295
  }));
350
-
351
296
  function start() {
352
297
  return _start.apply(this, arguments);
353
298
  }
354
-
355
299
  return start;
356
300
  }()
357
301
  /**
358
302
  * Releases all the used resources (like allocated receive slots). This function needs
359
303
  * to be called when we leave the meeting, etc.
360
304
  */
361
-
362
305
  }, {
363
306
  key: "stop",
364
307
  value: function stop() {
365
308
  var _this2 = this,
366
- _this$slots$video$unu,
367
- _this$slots$video$unu2;
368
-
309
+ _this$slots$video$unu,
310
+ _this$slots$video$unu2;
369
311
  // invalidate all remoteMedia objects
370
312
  this.invalidateCurrentRemoteMedia({
371
313
  audio: true,
372
314
  video: true,
315
+ screenShareAudio: true,
316
+ screenShareVideo: true,
373
317
  commit: true
374
- }); // release all audio receive slots
318
+ });
375
319
 
320
+ // release all audio receive slots
376
321
  this.slots.audio.forEach(function (slot) {
377
322
  return _this2.receiveSlotManager.releaseSlot(slot);
378
323
  });
379
- this.slots.audio.length = 0; // todo: screenshare slots... (SPARK-377812)
324
+ this.slots.audio.length = 0;
380
325
 
326
+ // release screen share slots
327
+ this.slots.screenShare.audio.forEach(function (slot) {
328
+ return _this2.receiveSlotManager.releaseSlot(slot);
329
+ });
330
+ this.slots.screenShare.audio.length = 0;
331
+ if (this.slots.screenShare.video) {
332
+ this.receiveSlotManager.releaseSlot(this.slots.screenShare.video);
333
+ this.slots.screenShare.video = undefined;
334
+ }
335
+
336
+ // release video slots
381
337
  this.receiveSlotAllocations = {
382
338
  activeSpeaker: {},
383
339
  receiverSelected: {}
384
340
  };
385
-
386
341
  (_this$slots$video$unu = this.slots.video.unused).push.apply(_this$slots$video$unu, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
387
-
388
342
  this.slots.video.activeSpeaker.length = 0;
389
-
390
343
  (_this$slots$video$unu2 = this.slots.video.unused).push.apply(_this$slots$video$unu2, (0, _toConsumableArray2.default)(this.slots.video.receiverSelected));
391
-
392
344
  this.slots.video.receiverSelected.length = 0;
393
345
  this.releaseUnusedVideoSlots();
394
346
  this.currentLayout = undefined;
395
347
  this.currentLayoutId = undefined;
396
348
  this.started = false;
397
349
  }
350
+
398
351
  /**
399
352
  * Returns the total number of main video panes required for a given layout
400
353
  *
401
354
  * @param {VideoLayout} layout
402
355
  * @returns {number}
403
356
  */
404
-
405
357
  }, {
406
358
  key: "getRequiredNumVideoSlotsForLayout",
407
359
  value: function getRequiredNumVideoSlotsForLayout(layout) {
408
360
  var _layout$activeSpeaker2, _layout$memberVideoPa2;
409
-
410
361
  if (!layout) {
411
362
  return 0;
412
363
  }
413
-
414
364
  var activeSpeakerCount = ((_layout$activeSpeaker2 = layout.activeSpeakerVideoPaneGroups) === null || _layout$activeSpeaker2 === void 0 ? void 0 : _layout$activeSpeaker2.reduce(function (sum, paneGroup) {
415
365
  return sum + paneGroup.numPanes;
416
366
  }, 0)) || 0;
417
367
  var receiverSelectedCount = ((_layout$memberVideoPa2 = layout.memberVideoPanes) === null || _layout$memberVideoPa2 === void 0 ? void 0 : _layout$memberVideoPa2.length) || 0;
418
368
  return activeSpeakerCount + receiverSelectedCount;
419
369
  }
370
+
420
371
  /**
421
372
  * Allocates the maximum number of panes that any of the configured layouts will require.
422
373
  * We do this at the beginning, because it's more efficient (much faster) then allocating receive slots
423
374
  * later, after the SDP exchange was done.
424
375
  */
425
-
426
376
  }, {
427
377
  key: "preallocateVideoReceiveSlots",
428
378
  value: function () {
429
379
  var _preallocateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
430
380
  var _this3 = this;
431
-
432
381
  var maxNumVideoPanesRequired;
433
382
  return _regenerator.default.wrap(function _callee2$(_context2) {
434
- while (1) {
435
- switch (_context2.prev = _context2.next) {
436
- case 0:
437
- maxNumVideoPanesRequired = (0, _values.default)(this.config.video.layouts).reduce(function (maxValue, layout) {
438
- return Math.max(maxValue, _this3.getRequiredNumVideoSlotsForLayout(layout));
439
- }, 0);
440
-
441
- case 1:
442
- if (!(this.slots.video.unused.length < maxNumVideoPanesRequired)) {
443
- _context2.next = 9;
444
- break;
445
- }
446
-
447
- _context2.t0 = this.slots.video.unused;
448
- _context2.next = 5;
449
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
450
-
451
- case 5:
452
- _context2.t1 = _context2.sent;
453
-
454
- _context2.t0.push.call(_context2.t0, _context2.t1);
455
-
456
- _context2.next = 1;
383
+ while (1) switch (_context2.prev = _context2.next) {
384
+ case 0:
385
+ maxNumVideoPanesRequired = (0, _values.default)(this.config.video.layouts).reduce(function (maxValue, layout) {
386
+ return Math.max(maxValue, _this3.getRequiredNumVideoSlotsForLayout(layout));
387
+ }, 0);
388
+ case 1:
389
+ if (!(this.slots.video.unused.length < maxNumVideoPanesRequired)) {
390
+ _context2.next = 9;
457
391
  break;
458
-
459
- case 9:
460
- case "end":
461
- return _context2.stop();
462
- }
392
+ }
393
+ _context2.t0 = this.slots.video.unused;
394
+ _context2.next = 5;
395
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
396
+ case 5:
397
+ _context2.t1 = _context2.sent;
398
+ _context2.t0.push.call(_context2.t0, _context2.t1);
399
+ _context2.next = 1;
400
+ break;
401
+ case 9:
402
+ case "end":
403
+ return _context2.stop();
463
404
  }
464
405
  }, _callee2, this);
465
406
  }));
466
-
467
407
  function preallocateVideoReceiveSlots() {
468
408
  return _preallocateVideoReceiveSlots.apply(this, arguments);
469
409
  }
470
-
471
410
  return preallocateVideoReceiveSlots;
472
411
  }()
473
412
  /**
@@ -476,52 +415,42 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
476
415
  * @param {LayoutId} layoutId new layout id
477
416
  * @returns {Promise}
478
417
  */
479
-
480
418
  }, {
481
419
  key: "setLayout",
482
420
  value: function () {
483
421
  var _setLayout = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(layoutId) {
484
422
  return _regenerator.default.wrap(function _callee3$(_context3) {
485
- while (1) {
486
- switch (_context3.prev = _context3.next) {
487
- case 0:
488
- if (layoutId in this.config.video.layouts) {
489
- _context3.next = 2;
490
- break;
491
- }
492
-
493
- throw new Error("invalid layoutId: \"".concat(layoutId, "\" doesn't match any of the configured layouts"));
494
-
495
- case 2:
496
- if (this.started) {
497
- _context3.next = 4;
498
- break;
499
- }
500
-
501
- throw new Error('setLayout() called before start()');
502
-
503
- case 4:
504
- this.currentLayoutId = layoutId;
505
- this.currentLayout = (0, _cloneDeep2.default)(this.config.video.layouts[this.currentLayoutId]);
506
- _context3.next = 8;
507
- return this.updateVideoReceiveSlots();
508
-
509
- case 8:
510
- this.updateVideoRemoteMediaObjects();
511
- this.emitVideoLayoutChangedEvent();
512
-
513
- case 10:
514
- case "end":
515
- return _context3.stop();
516
- }
423
+ while (1) switch (_context3.prev = _context3.next) {
424
+ case 0:
425
+ if (layoutId in this.config.video.layouts) {
426
+ _context3.next = 2;
427
+ break;
428
+ }
429
+ throw new Error("invalid layoutId: \"".concat(layoutId, "\" doesn't match any of the configured layouts"));
430
+ case 2:
431
+ if (this.started) {
432
+ _context3.next = 4;
433
+ break;
434
+ }
435
+ throw new Error('setLayout() called before start()');
436
+ case 4:
437
+ this.currentLayoutId = layoutId;
438
+ this.currentLayout = (0, _cloneDeep2.default)(this.config.video.layouts[this.currentLayoutId]);
439
+ _context3.next = 8;
440
+ return this.updateVideoReceiveSlots();
441
+ case 8:
442
+ this.updateVideoRemoteMediaObjects();
443
+ this.updateScreenShareVideoRemoteMediaObject();
444
+ this.emitVideoLayoutChangedEvent();
445
+ case 11:
446
+ case "end":
447
+ return _context3.stop();
517
448
  }
518
449
  }, _callee3, this);
519
450
  }));
520
-
521
451
  function setLayout(_x) {
522
452
  return _setLayout.apply(this, arguments);
523
453
  }
524
-
525
454
  return setLayout;
526
455
  }()
527
456
  /**
@@ -529,127 +458,175 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
529
458
  *
530
459
  * @returns {LayoutId}
531
460
  */
532
-
533
461
  }, {
534
462
  key: "getLayoutId",
535
463
  value: function getLayoutId() {
536
464
  return this.currentLayoutId;
537
465
  }
466
+
538
467
  /**
539
468
  * Creates the audio slots
540
469
  */
541
-
542
470
  }, {
543
471
  key: "createAudioMedia",
544
472
  value: function () {
545
473
  var _createAudioMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
546
474
  var i, slot;
547
475
  return _regenerator.default.wrap(function _callee4$(_context4) {
548
- while (1) {
549
- switch (_context4.prev = _context4.next) {
550
- case 0:
551
- i = 0;
552
-
553
- case 1:
554
- if (!(i < this.config.audio.numOfActiveSpeakerStreams)) {
555
- _context4.next = 9;
556
- break;
557
- }
558
-
559
- _context4.next = 4;
560
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.AudioMain);
561
-
562
- case 4:
563
- slot = _context4.sent;
564
- this.slots.audio.push(slot);
565
-
566
- case 6:
567
- i += 1;
568
- _context4.next = 1;
476
+ while (1) switch (_context4.prev = _context4.next) {
477
+ case 0:
478
+ i = 0;
479
+ case 1:
480
+ if (!(i < this.config.audio.numOfActiveSpeakerStreams)) {
481
+ _context4.next = 9;
569
482
  break;
570
-
571
- case 9:
572
- // create a remote media group
573
- this.media.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.audio, this.slots.audio, 255, true);
574
- this.emit({
575
- file: 'multistream/remoteMediaManager',
576
- function: 'createAudioMedia'
577
- }, Event.AudioCreated, this.media.audio);
578
-
579
- case 11:
580
- case "end":
581
- return _context4.stop();
582
- }
483
+ }
484
+ _context4.next = 4;
485
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.AudioMain);
486
+ case 4:
487
+ slot = _context4.sent;
488
+ this.slots.audio.push(slot);
489
+ case 6:
490
+ i += 1;
491
+ _context4.next = 1;
492
+ break;
493
+ case 9:
494
+ // create a remote media group
495
+ this.media.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.audio, this.slots.audio, 255, true);
496
+ this.emit({
497
+ file: 'multistream/remoteMediaManager',
498
+ function: 'createAudioMedia'
499
+ }, Event.AudioCreated, this.media.audio);
500
+ case 11:
501
+ case "end":
502
+ return _context4.stop();
583
503
  }
584
504
  }, _callee4, this);
585
505
  }));
586
-
587
506
  function createAudioMedia() {
588
507
  return _createAudioMedia.apply(this, arguments);
589
508
  }
590
-
591
509
  return createAudioMedia;
592
510
  }()
511
+ /**
512
+ * Creates receive slots required for receiving screen share audio and video
513
+ */
514
+ }, {
515
+ key: "createScreenShareReceiveSlots",
516
+ value: function () {
517
+ var _createScreenShareReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
518
+ var i, slot, isAnyLayoutContainingScreenShareVideo;
519
+ return _regenerator.default.wrap(function _callee5$(_context5) {
520
+ while (1) switch (_context5.prev = _context5.next) {
521
+ case 0:
522
+ i = 0;
523
+ case 1:
524
+ if (!(i < this.config.audio.numOfScreenShareStreams)) {
525
+ _context5.next = 9;
526
+ break;
527
+ }
528
+ _context5.next = 4;
529
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.AudioSlides);
530
+ case 4:
531
+ slot = _context5.sent;
532
+ this.slots.screenShare.audio.push(slot);
533
+ case 6:
534
+ i += 1;
535
+ _context5.next = 1;
536
+ break;
537
+ case 9:
538
+ // video
539
+ isAnyLayoutContainingScreenShareVideo = (0, _values.default)(this.config.video.layouts).some(function (layout) {
540
+ return !!layout.screenShareVideo;
541
+ });
542
+ if (!isAnyLayoutContainingScreenShareVideo) {
543
+ _context5.next = 14;
544
+ break;
545
+ }
546
+ _context5.next = 13;
547
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoSlides);
548
+ case 13:
549
+ this.slots.screenShare.video = _context5.sent;
550
+ case 14:
551
+ case "end":
552
+ return _context5.stop();
553
+ }
554
+ }, _callee5, this);
555
+ }));
556
+ function createScreenShareReceiveSlots() {
557
+ return _createScreenShareReceiveSlots.apply(this, arguments);
558
+ }
559
+ return createScreenShareReceiveSlots;
560
+ }()
561
+ /**
562
+ * Creates RemoteMedia objects for screen share
563
+ */
564
+ }, {
565
+ key: "createScreenShareAudioMedia",
566
+ value: function createScreenShareAudioMedia() {
567
+ if (this.slots.screenShare.audio.length > 0) {
568
+ this.media.screenShare.audio = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.screenShareAudio, this.slots.screenShare.audio, 255, true);
569
+ this.emit({
570
+ file: 'multistream/remoteMediaManager',
571
+ function: 'createScreenShareAudioMedia'
572
+ }, Event.ScreenShareAudioCreated, this.media.screenShare.audio);
573
+ }
574
+ }
575
+
593
576
  /**
594
577
  * Goes over all receiver-selected slots and keeps only the ones that are required by a given layout,
595
578
  * the rest are all moved to the "unused" list
596
579
  */
597
-
598
580
  }, {
599
581
  key: "trimReceiverSelectedSlots",
600
582
  value: function trimReceiverSelectedSlots() {
601
583
  var _this$currentLayout, _this$currentLayout$m, _this$slots$video$unu3;
584
+ var requiredCsis = {};
602
585
 
603
- var requiredCsis = {}; // fill requiredCsis with all the CSIs that the given layout requires
604
-
586
+ // fill requiredCsis with all the CSIs that the given layout requires
605
587
  (_this$currentLayout = this.currentLayout) === null || _this$currentLayout === void 0 ? void 0 : (_this$currentLayout$m = _this$currentLayout.memberVideoPanes) === null || _this$currentLayout$m === void 0 ? void 0 : _this$currentLayout$m.forEach(function (memberVideoPane) {
606
588
  if (memberVideoPane.csi !== undefined) {
607
589
  requiredCsis[memberVideoPane.csi] = true;
608
590
  }
609
591
  });
610
-
611
592
  var isCsiNeededByCurrentLayout = function isCsiNeededByCurrentLayout(csi) {
612
593
  if (csi === undefined) {
613
594
  return false;
614
595
  }
615
-
616
596
  return !!requiredCsis[csi];
617
- }; // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused
618
-
597
+ };
619
598
 
599
+ // keep receiverSelected slots that match our new requiredCsis, move the rest of receiverSelected slots to unused
620
600
  var notNeededReceiverSelectedSlots = (0, _remove2.default)(this.slots.video.receiverSelected, function (slot) {
621
601
  return isCsiNeededByCurrentLayout(slot.csi) === false;
622
602
  });
623
-
624
603
  (_this$slots$video$unu3 = this.slots.video.unused).push.apply(_this$slots$video$unu3, (0, _toConsumableArray2.default)(notNeededReceiverSelectedSlots));
625
604
  }
605
+
626
606
  /**
627
607
  * Releases all the "unused" video slots.
628
608
  */
629
-
630
609
  }, {
631
610
  key: "releaseUnusedVideoSlots",
632
611
  value: function releaseUnusedVideoSlots() {
633
612
  var _this4 = this;
634
-
635
613
  this.slots.video.unused.forEach(function (slot) {
636
614
  return _this4.receiveSlotManager.releaseSlot(slot);
637
615
  });
638
616
  this.slots.video.unused.length = 0;
639
617
  }
618
+
640
619
  /**
641
620
  * Allocates receive slots to all video panes in the current selected layout
642
621
  */
643
-
644
622
  }, {
645
623
  key: "allocateSlotsToVideoPaneGroups",
646
624
  value: function allocateSlotsToVideoPaneGroups() {
647
625
  var _this$currentLayout2,
648
- _this$currentLayout2$,
649
- _this5 = this,
650
- _this$currentLayout3,
651
- _this$currentLayout3$;
652
-
626
+ _this$currentLayout2$,
627
+ _this5 = this,
628
+ _this$currentLayout3,
629
+ _this$currentLayout3$;
653
630
  this.receiveSlotAllocations = {
654
631
  activeSpeaker: {},
655
632
  receiverSelected: {}
@@ -658,14 +635,11 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
658
635
  _this5.receiveSlotAllocations.activeSpeaker[group.id] = {
659
636
  slots: []
660
637
  };
661
-
662
638
  for (var paneIndex = 0; paneIndex < group.numPanes; paneIndex += 1) {
663
639
  // allocate a slot from the "unused" list
664
640
  var freeSlot = _this5.slots.video.unused.pop();
665
-
666
641
  if (freeSlot) {
667
642
  _this5.slots.video.activeSpeaker.push(freeSlot);
668
-
669
643
  _this5.receiveSlotAllocations.activeSpeaker[group.id].slots.push(freeSlot);
670
644
  }
671
645
  }
@@ -675,132 +649,111 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
675
649
  var existingSlot = _this5.slots.video.receiverSelected.find(function (slot) {
676
650
  return slot.csi === memberPane.csi;
677
651
  });
678
-
679
652
  var isExistingSlotAlreadyAllocated = (0, _values.default)(_this5.receiveSlotAllocations.receiverSelected).includes(existingSlot);
680
-
681
653
  if (memberPane.csi !== undefined && existingSlot && !isExistingSlotAlreadyAllocated) {
682
654
  // found it, so use it
683
655
  _this5.receiveSlotAllocations.receiverSelected[memberPane.id] = existingSlot;
684
656
  } else {
685
657
  // allocate a slot from the "unused" list
686
658
  var freeSlot = _this5.slots.video.unused.pop();
687
-
688
659
  if (freeSlot) {
689
660
  _this5.slots.video.receiverSelected.push(freeSlot);
690
-
691
661
  _this5.receiveSlotAllocations.receiverSelected[memberPane.id] = freeSlot;
692
662
  }
693
663
  }
694
664
  });
695
665
  }
666
+
696
667
  /**
697
668
  * Makes sure we have the right number of receive slots created for the current layout
698
669
  * and allocates them to the right video panes / pane groups
699
670
  *
700
671
  * @returns {Promise}
701
672
  */
702
-
703
673
  }, {
704
674
  key: "updateVideoReceiveSlots",
705
675
  value: function () {
706
- var _updateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
676
+ var _updateVideoReceiveSlots = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
707
677
  var _this$slots$video$unu4;
708
-
709
678
  var requiredNumSlots, totalNumSlots, numSlotsToCreate;
710
- return _regenerator.default.wrap(function _callee5$(_context5) {
711
- while (1) {
712
- switch (_context5.prev = _context5.next) {
713
- case 0:
714
- requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);
715
- totalNumSlots = this.slots.video.unused.length + this.slots.video.activeSpeaker.length + this.slots.video.receiverSelected.length; // ensure we have enough total slots for current layout
716
-
717
- if (!(totalNumSlots < requiredNumSlots)) {
718
- _context5.next = 13;
719
- break;
720
- }
721
-
722
- numSlotsToCreate = requiredNumSlots - totalNumSlots;
723
-
724
- case 4:
725
- if (!(numSlotsToCreate > 0)) {
726
- _context5.next = 13;
727
- break;
728
- }
729
-
730
- _context5.t0 = this.slots.video.unused;
731
- _context5.next = 8;
732
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
733
-
734
- case 8:
735
- _context5.t1 = _context5.sent;
736
-
737
- _context5.t0.push.call(_context5.t0, _context5.t1);
738
-
739
- numSlotsToCreate -= 1;
740
- _context5.next = 4;
679
+ return _regenerator.default.wrap(function _callee6$(_context6) {
680
+ while (1) switch (_context6.prev = _context6.next) {
681
+ case 0:
682
+ requiredNumSlots = this.getRequiredNumVideoSlotsForLayout(this.currentLayout);
683
+ totalNumSlots = this.slots.video.unused.length + this.slots.video.activeSpeaker.length + this.slots.video.receiverSelected.length; // ensure we have enough total slots for current layout
684
+ if (!(totalNumSlots < requiredNumSlots)) {
685
+ _context6.next = 13;
741
686
  break;
742
-
743
- case 13:
744
- // move all no longer needed receiver-selected slots to "unused"
745
- this.trimReceiverSelectedSlots(); // move all active speaker slots to "unused"
746
-
747
- (_this$slots$video$unu4 = this.slots.video.unused).push.apply(_this$slots$video$unu4, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
748
-
749
- this.slots.video.activeSpeaker.length = 0; // allocate the slots to the right panes / pane groups
750
-
751
- this.allocateSlotsToVideoPaneGroups();
752
-
753
- _loggerProxy.default.logger.log("RemoteMediaManager#updateVideoReceiveSlots --> receive slots updated: unused=".concat(this.slots.video.unused.length, ", activeSpeaker=").concat(this.slots.video.activeSpeaker.length, ", receiverSelected=").concat(this.slots.video.receiverSelected.length)); // If this is the initial layout, there may be some "unused" slots left because of the preallocation
754
- // done in this.preallocateVideoReceiveSlots(), so release them now
755
-
756
-
757
- this.releaseUnusedVideoSlots();
758
-
759
- case 19:
760
- case "end":
761
- return _context5.stop();
762
- }
687
+ }
688
+ numSlotsToCreate = requiredNumSlots - totalNumSlots;
689
+ case 4:
690
+ if (!(numSlotsToCreate > 0)) {
691
+ _context6.next = 13;
692
+ break;
693
+ }
694
+ _context6.t0 = this.slots.video.unused;
695
+ _context6.next = 8;
696
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
697
+ case 8:
698
+ _context6.t1 = _context6.sent;
699
+ _context6.t0.push.call(_context6.t0, _context6.t1);
700
+ numSlotsToCreate -= 1;
701
+ _context6.next = 4;
702
+ break;
703
+ case 13:
704
+ // move all no longer needed receiver-selected slots to "unused"
705
+ this.trimReceiverSelectedSlots();
706
+
707
+ // move all active speaker slots to "unused"
708
+ (_this$slots$video$unu4 = this.slots.video.unused).push.apply(_this$slots$video$unu4, (0, _toConsumableArray2.default)(this.slots.video.activeSpeaker));
709
+ this.slots.video.activeSpeaker.length = 0;
710
+
711
+ // allocate the slots to the right panes / pane groups
712
+ this.allocateSlotsToVideoPaneGroups();
713
+ _loggerProxy.default.logger.log("RemoteMediaManager#updateVideoReceiveSlots --> receive slots updated: unused=".concat(this.slots.video.unused.length, ", activeSpeaker=").concat(this.slots.video.activeSpeaker.length, ", receiverSelected=").concat(this.slots.video.receiverSelected.length));
714
+
715
+ // If this is the initial layout, there may be some "unused" slots left because of the preallocation
716
+ // done in this.preallocateVideoReceiveSlots(), so release them now
717
+ this.releaseUnusedVideoSlots();
718
+ case 19:
719
+ case "end":
720
+ return _context6.stop();
763
721
  }
764
- }, _callee5, this);
722
+ }, _callee6, this);
765
723
  }));
766
-
767
724
  function updateVideoReceiveSlots() {
768
725
  return _updateVideoReceiveSlots.apply(this, arguments);
769
726
  }
770
-
771
727
  return updateVideoReceiveSlots;
772
728
  }()
773
729
  /**
774
730
  * Creates new RemoteMedia and RemoteMediaGroup objects for the current layout
775
731
  * and sends the media requests for all of them.
776
732
  */
777
-
778
733
  }, {
779
734
  key: "updateVideoRemoteMediaObjects",
780
735
  value: function updateVideoRemoteMediaObjects() {
781
736
  var _this6 = this;
782
-
783
737
  // invalidate all the previous remote media objects and cancel their media requests
784
738
  this.invalidateCurrentRemoteMedia({
785
739
  audio: false,
786
740
  video: true,
741
+ screenShareAudio: false,
742
+ screenShareVideo: false,
787
743
  commit: false
788
- }); // create new remoteMediaGroup objects
744
+ });
789
745
 
746
+ // create new remoteMediaGroup objects
790
747
  this.media.video.activeSpeakerGroups = {};
791
748
  this.media.video.memberPanes = {};
792
-
793
749
  var _loop = function _loop() {
794
750
  var _this6$currentLayout, _this6$currentLayout$;
795
-
796
751
  var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
797
- groupId = _Object$entries$_i[0],
798
- group = _Object$entries$_i[1];
799
-
752
+ groupId = _Object$entries$_i[0],
753
+ group = _Object$entries$_i[1];
800
754
  var paneGroupInCurrentLayout = (_this6$currentLayout = _this6.currentLayout) === null || _this6$currentLayout === void 0 ? void 0 : (_this6$currentLayout$ = _this6$currentLayout.activeSpeakerVideoPaneGroups) === null || _this6$currentLayout$ === void 0 ? void 0 : _this6$currentLayout$.find(function (groupInLayout) {
801
755
  return groupInLayout.id === groupId;
802
756
  });
803
-
804
757
  if (paneGroupInCurrentLayout) {
805
758
  var mediaGroup = new _remoteMediaGroup.RemoteMediaGroup(_this6.mediaRequestManagers.video, group.slots, paneGroupInCurrentLayout.priority, false, {
806
759
  preferLiveVideo: _this6.config.video.preferLiveVideo,
@@ -812,61 +765,80 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
812
765
  _loggerProxy.default.logger.warn("a group id ".concat(groupId, " from this.receiveSlotAllocations.activeSpeaker cannot be found in the current layout configuration"));
813
766
  }
814
767
  };
815
-
816
768
  for (var _i = 0, _Object$entries = (0, _entries.default)(this.receiveSlotAllocations.activeSpeaker); _i < _Object$entries.length; _i++) {
817
769
  _loop();
818
- } // create new remoteMedia objects
819
-
770
+ }
820
771
 
772
+ // create new remoteMedia objects
821
773
  var _loop2 = function _loop2() {
822
774
  var _this6$currentLayout2, _this6$currentLayout3;
823
-
824
775
  var _Object$entries3$_i = (0, _slicedToArray2.default)(_Object$entries3[_i2], 2),
825
- paneId = _Object$entries3$_i[0],
826
- slot = _Object$entries3$_i[1];
827
-
776
+ paneId = _Object$entries3$_i[0],
777
+ slot = _Object$entries3$_i[1];
828
778
  var paneInCurrentLayout = (_this6$currentLayout2 = _this6.currentLayout) === null || _this6$currentLayout2 === void 0 ? void 0 : (_this6$currentLayout3 = _this6$currentLayout2.memberVideoPanes) === null || _this6$currentLayout3 === void 0 ? void 0 : _this6$currentLayout3.find(function (paneInLayout) {
829
779
  return paneInLayout.id === paneId;
830
780
  });
831
-
832
781
  if (paneInCurrentLayout) {
833
782
  var remoteMedia = new _remoteMedia.RemoteMedia(slot, _this6.mediaRequestManagers.video, {
834
783
  resolution: paneInCurrentLayout.size
835
784
  });
836
-
837
785
  if (paneInCurrentLayout.csi) {
838
786
  remoteMedia.sendMediaRequest(paneInCurrentLayout.csi, false);
839
787
  }
840
-
841
788
  _this6.media.video.memberPanes[paneId] = remoteMedia;
842
789
  } else {
843
790
  // this should never happen, because this.receiveSlotAllocations are created based on current layout configuration
844
791
  _loggerProxy.default.logger.warn("a pane id ".concat(paneId, " from this.receiveSlotAllocations.receiverSelected cannot be found in the current layout configuration"));
845
792
  }
846
793
  };
847
-
848
794
  for (var _i2 = 0, _Object$entries3 = (0, _entries.default)(this.receiveSlotAllocations.receiverSelected); _i2 < _Object$entries3.length; _i2++) {
849
795
  _loop2();
850
- } // todo: screenshare (SPARK-377812)
851
-
852
-
796
+ }
853
797
  this.mediaRequestManagers.video.commit();
854
798
  }
799
+
855
800
  /**
856
- * Invalidates all remote media objects belonging to currently selected layout
801
+ * Checks if current layout requires a screen share.
802
+ * If it does, it creates new RemoteMediaGroup object for screen share
803
+ * and sends the media requests for it.
804
+ * If it doesn't, it makes sure we clean up any RemoteMediaGroup objects
805
+ * created earlier for screen share (for previous layout).
857
806
  */
807
+ }, {
808
+ key: "updateScreenShareVideoRemoteMediaObject",
809
+ value: function updateScreenShareVideoRemoteMediaObject() {
810
+ var _this$currentLayout4;
811
+ this.invalidateCurrentRemoteMedia({
812
+ audio: false,
813
+ video: false,
814
+ screenShareAudio: false,
815
+ screenShareVideo: true,
816
+ commit: false
817
+ });
818
+ this.media.screenShare.video = undefined;
819
+ if ((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.screenShareVideo) {
820
+ // we create a group of 1, because for screen share we need to use the "active speaker" policy
821
+ this.media.screenShare.video = new _remoteMediaGroup.RemoteMediaGroup(this.mediaRequestManagers.screenShareVideo, [this.slots.screenShare.video], 255, false, {
822
+ resolution: this.currentLayout.screenShareVideo.size
823
+ });
824
+ }
825
+ this.mediaRequestManagers.screenShareVideo.commit();
826
+ }
858
827
 
828
+ /**
829
+ * Invalidates all remote media objects belonging to currently selected layout
830
+ */
859
831
  }, {
860
832
  key: "invalidateCurrentRemoteMedia",
861
833
  value: function invalidateCurrentRemoteMedia(options) {
862
834
  var audio = options.audio,
863
- video = options.video,
864
- commit = options.commit;
865
-
835
+ video = options.video,
836
+ screenShareAudio = options.screenShareAudio,
837
+ screenShareVideo = options.screenShareVideo,
838
+ commit = options.commit;
866
839
  if (audio && this.media.audio) {
867
840
  this.media.audio.stop(commit);
868
841
  }
869
-
870
842
  if (video) {
871
843
  (0, _values.default)(this.media.video.activeSpeakerGroups).forEach(function (remoteMediaGroup) {
872
844
  remoteMediaGroup.stop(false);
@@ -874,21 +846,28 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
874
846
  (0, _values.default)(this.media.video.memberPanes).forEach(function (remoteMedia) {
875
847
  remoteMedia.stop(false);
876
848
  });
877
-
878
849
  if (commit) {
879
850
  this.mediaRequestManagers.video.commit();
880
851
  }
881
852
  }
853
+ if (screenShareAudio && this.media.screenShare.audio) {
854
+ this.media.screenShare.audio.stop(commit);
855
+ }
856
+ if (screenShareVideo && this.media.screenShare.video) {
857
+ this.media.screenShare.video.stop(commit);
858
+ }
882
859
  }
883
- /** emits Event.VideoLayoutChanged */
884
860
 
861
+ /** emits Event.VideoLayoutChanged */
885
862
  }, {
886
863
  key: "emitVideoLayoutChangedEvent",
887
864
  value: function emitVideoLayoutChangedEvent() {
865
+ var _this$media$screenSha;
888
866
  // todo: at this point the receive slots might still be showing a participant from previous layout, we should
889
- // wait for our media requests to be fullfilled, but there is no API for that right now (we could wait for source updates
867
+ // wait for our media requests to be fulfilled, but there is no API for that right now (we could wait for source updates
890
868
  // but in some cases they might never come, or would need to always make sure to use a new set of receiver slots)
891
869
  // for now it's fine to have it like this, we will re-evaluate if it needs improving after more testing
870
+
892
871
  this.emit({
893
872
  file: 'multistream/remoteMediaManager',
894
873
  function: 'emitVideoLayoutChangedEvent'
@@ -896,30 +875,29 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
896
875
  layoutId: this.currentLayoutId,
897
876
  activeSpeakerVideoPanes: this.media.video.activeSpeakerGroups,
898
877
  memberVideoPanes: this.media.video.memberPanes,
899
- screenShareVideo: undefined // todo: screen share (SPARK-377812)
900
-
878
+ screenShareVideo: (_this$media$screenSha = this.media.screenShare.video) === null || _this$media$screenSha === void 0 ? void 0 : _this$media$screenSha.getRemoteMedia()[0]
901
879
  });
902
880
  }
881
+
903
882
  /**
904
883
  * Sets a new CSI on a given remote media object
905
884
  *
906
885
  * @param {RemoteMedia} remoteMedia remote Media object to modify
907
886
  * @param {CSI} csi new CSI value, can be null if we want to stop receiving media
908
887
  */
909
-
910
888
  }, {
911
889
  key: "setRemoteVideoCsi",
912
890
  value: function setRemoteVideoCsi(remoteMedia, csi) {
913
891
  if (!(0, _values.default)(this.media.video.memberPanes).includes(remoteMedia)) {
914
892
  throw new Error('remoteMedia not found');
915
893
  }
916
-
917
894
  if (csi) {
918
895
  remoteMedia.sendMediaRequest(csi, true);
919
896
  } else {
920
897
  remoteMedia.cancelMediaRequest(true);
921
898
  }
922
899
  }
900
+
923
901
  /**
924
902
  * Adds a new member video pane to the currently selected layout.
925
903
  *
@@ -928,68 +906,53 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
928
906
  * @param {MemberVideoPane} newPane
929
907
  * @returns {Promise<RemoteMedia>}
930
908
  */
931
-
932
909
  }, {
933
910
  key: "addMemberVideoPane",
934
911
  value: function () {
935
- var _addMemberVideoPane = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(newPane) {
936
- var _this$currentLayout4;
937
-
912
+ var _addMemberVideoPane = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(newPane) {
913
+ var _this$currentLayout5;
938
914
  var receiveSlot, remoteMedia;
939
- return _regenerator.default.wrap(function _callee6$(_context6) {
940
- while (1) {
941
- switch (_context6.prev = _context6.next) {
942
- case 0:
943
- if (this.currentLayout) {
944
- _context6.next = 2;
945
- break;
946
- }
947
-
948
- throw new Error('There is no current layout selected, call start() first');
949
-
950
- case 2:
951
- if (!((_this$currentLayout4 = this.currentLayout) !== null && _this$currentLayout4 !== void 0 && _this$currentLayout4.memberVideoPanes)) {
952
- this.currentLayout.memberVideoPanes = [];
953
- }
954
-
955
- if (!(newPane.id in this.currentLayout.memberVideoPanes)) {
956
- _context6.next = 5;
957
- break;
958
- }
959
-
960
- throw new Error("duplicate pane id ".concat(newPane.id, " - this pane already exists in current layout's memberVideoPanes"));
961
-
962
- case 5:
963
- this.currentLayout.memberVideoPanes.push(newPane);
964
- _context6.next = 8;
965
- return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaConnection.MediaType.VideoMain);
966
-
967
- case 8:
968
- receiveSlot = _context6.sent;
969
- this.slots.video.receiverSelected.push(receiveSlot);
970
- remoteMedia = new _remoteMedia.RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {
971
- resolution: newPane.size
972
- });
973
-
974
- if (newPane.csi) {
975
- remoteMedia.sendMediaRequest(newPane.csi, true);
976
- }
977
-
978
- this.media.video.memberPanes[newPane.id] = remoteMedia;
979
- return _context6.abrupt("return", remoteMedia);
980
-
981
- case 14:
982
- case "end":
983
- return _context6.stop();
984
- }
915
+ return _regenerator.default.wrap(function _callee7$(_context7) {
916
+ while (1) switch (_context7.prev = _context7.next) {
917
+ case 0:
918
+ if (this.currentLayout) {
919
+ _context7.next = 2;
920
+ break;
921
+ }
922
+ throw new Error('There is no current layout selected, call start() first');
923
+ case 2:
924
+ if (!((_this$currentLayout5 = this.currentLayout) !== null && _this$currentLayout5 !== void 0 && _this$currentLayout5.memberVideoPanes)) {
925
+ this.currentLayout.memberVideoPanes = [];
926
+ }
927
+ if (!(newPane.id in this.currentLayout.memberVideoPanes)) {
928
+ _context7.next = 5;
929
+ break;
930
+ }
931
+ throw new Error("duplicate pane id ".concat(newPane.id, " - this pane already exists in current layout's memberVideoPanes"));
932
+ case 5:
933
+ this.currentLayout.memberVideoPanes.push(newPane);
934
+ _context7.next = 8;
935
+ return this.receiveSlotManager.allocateSlot(_internalMediaCore.MediaType.VideoMain);
936
+ case 8:
937
+ receiveSlot = _context7.sent;
938
+ this.slots.video.receiverSelected.push(receiveSlot);
939
+ remoteMedia = new _remoteMedia.RemoteMedia(receiveSlot, this.mediaRequestManagers.video, {
940
+ resolution: newPane.size
941
+ });
942
+ if (newPane.csi) {
943
+ remoteMedia.sendMediaRequest(newPane.csi, true);
944
+ }
945
+ this.media.video.memberPanes[newPane.id] = remoteMedia;
946
+ return _context7.abrupt("return", remoteMedia);
947
+ case 14:
948
+ case "end":
949
+ return _context7.stop();
985
950
  }
986
- }, _callee6, this);
951
+ }, _callee7, this);
987
952
  }));
988
-
989
953
  function addMemberVideoPane(_x2) {
990
954
  return _addMemberVideoPane.apply(this, arguments);
991
955
  }
992
-
993
956
  return addMemberVideoPane;
994
957
  }()
995
958
  /**
@@ -1000,49 +963,40 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1000
963
  * @param {PaneId} paneId pane id of the pane to remove
1001
964
  * @returns {Promise<void>}
1002
965
  */
1003
-
1004
966
  }, {
1005
967
  key: "removeMemberVideoPane",
1006
968
  value: function removeMemberVideoPane(paneId) {
1007
969
  var _this$currentLayout$m2, _this$currentLayout$m3;
1008
-
1009
970
  if (!this.currentLayout) {
1010
971
  return _promise.default.reject(new Error('There is no current layout selected, call start() first'));
1011
972
  }
1012
-
1013
973
  if (!((_this$currentLayout$m2 = this.currentLayout.memberVideoPanes) !== null && _this$currentLayout$m2 !== void 0 && _this$currentLayout$m2.find(function (pane) {
1014
974
  return pane.id === paneId;
1015
975
  }))) {
1016
976
  // pane id doesn't exist, so nothing to do
1017
977
  _loggerProxy.default.logger.log("RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ".concat(paneId, " (pane not found in currentLayout.memberVideoPanes)"));
1018
-
1019
978
  return _promise.default.resolve();
1020
979
  }
1021
-
1022
980
  if (!this.media.video.memberPanes[paneId]) {
1023
981
  // pane id doesn't exist, so nothing to do
1024
982
  _loggerProxy.default.logger.log("RemoteMediaManager#removeMemberVideoPane --> removeMemberVideoPane() called for a non-existent paneId: ".concat(paneId, " (pane not found in this.media.video.memberPanes)"));
1025
-
1026
983
  return _promise.default.resolve();
1027
984
  }
1028
-
1029
985
  var remoteMedia = this.media.video.memberPanes[paneId];
1030
986
  var receiveSlot = remoteMedia.getUnderlyingReceiveSlot();
1031
-
1032
987
  if (receiveSlot) {
1033
988
  this.receiveSlotManager.releaseSlot(receiveSlot);
1034
989
  var index = this.slots.video.receiverSelected.indexOf(receiveSlot);
1035
-
1036
990
  if (index >= 0) {
1037
991
  this.slots.video.receiverSelected.splice(index, 1);
1038
992
  }
1039
993
  }
1040
-
1041
994
  remoteMedia.stop();
1042
995
  delete this.media.video.memberPanes[paneId];
1043
996
  (_this$currentLayout$m3 = this.currentLayout.memberVideoPanes) === null || _this$currentLayout$m3 === void 0 ? true : delete _this$currentLayout$m3[paneId];
1044
997
  return _promise.default.resolve();
1045
998
  }
999
+
1046
1000
  /**
1047
1001
  * Pins an active speaker remote media object to the given CSI value. From that moment
1048
1002
  * onwards the remote media will only play audio/video from that specific CSI until
@@ -1051,39 +1005,35 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1051
1005
  * @param {RemoteMedia} remoteMedia remote media object reference
1052
1006
  * @param {CSI} csi CSI value to pin to, if undefined, then current CSI value is used
1053
1007
  */
1054
-
1055
1008
  }, {
1056
1009
  key: "pinActiveSpeakerVideoPane",
1057
1010
  value: function pinActiveSpeakerVideoPane(remoteMedia, csi) {
1058
1011
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1059
1012
  return group.includes(remoteMedia, 'unpinned');
1060
1013
  });
1061
-
1062
1014
  if (!remoteMediaGroup) {
1063
1015
  throw new Error('remoteMedia not found among the unpinned remote media from any active speaker group');
1064
1016
  }
1065
-
1066
1017
  remoteMediaGroup.pin(remoteMedia, csi);
1067
1018
  }
1019
+
1068
1020
  /**
1069
1021
  * Unpins a remote media object from the fixed CSI value it was pinned to.
1070
1022
  *
1071
1023
  * @param {RemoteMedia} remoteMedia remote media object reference
1072
1024
  */
1073
-
1074
1025
  }, {
1075
1026
  key: "unpinActiveSpeakerVideoPane",
1076
1027
  value: function unpinActiveSpeakerVideoPane(remoteMedia) {
1077
1028
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1078
1029
  return group.includes(remoteMedia, 'pinned');
1079
1030
  });
1080
-
1081
1031
  if (!remoteMediaGroup) {
1082
1032
  throw new Error('remoteMedia not found among the pinned remote media from any active speaker group');
1083
1033
  }
1084
-
1085
1034
  remoteMediaGroup.unpin(remoteMedia);
1086
1035
  }
1036
+
1087
1037
  /**
1088
1038
  * Returns true if a given remote media object belongs to an active speaker group and has been pinned.
1089
1039
  * Throws an error if the remote media object doesn't belong to any active speaker remote media group.
@@ -1091,23 +1041,19 @@ var RemoteMediaManager = /*#__PURE__*/function (_EventsScope) {
1091
1041
  * @param {RemoteMedia} remoteMedia remote media object
1092
1042
  * @returns {boolean}
1093
1043
  */
1094
-
1095
1044
  }, {
1096
1045
  key: "isPinned",
1097
1046
  value: function isPinned(remoteMedia) {
1098
1047
  var remoteMediaGroup = (0, _values.default)(this.media.video.activeSpeakerGroups).find(function (group) {
1099
1048
  return group.includes(remoteMedia);
1100
1049
  });
1101
-
1102
1050
  if (!remoteMediaGroup) {
1103
1051
  throw new Error('remoteMedia not found among any remote media (pinned or unpinned) from any active speaker group');
1104
1052
  }
1105
-
1106
1053
  return remoteMediaGroup.isPinned(remoteMedia);
1107
1054
  }
1108
1055
  }]);
1109
1056
  return RemoteMediaManager;
1110
1057
  }(_eventsScope.default);
1111
-
1112
1058
  exports.RemoteMediaManager = RemoteMediaManager;
1113
1059
  //# sourceMappingURL=remoteMediaManager.js.map