@webex/plugin-meetings 3.7.0 → 3.8.0

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 (351) hide show
  1. package/dist/annotation/annotation.types.d.ts +42 -0
  2. package/dist/annotation/constants.d.ts +31 -0
  3. package/dist/annotation/index.d.ts +117 -0
  4. package/dist/annotation/index.js +17 -0
  5. package/dist/annotation/index.js.map +1 -1
  6. package/dist/breakouts/breakout.d.ts +8 -0
  7. package/dist/breakouts/breakout.js +1 -1
  8. package/dist/breakouts/collection.d.ts +5 -0
  9. package/dist/breakouts/edit-lock-error.d.ts +15 -0
  10. package/dist/breakouts/events.d.ts +8 -0
  11. package/dist/breakouts/index.d.ts +5 -0
  12. package/dist/breakouts/index.js +1 -1
  13. package/dist/breakouts/request.d.ts +22 -0
  14. package/dist/breakouts/utils.d.ts +15 -0
  15. package/dist/common/browser-detection.d.ts +9 -0
  16. package/dist/common/collection.d.ts +48 -0
  17. package/dist/common/config.d.ts +2 -0
  18. package/dist/common/errors/captcha-error.d.ts +15 -0
  19. package/dist/common/errors/intent-to-join.d.ts +16 -0
  20. package/dist/common/errors/join-forbidden-error.js +52 -0
  21. package/dist/common/errors/join-forbidden-error.js.map +1 -0
  22. package/dist/common/errors/join-meeting.d.ts +17 -0
  23. package/dist/common/errors/{webinar-registration-error.js → join-webinar-error.js} +12 -12
  24. package/dist/common/errors/join-webinar-error.js.map +1 -0
  25. package/dist/common/errors/media.d.ts +15 -0
  26. package/dist/common/errors/multistream-not-supported-error.js +53 -0
  27. package/dist/common/errors/multistream-not-supported-error.js.map +1 -0
  28. package/dist/common/errors/no-meeting-info.d.ts +14 -0
  29. package/dist/common/errors/parameter.d.ts +15 -0
  30. package/dist/common/errors/password-error.d.ts +15 -0
  31. package/dist/common/errors/permission.d.ts +14 -0
  32. package/dist/common/errors/reclaim-host-role-error.js +149 -0
  33. package/dist/common/errors/reclaim-host-role-error.js.map +1 -0
  34. package/dist/common/errors/reclaim-host-role-errors.d.ts +60 -0
  35. package/dist/common/errors/reconnection-in-progress.d.ts +9 -0
  36. package/dist/common/errors/reconnection-in-progress.js +33 -0
  37. package/dist/common/errors/reconnection-in-progress.js.map +1 -0
  38. package/dist/common/errors/reconnection.d.ts +15 -0
  39. package/dist/common/errors/stats.d.ts +15 -0
  40. package/dist/common/errors/webex-errors.d.ts +93 -0
  41. package/dist/common/errors/webex-meetings-error.d.ts +20 -0
  42. package/dist/common/events/events-scope.d.ts +17 -0
  43. package/dist/common/events/events.d.ts +12 -0
  44. package/dist/common/events/trigger-proxy.d.ts +2 -0
  45. package/dist/common/events/util.d.ts +2 -0
  46. package/dist/common/logs/logger-config.d.ts +2 -0
  47. package/dist/common/logs/logger-proxy.d.ts +2 -0
  48. package/dist/common/logs/request.d.ts +36 -0
  49. package/dist/common/queue.d.ts +34 -0
  50. package/dist/config.d.ts +72 -0
  51. package/dist/config.js +2 -1
  52. package/dist/config.js.map +1 -1
  53. package/dist/constants.d.ts +1088 -0
  54. package/dist/constants.js +68 -6
  55. package/dist/constants.js.map +1 -1
  56. package/dist/controls-options-manager/constants.d.ts +4 -0
  57. package/dist/controls-options-manager/enums.d.ts +15 -0
  58. package/dist/controls-options-manager/index.d.ts +136 -0
  59. package/dist/controls-options-manager/types.d.ts +43 -0
  60. package/dist/controls-options-manager/util.d.ts +1 -0
  61. package/dist/index.d.ts +7 -0
  62. package/dist/index.js +16 -11
  63. package/dist/index.js.map +1 -1
  64. package/dist/interceptors/index.d.ts +2 -0
  65. package/dist/interceptors/locusRetry.d.ts +27 -0
  66. package/dist/interpretation/collection.d.ts +5 -0
  67. package/dist/interpretation/index.d.ts +5 -0
  68. package/dist/interpretation/index.js +1 -1
  69. package/dist/interpretation/siLanguage.d.ts +5 -0
  70. package/dist/interpretation/siLanguage.js +1 -1
  71. package/dist/locus-info/controlsUtils.d.ts +2 -0
  72. package/dist/locus-info/embeddedAppsUtils.d.ts +2 -0
  73. package/dist/locus-info/fullState.d.ts +2 -0
  74. package/dist/locus-info/hostUtils.d.ts +2 -0
  75. package/dist/locus-info/index.d.ts +322 -0
  76. package/dist/locus-info/index.js +14 -3
  77. package/dist/locus-info/index.js.map +1 -1
  78. package/dist/locus-info/infoUtils.d.ts +2 -0
  79. package/dist/locus-info/mediaSharesUtils.d.ts +2 -0
  80. package/dist/locus-info/parser.d.ts +272 -0
  81. package/dist/locus-info/selfUtils.d.ts +2 -0
  82. package/dist/locus-info/selfUtils.js +35 -17
  83. package/dist/locus-info/selfUtils.js.map +1 -1
  84. package/dist/media/MediaConnectionAwaiter.js +1 -0
  85. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  86. package/dist/media/index.d.ts +34 -0
  87. package/dist/media/properties.d.ts +93 -0
  88. package/dist/media/properties.js +30 -16
  89. package/dist/media/properties.js.map +1 -1
  90. package/dist/media/util.d.ts +2 -0
  91. package/dist/mediaQualityMetrics/config.d.ts +241 -0
  92. package/dist/mediaQualityMetrics/config.js +502 -0
  93. package/dist/mediaQualityMetrics/config.js.map +1 -0
  94. package/dist/meeting/brbState.js +167 -0
  95. package/dist/meeting/brbState.js.map +1 -0
  96. package/dist/meeting/effectsState.js +260 -0
  97. package/dist/meeting/effectsState.js.map +1 -0
  98. package/dist/meeting/in-meeting-actions.d.ts +167 -0
  99. package/dist/meeting/in-meeting-actions.js +13 -1
  100. package/dist/meeting/in-meeting-actions.js.map +1 -1
  101. package/dist/meeting/index.d.ts +1825 -0
  102. package/dist/meeting/index.js +1331 -1051
  103. package/dist/meeting/index.js.map +1 -1
  104. package/dist/meeting/locusMediaRequest.d.ts +74 -0
  105. package/dist/meeting/locusMediaRequest.js +11 -6
  106. package/dist/meeting/locusMediaRequest.js.map +1 -1
  107. package/dist/meeting/muteState.d.ts +178 -0
  108. package/dist/meeting/muteState.js +1 -6
  109. package/dist/meeting/muteState.js.map +1 -1
  110. package/dist/meeting/request.d.ts +295 -0
  111. package/dist/meeting/request.js +51 -29
  112. package/dist/meeting/request.js.map +1 -1
  113. package/dist/meeting/request.type.d.ts +11 -0
  114. package/dist/meeting/request.type.js.map +1 -1
  115. package/dist/meeting/state.d.ts +9 -0
  116. package/dist/meeting/util.d.ts +119 -0
  117. package/dist/meeting/util.js +103 -67
  118. package/dist/meeting/util.js.map +1 -1
  119. package/dist/meeting/voicea-meeting.d.ts +16 -0
  120. package/dist/meeting-info/collection.d.ts +20 -0
  121. package/dist/meeting-info/index.d.ts +69 -0
  122. package/dist/meeting-info/meeting-info-v2.d.ts +123 -0
  123. package/dist/meeting-info/meeting-info-v2.js +115 -45
  124. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  125. package/dist/meeting-info/request.d.ts +22 -0
  126. package/dist/meeting-info/util.d.ts +2 -0
  127. package/dist/meeting-info/utilv2.d.ts +2 -0
  128. package/dist/meeting-info/utilv2.js +6 -2
  129. package/dist/meeting-info/utilv2.js.map +1 -1
  130. package/dist/meetings/collection.d.ts +40 -0
  131. package/dist/meetings/index.d.ts +390 -0
  132. package/dist/meetings/index.js +107 -55
  133. package/dist/meetings/index.js.map +1 -1
  134. package/dist/meetings/meetings.types.d.ts +4 -0
  135. package/dist/meetings/meetings.types.js +2 -0
  136. package/dist/meetings/meetings.types.js.map +1 -1
  137. package/dist/meetings/request.d.ts +27 -0
  138. package/dist/meetings/util.d.ts +18 -0
  139. package/dist/meetings/util.js +1 -1
  140. package/dist/meetings/util.js.map +1 -1
  141. package/dist/member/index.d.ts +160 -0
  142. package/dist/member/index.js +9 -0
  143. package/dist/member/index.js.map +1 -1
  144. package/dist/member/member.types.js +17 -0
  145. package/dist/member/member.types.js.map +1 -0
  146. package/dist/member/types.d.ts +32 -0
  147. package/dist/member/types.js.map +1 -1
  148. package/dist/member/util.d.ts +2 -0
  149. package/dist/member/util.js +39 -28
  150. package/dist/member/util.js.map +1 -1
  151. package/dist/members/collection.d.ts +29 -0
  152. package/dist/members/index.d.ts +353 -0
  153. package/dist/members/request.d.ts +114 -0
  154. package/dist/members/types.d.ts +25 -0
  155. package/dist/members/util.d.ts +215 -0
  156. package/dist/members/util.js +4 -2
  157. package/dist/members/util.js.map +1 -1
  158. package/dist/metrics/config.js +276 -0
  159. package/dist/metrics/config.js.map +1 -0
  160. package/dist/metrics/constants.d.ts +70 -0
  161. package/dist/metrics/constants.js +6 -1
  162. package/dist/metrics/constants.js.map +1 -1
  163. package/dist/metrics/index.d.ts +45 -0
  164. package/dist/multistream/mediaRequestManager.d.ts +119 -0
  165. package/dist/multistream/receiveSlot.d.ts +68 -0
  166. package/dist/multistream/receiveSlotManager.d.ts +56 -0
  167. package/dist/multistream/remoteMedia.d.ts +72 -0
  168. package/dist/multistream/remoteMedia.js +30 -15
  169. package/dist/multistream/remoteMedia.js.map +1 -1
  170. package/dist/multistream/remoteMediaGroup.d.ts +49 -0
  171. package/dist/multistream/remoteMediaManager.d.ts +300 -0
  172. package/dist/multistream/sendSlotManager.d.ts +69 -0
  173. package/dist/multistream/sendSlotManager.js +24 -0
  174. package/dist/multistream/sendSlotManager.js.map +1 -1
  175. package/dist/networkQualityMonitor/index.d.ts +70 -0
  176. package/dist/networkQualityMonitor/index.js +13 -19
  177. package/dist/networkQualityMonitor/index.js.map +1 -1
  178. package/dist/peer-connection-manager/index.js +671 -0
  179. package/dist/peer-connection-manager/index.js.map +1 -0
  180. package/dist/peer-connection-manager/util.js +109 -0
  181. package/dist/peer-connection-manager/util.js.map +1 -0
  182. package/dist/personal-meeting-room/index.d.ts +47 -0
  183. package/dist/personal-meeting-room/request.d.ts +14 -0
  184. package/dist/personal-meeting-room/util.d.ts +2 -0
  185. package/dist/reachability/clusterReachability.d.ts +109 -0
  186. package/dist/reachability/clusterReachability.js +12 -15
  187. package/dist/reachability/clusterReachability.js.map +1 -1
  188. package/dist/reachability/index.d.ts +105 -0
  189. package/dist/reachability/index.js +461 -136
  190. package/dist/reachability/index.js.map +1 -1
  191. package/dist/reachability/reachability.types.js +7 -0
  192. package/dist/reachability/reachability.types.js.map +1 -0
  193. package/dist/reachability/request.d.ts +39 -0
  194. package/dist/reachability/request.js +21 -8
  195. package/dist/reachability/request.js.map +1 -1
  196. package/dist/reachability/util.d.ts +8 -0
  197. package/dist/reactions/constants.d.ts +3 -0
  198. package/dist/reactions/reactions.d.ts +4 -0
  199. package/dist/reactions/reactions.type.d.ts +52 -0
  200. package/dist/reconnection-manager/index.d.ts +136 -0
  201. package/dist/recording-controller/enums.d.ts +7 -0
  202. package/dist/recording-controller/enums.js +8 -4
  203. package/dist/recording-controller/enums.js.map +1 -1
  204. package/dist/recording-controller/index.d.ts +207 -0
  205. package/dist/recording-controller/index.js +18 -9
  206. package/dist/recording-controller/index.js.map +1 -1
  207. package/dist/recording-controller/util.d.ts +14 -0
  208. package/dist/recording-controller/util.js +13 -9
  209. package/dist/recording-controller/util.js.map +1 -1
  210. package/dist/roap/collection.js +62 -0
  211. package/dist/roap/collection.js.map +1 -0
  212. package/dist/roap/handler.js +275 -0
  213. package/dist/roap/handler.js.map +1 -0
  214. package/dist/roap/index.d.ts +86 -0
  215. package/dist/roap/index.js +15 -15
  216. package/dist/roap/index.js.map +1 -1
  217. package/dist/roap/request.d.ts +39 -0
  218. package/dist/roap/request.js +45 -79
  219. package/dist/roap/request.js.map +1 -1
  220. package/dist/roap/state.js +126 -0
  221. package/dist/roap/state.js.map +1 -0
  222. package/dist/roap/turnDiscovery.d.ts +155 -0
  223. package/dist/roap/turnDiscovery.js +3 -6
  224. package/dist/roap/turnDiscovery.js.map +1 -1
  225. package/dist/roap/util.js +75 -0
  226. package/dist/roap/util.js.map +1 -0
  227. package/dist/rtcMetrics/constants.d.ts +4 -0
  228. package/dist/rtcMetrics/index.d.ts +61 -0
  229. package/dist/statsAnalyzer/global.d.ts +36 -0
  230. package/dist/statsAnalyzer/global.js +126 -0
  231. package/dist/statsAnalyzer/global.js.map +1 -0
  232. package/dist/statsAnalyzer/index.d.ts +217 -0
  233. package/dist/statsAnalyzer/index.js +1013 -0
  234. package/dist/statsAnalyzer/index.js.map +1 -0
  235. package/dist/statsAnalyzer/mqaUtil.d.ts +48 -0
  236. package/dist/statsAnalyzer/mqaUtil.js +179 -0
  237. package/dist/statsAnalyzer/mqaUtil.js.map +1 -0
  238. package/dist/transcription/index.d.ts +64 -0
  239. package/dist/types/annotation/index.d.ts +5 -0
  240. package/dist/types/common/errors/join-forbidden-error.d.ts +15 -0
  241. package/dist/types/common/errors/{webinar-registration-error.d.ts → join-webinar-error.d.ts} +2 -2
  242. package/dist/types/common/errors/multistream-not-supported-error.d.ts +17 -0
  243. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  244. package/dist/types/config.d.ts +1 -0
  245. package/dist/types/constants.d.ts +53 -1
  246. package/dist/types/index.d.ts +3 -3
  247. package/dist/types/locus-info/index.d.ts +2 -1
  248. package/dist/types/mediaQualityMetrics/config.d.ts +241 -0
  249. package/dist/types/meeting/brbState.d.ts +54 -0
  250. package/dist/types/meeting/in-meeting-actions.d.ts +12 -0
  251. package/dist/types/meeting/index.d.ts +64 -14
  252. package/dist/types/meeting/locusMediaRequest.d.ts +6 -3
  253. package/dist/types/meeting/request.d.ts +14 -3
  254. package/dist/types/meeting/request.type.d.ts +6 -0
  255. package/dist/types/meeting/util.d.ts +3 -3
  256. package/dist/types/meeting-info/meeting-info-v2.d.ts +30 -5
  257. package/dist/types/meetings/index.d.ts +20 -2
  258. package/dist/types/meetings/meetings.types.d.ts +8 -0
  259. package/dist/types/member/index.d.ts +1 -0
  260. package/dist/types/member/types.d.ts +7 -0
  261. package/dist/types/members/util.d.ts +2 -0
  262. package/dist/types/metrics/constants.d.ts +6 -1
  263. package/dist/types/multistream/sendSlotManager.d.ts +8 -1
  264. package/dist/types/reachability/clusterReachability.d.ts +1 -10
  265. package/dist/types/reachability/index.d.ts +83 -36
  266. package/dist/types/reachability/reachability.types.d.ts +64 -0
  267. package/dist/types/reachability/request.d.ts +5 -1
  268. package/dist/types/recording-controller/enums.d.ts +5 -2
  269. package/dist/types/recording-controller/index.d.ts +1 -0
  270. package/dist/types/recording-controller/util.d.ts +2 -1
  271. package/dist/types/roap/request.d.ts +1 -13
  272. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  273. package/dist/types/statsAnalyzer/index.d.ts +217 -0
  274. package/dist/types/statsAnalyzer/mqaUtil.d.ts +48 -0
  275. package/dist/webinar/collection.d.ts +16 -0
  276. package/dist/webinar/index.d.ts +5 -0
  277. package/dist/webinar/index.js +390 -7
  278. package/dist/webinar/index.js.map +1 -1
  279. package/package.json +23 -22
  280. package/src/annotation/index.ts +16 -0
  281. package/src/common/errors/join-forbidden-error.ts +26 -0
  282. package/src/common/errors/join-webinar-error.ts +24 -0
  283. package/src/common/errors/multistream-not-supported-error.ts +30 -0
  284. package/src/config.ts +1 -0
  285. package/src/constants.ts +61 -3
  286. package/src/index.ts +5 -3
  287. package/src/locus-info/index.ts +20 -3
  288. package/src/locus-info/selfUtils.ts +24 -6
  289. package/src/media/MediaConnectionAwaiter.ts +2 -0
  290. package/src/media/properties.ts +34 -13
  291. package/src/meeting/brbState.ts +169 -0
  292. package/src/meeting/in-meeting-actions.ts +25 -0
  293. package/src/meeting/index.ts +443 -87
  294. package/src/meeting/locusMediaRequest.ts +11 -8
  295. package/src/meeting/muteState.ts +1 -6
  296. package/src/meeting/request.ts +30 -12
  297. package/src/meeting/request.type.ts +7 -0
  298. package/src/meeting/util.ts +32 -13
  299. package/src/meeting-info/meeting-info-v2.ts +83 -12
  300. package/src/meeting-info/utilv2.ts +17 -3
  301. package/src/meetings/index.ts +79 -20
  302. package/src/meetings/meetings.types.ts +10 -0
  303. package/src/meetings/util.ts +2 -1
  304. package/src/member/index.ts +9 -0
  305. package/src/member/types.ts +8 -0
  306. package/src/member/util.ts +34 -24
  307. package/src/members/util.ts +1 -0
  308. package/src/metrics/constants.ts +6 -1
  309. package/src/multistream/remoteMedia.ts +28 -15
  310. package/src/multistream/sendSlotManager.ts +31 -0
  311. package/src/reachability/clusterReachability.ts +5 -15
  312. package/src/reachability/index.ts +311 -75
  313. package/src/reachability/reachability.types.ts +85 -0
  314. package/src/reachability/request.ts +55 -31
  315. package/src/recording-controller/enums.ts +5 -2
  316. package/src/recording-controller/index.ts +17 -4
  317. package/src/recording-controller/util.ts +20 -5
  318. package/src/roap/index.ts +14 -13
  319. package/src/roap/request.ts +30 -44
  320. package/src/roap/turnDiscovery.ts +2 -4
  321. package/src/webinar/index.ts +235 -9
  322. package/test/unit/spec/annotation/index.ts +46 -1
  323. package/test/unit/spec/locus-info/index.js +292 -60
  324. package/test/unit/spec/locus-info/selfConstant.js +7 -0
  325. package/test/unit/spec/locus-info/selfUtils.js +101 -1
  326. package/test/unit/spec/media/properties.ts +15 -0
  327. package/test/unit/spec/meeting/brbState.ts +114 -0
  328. package/test/unit/spec/meeting/in-meeting-actions.ts +15 -1
  329. package/test/unit/spec/meeting/index.js +851 -107
  330. package/test/unit/spec/meeting/locusMediaRequest.ts +18 -11
  331. package/test/unit/spec/meeting/muteState.js +0 -24
  332. package/test/unit/spec/meeting/request.js +3 -26
  333. package/test/unit/spec/meeting/utils.js +73 -28
  334. package/test/unit/spec/meeting-info/meetinginfov2.js +46 -4
  335. package/test/unit/spec/meeting-info/utilv2.js +26 -0
  336. package/test/unit/spec/meetings/index.js +159 -18
  337. package/test/unit/spec/meetings/utils.js +10 -0
  338. package/test/unit/spec/member/util.js +52 -11
  339. package/test/unit/spec/members/utils.js +95 -0
  340. package/test/unit/spec/multistream/remoteMedia.ts +11 -7
  341. package/test/unit/spec/reachability/clusterReachability.ts +7 -0
  342. package/test/unit/spec/reachability/index.ts +383 -9
  343. package/test/unit/spec/reachability/request.js +48 -12
  344. package/test/unit/spec/recording-controller/index.js +61 -5
  345. package/test/unit/spec/recording-controller/util.js +39 -3
  346. package/test/unit/spec/roap/index.ts +48 -1
  347. package/test/unit/spec/roap/request.ts +51 -109
  348. package/test/unit/spec/roap/turnDiscovery.ts +202 -147
  349. package/test/unit/spec/webinar/index.ts +504 -0
  350. package/dist/common/errors/webinar-registration-error.js.map +0 -1
  351. package/src/common/errors/webinar-registration-error.ts +0 -27
@@ -0,0 +1,74 @@
1
+ import { WebexPlugin } from '@webex/webex-core';
2
+ import { IP_VERSION } from '../constants';
3
+ export type MediaRequestType = 'RoapMessage' | 'LocalMute';
4
+ export type RequestResult = any;
5
+ export type RoapRequest = {
6
+ type: 'RoapMessage';
7
+ selfUrl: string;
8
+ mediaId: string;
9
+ roapMessage: any;
10
+ reachability: any;
11
+ sequence?: any;
12
+ joinCookie: any;
13
+ ipVersion?: IP_VERSION;
14
+ };
15
+ export type LocalMuteRequest = {
16
+ type: 'LocalMute';
17
+ selfUrl: string;
18
+ mediaId: string;
19
+ sequence?: any;
20
+ muteOptions: {
21
+ audioMuted?: boolean;
22
+ videoMuted?: boolean;
23
+ };
24
+ };
25
+ export type Request = RoapRequest | LocalMuteRequest;
26
+ export type Config = {
27
+ device: {
28
+ url: string;
29
+ deviceType: string;
30
+ countryCode?: string;
31
+ regionCode?: string;
32
+ };
33
+ correlationId: string;
34
+ preferTranscoding: boolean;
35
+ };
36
+ /**
37
+ * This class manages all /media API requests to Locus. Every call to that
38
+ * Locus API has to go through this class.
39
+ */
40
+ export declare class LocusMediaRequest extends WebexPlugin {
41
+ private config;
42
+ private latestAudioMuted?;
43
+ private latestVideoMuted?;
44
+ private isRequestInProgress;
45
+ private queuedRequests;
46
+ private confluenceState;
47
+ /**
48
+ * Constructor
49
+ */
50
+ constructor(config: Config, options: any);
51
+ /**
52
+ * Add a request to the internal queue.
53
+ */
54
+ private addToQueue;
55
+ /**
56
+ * Takes the next request from the queue and executes it. Once that
57
+ * request is completed, the next one will be taken from the queue
58
+ * and executed and this is repeated until the queue is empty.
59
+ */
60
+ private executeNextQueuedRequest;
61
+ /**
62
+ * Returns latest requested audio and video mute values. If they have never been
63
+ * requested, we assume audio/video to be muted.
64
+ */
65
+ private getLatestMuteState;
66
+ /**
67
+ * Prepares the uri and body for the media request to be sent to Locus
68
+ */
69
+ private sendHttpRequest;
70
+ /**
71
+ * Sends a media request to Locus
72
+ */
73
+ send(request: Request): Promise<RequestResult>;
74
+ }
@@ -197,11 +197,7 @@ var LocusMediaRequest = exports.LocusMediaRequest = /*#__PURE__*/function (_Webe
197
197
  // first setup things common to all requests
198
198
  var body = {
199
199
  device: this.config.device,
200
- correlationId: this.config.correlationId,
201
- clientMediaPreferences: {
202
- preferTranscoding: this.config.preferTranscoding,
203
- ipver: request.type === 'RoapMessage' ? request.ipVersion : undefined
204
- }
200
+ correlationId: this.config.correlationId
205
201
  };
206
202
  var localMedias = {
207
203
  audioMuted: audioMuted,
@@ -217,7 +213,7 @@ var LocusMediaRequest = exports.LocusMediaRequest = /*#__PURE__*/function (_Webe
217
213
  case 'RoapMessage':
218
214
  localMedias.roapMessage = request.roapMessage;
219
215
  localMedias.reachability = request.reachability;
220
- body.clientMediaPreferences.joinCookie = request.joinCookie;
216
+ body.clientMediaPreferences = request.clientMediaPreferences;
221
217
 
222
218
  // @ts-ignore
223
219
  this.webex.internal.newMetrics.submitClientEvent({
@@ -319,6 +315,15 @@ var LocusMediaRequest = exports.LocusMediaRequest = /*#__PURE__*/function (_Webe
319
315
  value: function isConfluenceCreated() {
320
316
  return this.confluenceState === 'created';
321
317
  }
318
+
319
+ /**
320
+ * This method needs to be called when we downgrade from multistream to transcoded connection.
321
+ */
322
+ }, {
323
+ key: "downgradeFromMultistreamToTranscoded",
324
+ value: function downgradeFromMultistreamToTranscoded() {
325
+ this.config.preferTranscoding = true;
326
+ }
322
327
  }]);
323
328
  return LocusMediaRequest;
324
329
  }(_webexCore.WebexPlugin);
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","require","_common","_webexCore","_constants","_loggerProxy","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","InternalRequestInfo","request","pendingPromise","sendRequestFn","_classCallCheck2","_defineProperty2","pendingPromises","_createClass2","key","value","getPendingPromises","addPendingPromises","_this$pendingPromises","push","_toConsumableArray2","execute","_this","then","forEach","d","resolve","catch","reject","isRequestAffectingConfluenceState","type","roapMessage","messageType","ROAP","ROAP_TYPES","OFFER","LocusMediaRequest","exports","_WebexPlugin","_inherits2","_super","config","options","_this2","_assertThisInitialized2","isRequestInProgress","queuedRequests","confluenceState","addToQueue","info","length","filter","r","executeNextQueuedRequest","_this3","nextRequest","shift","getLatestMuteState","audioMuted","latestAudioMuted","undefined","videoMuted","latestVideoMuted","sendHttpRequest","_this4","uri","concat","selfUrl","MEDIA","_this$getLatestMuteSt","body","device","correlationId","clientMediaPreferences","preferTranscoding","ipver","ipVersion","localMedias","respOnlySdp","usingResource","reachability","joinCookie","webex","internal","newMetrics","submitClientEvent","name","meetingId","sequence","localSdp","_stringify","mediaId","LoggerProxy","logger","method","HTTP_VERBS","PUT","rawError","send","_this5","_request$muteOptions","muteOptions","_promise","Defer","newRequest","bind","defer","promise","isConfluenceCreated","WebexPlugin"],"sources":["locusMediaRequest.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {defer} from 'lodash';\nimport {Defer} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {MEDIA, HTTP_VERBS, ROAP, IP_VERSION} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nexport type MediaRequestType = 'RoapMessage' | 'LocalMute';\nexport type RequestResult = any;\n\nexport type RoapRequest = {\n type: 'RoapMessage';\n selfUrl: string;\n mediaId: string;\n roapMessage: any;\n reachability: any;\n sequence?: any;\n joinCookie: any; // any, because this is opaque to the client, we pass whatever object we got from one backend component (Orpheus) to the other (Locus)\n ipVersion?: IP_VERSION;\n};\n\nexport type LocalMuteRequest = {\n type: 'LocalMute';\n selfUrl: string;\n mediaId: string;\n sequence?: any;\n muteOptions: {\n audioMuted?: boolean;\n videoMuted?: boolean;\n };\n};\n\nexport type Request = RoapRequest | LocalMuteRequest;\n\n/** Class representing a single /media request being sent to Locus */\nclass InternalRequestInfo {\n public readonly request: Request;\n private pendingPromises: Defer[];\n private sendRequestFn: (request: Request) => Promise<RequestResult>;\n\n /** Constructor */\n constructor(\n request: Request,\n pendingPromise: Defer,\n sendRequestFn: (request: Request) => Promise<RequestResult>\n ) {\n this.request = request;\n this.pendingPromises = [pendingPromise];\n this.sendRequestFn = sendRequestFn;\n }\n\n /**\n * Returns the list of pending promises associated with this request\n */\n public getPendingPromises() {\n return this.pendingPromises;\n }\n\n /**\n * Adds promises to the list of pending promises associated with this request\n */\n public addPendingPromises(pendingPromises: Defer[]) {\n this.pendingPromises.push(...pendingPromises);\n }\n\n /**\n * Executes the request. Returned promise is resolved once the request\n * is completed (no matter if it succeeded or failed).\n */\n public execute(): Promise<void> {\n return this.sendRequestFn(this.request)\n .then((result) => {\n // resolve all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.resolve(result));\n })\n .catch((e) => {\n // reject all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.reject(e));\n });\n }\n}\n\nexport type Config = {\n device: {\n url: string;\n deviceType: string;\n countryCode?: string;\n regionCode?: string;\n };\n correlationId: string;\n meetingId: string;\n preferTranscoding: boolean;\n};\n\n/**\n * Returns true if the request is triggering confluence creation in the server\n */\nfunction isRequestAffectingConfluenceState(request: Request): boolean {\n return (\n request.type === 'RoapMessage' && request.roapMessage.messageType === ROAP.ROAP_TYPES.OFFER\n );\n}\n\n/**\n * This class manages all /media API requests to Locus. Every call to that\n * Locus API has to go through this class.\n */\nexport class LocusMediaRequest extends WebexPlugin {\n private config: Config;\n private latestAudioMuted?: boolean;\n private latestVideoMuted?: boolean;\n private isRequestInProgress: boolean;\n private queuedRequests: InternalRequestInfo[];\n private confluenceState: 'not created' | 'creation in progress' | 'created';\n /**\n * Constructor\n */\n constructor(config: Config, options: any) {\n super({}, options);\n this.isRequestInProgress = false;\n this.queuedRequests = [];\n this.config = config;\n this.confluenceState = 'not created';\n }\n\n /**\n * Add a request to the internal queue.\n */\n private addToQueue(info: InternalRequestInfo) {\n if (info.request.type === 'LocalMute' && this.queuedRequests.length > 0) {\n // We don't need additional local mute requests in the queue.\n // We only need at most 1 local mute or 1 roap request, because\n // roap requests also include mute state, so whatever request\n // is sent out, it will send the latest local mute state.\n // We only need to store the pendingPromises so that they get resolved\n // when the roap request is sent out.\n this.queuedRequests[0].addPendingPromises(info.getPendingPromises());\n\n return;\n }\n\n if (info.request.type === 'RoapMessage' && this.queuedRequests.length > 0) {\n // remove any LocalMute requests from the queue, because this Roap message\n // will also update the mute status in Locus, so they are redundant\n this.queuedRequests = this.queuedRequests.filter((r) => {\n if (r.request.type === 'LocalMute') {\n // we need to keep the pending promises from the local mute request\n // that we're removing from the queue\n info.addPendingPromises(r.getPendingPromises());\n\n return false;\n }\n\n return true;\n });\n }\n\n this.queuedRequests.push(info);\n }\n\n /**\n * Takes the next request from the queue and executes it. Once that\n * request is completed, the next one will be taken from the queue\n * and executed and this is repeated until the queue is empty.\n */\n private executeNextQueuedRequest(): void {\n if (this.isRequestInProgress) {\n return;\n }\n\n const nextRequest = this.queuedRequests.shift();\n\n if (nextRequest) {\n this.isRequestInProgress = true;\n nextRequest.execute().then(() => {\n this.isRequestInProgress = false;\n this.executeNextQueuedRequest();\n });\n }\n }\n\n /**\n * Returns latest requested audio and video mute values. If they have never been\n * requested, we assume audio/video to be muted.\n */\n private getLatestMuteState() {\n const audioMuted = this.latestAudioMuted !== undefined ? this.latestAudioMuted : true;\n const videoMuted = this.latestVideoMuted !== undefined ? this.latestVideoMuted : true;\n\n return {audioMuted, videoMuted};\n }\n\n /**\n * Prepares the uri and body for the media request to be sent to Locus\n */\n private sendHttpRequest(request: Request) {\n const uri = `${request.selfUrl}/${MEDIA}`;\n\n const {audioMuted, videoMuted} = this.getLatestMuteState();\n\n // first setup things common to all requests\n const body: any = {\n device: this.config.device,\n correlationId: this.config.correlationId,\n clientMediaPreferences: {\n preferTranscoding: this.config.preferTranscoding,\n ipver: request.type === 'RoapMessage' ? request.ipVersion : undefined,\n },\n };\n\n const localMedias: any = {\n audioMuted,\n videoMuted,\n };\n\n // now add things specific to request type\n switch (request.type) {\n case 'LocalMute':\n body.respOnlySdp = true;\n body.usingResource = null;\n break;\n\n case 'RoapMessage':\n localMedias.roapMessage = request.roapMessage;\n localMedias.reachability = request.reachability;\n body.clientMediaPreferences.joinCookie = request.joinCookie;\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.request',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n break;\n }\n\n if (request.sequence) {\n body.sequence = request.sequence;\n }\n\n body.localMedias = [\n {\n localSdp: JSON.stringify(localMedias), // this part must be JSON stringified, Locus requires this\n mediaId: request.mediaId,\n },\n ];\n\n LoggerProxy.logger.info(\n `Meeting:LocusMediaRequest#sendHttpRequest --> ${request.type} audioMuted=${audioMuted} videoMuted=${videoMuted}`\n );\n\n if (isRequestAffectingConfluenceState(request) && this.confluenceState === 'not created') {\n this.confluenceState = 'creation in progress';\n }\n\n // @ts-ignore\n return this.request({\n method: HTTP_VERBS.PUT,\n uri,\n body,\n })\n .then((result) => {\n if (isRequestAffectingConfluenceState(request)) {\n this.confluenceState = 'created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n }\n\n return result;\n })\n .catch((e) => {\n if (\n isRequestAffectingConfluenceState(request) &&\n this.confluenceState === 'creation in progress'\n ) {\n this.confluenceState = 'not created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n rawError: e,\n },\n });\n }\n\n throw e;\n });\n }\n\n /**\n * Sends a media request to Locus\n */\n public send(request: Request): Promise<RequestResult> {\n if (request.type === 'LocalMute') {\n const {audioMuted, videoMuted} = request.muteOptions;\n\n if (audioMuted !== undefined) {\n this.latestAudioMuted = audioMuted;\n }\n if (videoMuted !== undefined) {\n this.latestVideoMuted = videoMuted;\n }\n\n if (this.confluenceState === 'not created') {\n // if there is no confluence, there is no point sending out local mute request\n // as it will fail so we just store the latest audio/video muted values\n // and resolve immediately, so that higher layer (MuteState class) doesn't get blocked\n // and can call us again if user mutes/unmutes again before confluence is created\n LoggerProxy.logger.info(\n 'Meeting:LocusMediaRequest#send --> called with LocalMute request before confluence creation'\n );\n\n return Promise.resolve({});\n }\n }\n\n const pendingPromise = new Defer();\n\n const newRequest = new InternalRequestInfo(\n request,\n pendingPromise,\n this.sendHttpRequest.bind(this)\n );\n\n this.addToQueue(newRequest);\n\n defer(() => this.executeNextQueuedRequest());\n\n return pendingPromise.promise;\n }\n\n /** Returns true if a confluence on the server is already created */\n public isConfluenceCreated() {\n return this.confluenceState === 'created';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsD,SAAAM,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA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A,EAGA,SAAAmF,KAAY3F,OAAgB,EAA0B;MAAA,IAAA4F,MAAA;MACpD,IAAI5F,OAAO,CAACuB,IAAI,KAAK,WAAW,EAAE;QAChC,IAAAsE,oBAAA,GAAiC7F,OAAO,CAAC8F,WAAW;UAA7C3C,UAAU,GAAA0C,oBAAA,CAAV1C,UAAU;UAAEG,UAAU,GAAAuC,oBAAA,CAAVvC,UAAU;QAE7B,IAAIH,UAAU,KAAKE,SAAS,EAAE;UAC5B,IAAI,CAACD,gBAAgB,GAAGD,UAAU;QACpC;QACA,IAAIG,UAAU,KAAKD,SAAS,EAAE;UAC5B,IAAI,CAACE,gBAAgB,GAAGD,UAAU;QACpC;QAEA,IAAI,IAAI,CAACd,eAAe,KAAK,aAAa,EAAE;UAC1C;UACA;UACA;UACA;UACA6C,oBAAW,CAACC,MAAM,CAAC5C,IAAI,CACrB,6FACF,CAAC;UAED,OAAOqD,QAAA,CAAAhH,OAAA,CAAQoC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5B;MACF;MAEA,IAAMlB,cAAc,GAAG,IAAI+F,aAAK,CAAC,CAAC;MAElC,IAAMC,UAAU,GAAG,IAAIlG,mBAAmB,CACxCC,OAAO,EACPC,cAAc,EACd,IAAI,CAACuD,eAAe,CAAC0C,IAAI,CAAC,IAAI,CAChC,CAAC;MAED,IAAI,CAACzD,UAAU,CAACwD,UAAU,CAAC;MAE3B,IAAAE,aAAK,EAAC;QAAA,OAAMP,MAAI,CAAC9C,wBAAwB,CAAC,CAAC;MAAA,EAAC;MAE5C,OAAO7C,cAAc,CAACmG,OAAO;IAC/B;;IAEA;EAAA;IAAA7F,GAAA;IAAAC,KAAA,EACA,SAAA6F,oBAAA,EAA6B;MAC3B,OAAO,IAAI,CAAC7D,eAAe,KAAK,SAAS;IAC3C;EAAC;EAAA,OAAAX,iBAAA;AAAA,EAhPoCyE,sBAAW"}
1
+ {"version":3,"names":["_lodash","require","_common","_webexCore","_constants","_loggerProxy","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","InternalRequestInfo","request","pendingPromise","sendRequestFn","_classCallCheck2","_defineProperty2","pendingPromises","_createClass2","key","value","getPendingPromises","addPendingPromises","_this$pendingPromises","push","_toConsumableArray2","execute","_this","then","forEach","d","resolve","catch","reject","isRequestAffectingConfluenceState","type","roapMessage","messageType","ROAP","ROAP_TYPES","OFFER","LocusMediaRequest","exports","_WebexPlugin","_inherits2","_super","config","options","_this2","_assertThisInitialized2","isRequestInProgress","queuedRequests","confluenceState","addToQueue","info","length","filter","r","executeNextQueuedRequest","_this3","nextRequest","shift","getLatestMuteState","audioMuted","latestAudioMuted","undefined","videoMuted","latestVideoMuted","sendHttpRequest","_this4","uri","concat","selfUrl","MEDIA","_this$getLatestMuteSt","body","device","correlationId","localMedias","respOnlySdp","usingResource","reachability","clientMediaPreferences","webex","internal","newMetrics","submitClientEvent","name","meetingId","sequence","localSdp","_stringify","mediaId","LoggerProxy","logger","method","HTTP_VERBS","PUT","rawError","send","_this5","_request$muteOptions","muteOptions","_promise","Defer","newRequest","bind","defer","promise","isConfluenceCreated","downgradeFromMultistreamToTranscoded","preferTranscoding","WebexPlugin"],"sources":["locusMediaRequest.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {defer} from 'lodash';\nimport {Defer} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {MEDIA, HTTP_VERBS, ROAP} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {ClientMediaPreferences} from '../reachability/reachability.types';\n\nexport type MediaRequestType = 'RoapMessage' | 'LocalMute';\nexport type RequestResult = any;\n\nexport type RoapRequest = {\n type: 'RoapMessage';\n selfUrl: string;\n mediaId: string;\n roapMessage: any;\n reachability: any;\n clientMediaPreferences: ClientMediaPreferences;\n sequence?: any;\n};\n\nexport type LocalMuteRequest = {\n type: 'LocalMute';\n selfUrl: string;\n mediaId: string;\n sequence?: any;\n muteOptions: {\n audioMuted?: boolean;\n videoMuted?: boolean;\n };\n};\n\nexport type Request = RoapRequest | LocalMuteRequest;\n\n/** Class representing a single /media request being sent to Locus */\nclass InternalRequestInfo {\n public readonly request: Request;\n private pendingPromises: Defer[];\n private sendRequestFn: (request: Request) => Promise<RequestResult>;\n\n /** Constructor */\n constructor(\n request: Request,\n pendingPromise: Defer,\n sendRequestFn: (request: Request) => Promise<RequestResult>\n ) {\n this.request = request;\n this.pendingPromises = [pendingPromise];\n this.sendRequestFn = sendRequestFn;\n }\n\n /**\n * Returns the list of pending promises associated with this request\n */\n public getPendingPromises() {\n return this.pendingPromises;\n }\n\n /**\n * Adds promises to the list of pending promises associated with this request\n */\n public addPendingPromises(pendingPromises: Defer[]) {\n this.pendingPromises.push(...pendingPromises);\n }\n\n /**\n * Executes the request. Returned promise is resolved once the request\n * is completed (no matter if it succeeded or failed).\n */\n public execute(): Promise<void> {\n return this.sendRequestFn(this.request)\n .then((result) => {\n // resolve all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.resolve(result));\n })\n .catch((e) => {\n // reject all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.reject(e));\n });\n }\n}\n\nexport type Config = {\n device: {\n url: string;\n deviceType: string;\n countryCode?: string;\n regionCode?: string;\n };\n correlationId: string;\n meetingId: string;\n preferTranscoding: boolean;\n};\n\n/**\n * Returns true if the request is triggering confluence creation in the server\n */\nfunction isRequestAffectingConfluenceState(request: Request): boolean {\n return (\n request.type === 'RoapMessage' && request.roapMessage.messageType === ROAP.ROAP_TYPES.OFFER\n );\n}\n\n/**\n * This class manages all /media API requests to Locus. Every call to that\n * Locus API has to go through this class.\n */\nexport class LocusMediaRequest extends WebexPlugin {\n private config: Config;\n private latestAudioMuted?: boolean;\n private latestVideoMuted?: boolean;\n private isRequestInProgress: boolean;\n private queuedRequests: InternalRequestInfo[];\n private confluenceState: 'not created' | 'creation in progress' | 'created';\n /**\n * Constructor\n */\n constructor(config: Config, options: any) {\n super({}, options);\n this.isRequestInProgress = false;\n this.queuedRequests = [];\n this.config = config;\n this.confluenceState = 'not created';\n }\n\n /**\n * Add a request to the internal queue.\n */\n private addToQueue(info: InternalRequestInfo) {\n if (info.request.type === 'LocalMute' && this.queuedRequests.length > 0) {\n // We don't need additional local mute requests in the queue.\n // We only need at most 1 local mute or 1 roap request, because\n // roap requests also include mute state, so whatever request\n // is sent out, it will send the latest local mute state.\n // We only need to store the pendingPromises so that they get resolved\n // when the roap request is sent out.\n this.queuedRequests[0].addPendingPromises(info.getPendingPromises());\n\n return;\n }\n\n if (info.request.type === 'RoapMessage' && this.queuedRequests.length > 0) {\n // remove any LocalMute requests from the queue, because this Roap message\n // will also update the mute status in Locus, so they are redundant\n this.queuedRequests = this.queuedRequests.filter((r) => {\n if (r.request.type === 'LocalMute') {\n // we need to keep the pending promises from the local mute request\n // that we're removing from the queue\n info.addPendingPromises(r.getPendingPromises());\n\n return false;\n }\n\n return true;\n });\n }\n\n this.queuedRequests.push(info);\n }\n\n /**\n * Takes the next request from the queue and executes it. Once that\n * request is completed, the next one will be taken from the queue\n * and executed and this is repeated until the queue is empty.\n */\n private executeNextQueuedRequest(): void {\n if (this.isRequestInProgress) {\n return;\n }\n\n const nextRequest = this.queuedRequests.shift();\n\n if (nextRequest) {\n this.isRequestInProgress = true;\n nextRequest.execute().then(() => {\n this.isRequestInProgress = false;\n this.executeNextQueuedRequest();\n });\n }\n }\n\n /**\n * Returns latest requested audio and video mute values. If they have never been\n * requested, we assume audio/video to be muted.\n */\n private getLatestMuteState() {\n const audioMuted = this.latestAudioMuted !== undefined ? this.latestAudioMuted : true;\n const videoMuted = this.latestVideoMuted !== undefined ? this.latestVideoMuted : true;\n\n return {audioMuted, videoMuted};\n }\n\n /**\n * Prepares the uri and body for the media request to be sent to Locus\n */\n private sendHttpRequest(request: Request) {\n const uri = `${request.selfUrl}/${MEDIA}`;\n\n const {audioMuted, videoMuted} = this.getLatestMuteState();\n\n // first setup things common to all requests\n const body: any = {\n device: this.config.device,\n correlationId: this.config.correlationId,\n };\n\n const localMedias: any = {\n audioMuted,\n videoMuted,\n };\n\n // now add things specific to request type\n switch (request.type) {\n case 'LocalMute':\n body.respOnlySdp = true;\n body.usingResource = null;\n break;\n\n case 'RoapMessage':\n localMedias.roapMessage = request.roapMessage;\n localMedias.reachability = request.reachability;\n body.clientMediaPreferences = request.clientMediaPreferences;\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.request',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n break;\n }\n\n if (request.sequence) {\n body.sequence = request.sequence;\n }\n\n body.localMedias = [\n {\n localSdp: JSON.stringify(localMedias), // this part must be JSON stringified, Locus requires this\n mediaId: request.mediaId,\n },\n ];\n\n LoggerProxy.logger.info(\n `Meeting:LocusMediaRequest#sendHttpRequest --> ${request.type} audioMuted=${audioMuted} videoMuted=${videoMuted}`\n );\n\n if (isRequestAffectingConfluenceState(request) && this.confluenceState === 'not created') {\n this.confluenceState = 'creation in progress';\n }\n\n // @ts-ignore\n return this.request({\n method: HTTP_VERBS.PUT,\n uri,\n body,\n })\n .then((result) => {\n if (isRequestAffectingConfluenceState(request)) {\n this.confluenceState = 'created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n }\n\n return result;\n })\n .catch((e) => {\n if (\n isRequestAffectingConfluenceState(request) &&\n this.confluenceState === 'creation in progress'\n ) {\n this.confluenceState = 'not created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n rawError: e,\n },\n });\n }\n\n throw e;\n });\n }\n\n /**\n * Sends a media request to Locus\n */\n public send(request: Request): Promise<RequestResult> {\n if (request.type === 'LocalMute') {\n const {audioMuted, videoMuted} = request.muteOptions;\n\n if (audioMuted !== undefined) {\n this.latestAudioMuted = audioMuted;\n }\n if (videoMuted !== undefined) {\n this.latestVideoMuted = videoMuted;\n }\n\n if (this.confluenceState === 'not created') {\n // if there is no confluence, there is no point sending out local mute request\n // as it will fail so we just store the latest audio/video muted values\n // and resolve immediately, so that higher layer (MuteState class) doesn't get blocked\n // and can call us again if user mutes/unmutes again before confluence is created\n LoggerProxy.logger.info(\n 'Meeting:LocusMediaRequest#send --> called with LocalMute request before confluence creation'\n );\n\n return Promise.resolve({});\n }\n }\n\n const pendingPromise = new Defer();\n\n const newRequest = new InternalRequestInfo(\n request,\n pendingPromise,\n this.sendHttpRequest.bind(this)\n );\n\n this.addToQueue(newRequest);\n\n defer(() => this.executeNextQueuedRequest());\n\n return pendingPromise.promise;\n }\n\n /** Returns true if a confluence on the server is already created */\n public isConfluenceCreated() {\n return this.confluenceState === 'created';\n }\n\n /**\n * This method needs to be called when we downgrade from multistream to transcoded connection.\n */\n public downgradeFromMultistreamToTranscoded() {\n this.config.preferTranscoding = true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsD,SAAAM,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,K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AAAtE,iBAAA;AAAA,EAnPoCuE,sBAAW"}
@@ -0,0 +1,178 @@
1
+ import { ServerMuteReason } from '@webex/media-helpers';
2
+ export declare const createMuteState: (type: any, meeting: any, enabled: boolean) => MuteState;
3
+ /** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches
4
+ the last requested state by the client.
5
+
6
+ More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#
7
+
8
+ This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called
9
+ */
10
+ export declare class MuteState {
11
+ state: {
12
+ client: {
13
+ enabled: boolean;
14
+ localMute: boolean;
15
+ };
16
+ server: {
17
+ localMute: boolean;
18
+ remoteMute: boolean;
19
+ unmuteAllowed: boolean;
20
+ };
21
+ syncToServerInProgress: boolean;
22
+ };
23
+ type: any;
24
+ ignoreMuteStateChange: boolean;
25
+ /**
26
+ * Constructor
27
+ *
28
+ * @param {String} type - audio or video
29
+ * @param {Object} meeting - the meeting object (used for reading current remote mute status)
30
+ * @param {boolean} enabled - whether the client audio/video is enabled at all
31
+ */
32
+ constructor(type: string, meeting: any, enabled: boolean);
33
+ /**
34
+ * Starts the mute state machine. Needs to be called after a new MuteState instance is created.
35
+ *
36
+ * @param {Object} meeting - the meeting object
37
+ * @returns {void}
38
+ */
39
+ init(meeting: any): void;
40
+ /**
41
+ * This method needs to be called whenever the local audio/video stream has changed.
42
+ * It reapplies the remote mute state onto the new stream and also reads the current
43
+ * local mute state from the stream and updates the internal state machine and sends
44
+ * any required requests to the server.
45
+ *
46
+ * @param {Object} meeting - the meeting object
47
+ * @returns {void}
48
+ */
49
+ handleLocalStreamChange(meeting: any): void;
50
+ /**
51
+ * Enables/disables audio/video
52
+ *
53
+ * @param {Object} meeting - the meeting object
54
+ * @param {boolean} enable
55
+ * @returns {void}
56
+ */
57
+ enable(meeting: any, enable: boolean): void;
58
+ /**
59
+ * Mutes/unmutes local stream
60
+ *
61
+ * @param {Object} meeting - the meeting object
62
+ * @param {Boolean} mute - true to mute the stream, false to unmute it
63
+ * @param {ServerMuteReason} reason - reason for muting/unmuting
64
+ * @returns {void}
65
+ */
66
+ private muteLocalStream;
67
+ /**
68
+ * This method should be called when the local stream mute state is changed
69
+ * @public
70
+ * @memberof MuteState
71
+ * @param {Object} [meeting] the meeting object
72
+ * @param {Boolean} [mute] true for muting, false for unmuting request
73
+ * @returns {void}
74
+ */
75
+ handleLocalStreamMuteStateChange(meeting?: any): void;
76
+ /**
77
+ * Applies the current mute state to the local stream (by enabling or disabling it accordingly)
78
+ *
79
+ * @public
80
+ * @param {Object} [meeting] the meeting object
81
+ * @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream
82
+ * @memberof MuteState
83
+ * @returns {void}
84
+ */
85
+ applyClientStateLocally(meeting?: any, reason?: ServerMuteReason): void;
86
+ /** Returns true if client is locally muted - it takes into account not just the client local mute state,
87
+ * but also whether audio/video is enabled at all
88
+ *
89
+ * @returns {boolean}
90
+ */
91
+ private getClientLocalMuteState;
92
+ /**
93
+ * Updates the server local and remote mute values so that they match the current client desired state.
94
+ *
95
+ * @private
96
+ * @param {Object} [meeting] the meeting object
97
+ * @memberof MuteState
98
+ * @returns {void}
99
+ */
100
+ private applyClientStateToServer;
101
+ /**
102
+ * Sets the local mute value in the server
103
+ *
104
+ * @private
105
+ * @param {Object} [meeting] the meeting object
106
+ * @memberof MuteState
107
+ * @returns {Promise}
108
+ */
109
+ private sendLocalMuteRequestToServer;
110
+ /**
111
+ * Sets the remote mute value in the server
112
+ *
113
+ * @private
114
+ * @param {Object} [meeting] the meeting object
115
+ * @memberof MuteState
116
+ * @returns {Promise}
117
+ */
118
+ private sendRemoteMuteRequestToServer;
119
+ /** Applies the current value for unmute allowed to the underlying stream
120
+ *
121
+ * @param {Meeting} meeting
122
+ * @returns {void}
123
+ */
124
+ private applyUnmuteAllowedToStream;
125
+ /**
126
+ * This method should be called whenever the server remote mute state is changed
127
+ *
128
+ * @public
129
+ * @memberof MuteState
130
+ * @param {Meeting} meeting
131
+ * @param {Boolean} [muted] true if user is remotely muted, false otherwise
132
+ * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when "hard mute" feature is used)
133
+ * @returns {undefined}
134
+ */
135
+ handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean): void;
136
+ /**
137
+ * This method should be called whenever we receive from the server a requirement to locally unmute
138
+ *
139
+ * @public
140
+ * @memberof MuteState
141
+ * @param {Object} [meeting] the meeting object
142
+ * @returns {undefined}
143
+ */
144
+ handleServerLocalUnmuteRequired(meeting?: any): void;
145
+ /**
146
+ * Returns true if the user is locally or remotely muted.
147
+ * It only checks the mute status, ignoring the fact whether audio/video is enabled.
148
+ *
149
+ * @public
150
+ * @memberof MuteState
151
+ * @returns {Boolean}
152
+ */
153
+ isMuted(): boolean;
154
+ /**
155
+ * Returns true if the user is remotely muted
156
+ *
157
+ * @public
158
+ * @memberof MuteState
159
+ * @returns {Boolean}
160
+ */
161
+ isRemotelyMuted(): boolean;
162
+ /**
163
+ * Returns true if unmute is allowed
164
+ *
165
+ * @public
166
+ * @memberof MuteState
167
+ * @returns {Boolean}
168
+ */
169
+ isUnmuteAllowed(): boolean;
170
+ /**
171
+ * Returns true if the user is locally muted or audio/video is disabled
172
+ *
173
+ * @public
174
+ * @memberof MuteState
175
+ * @returns {Boolean}
176
+ */
177
+ isLocallyMuted(): boolean;
178
+ }
@@ -342,12 +342,7 @@ var MuteState = exports.MuteState = /*#__PURE__*/function () {
342
342
  }
343
343
  if (muted !== undefined) {
344
344
  this.state.server.remoteMute = muted;
345
-
346
- // We never want to unmute the local stream from a server remote mute update.
347
- // Moderated unmute is handled by a different function.
348
- if (muted) {
349
- this.muteLocalStream(meeting, muted, 'remotelyMuted');
350
- }
345
+ this.muteLocalStream(meeting, muted, 'remotelyMuted');
351
346
  }
352
347
  }
353
348
 
@@ -1 +1 @@
1
- {"version":3,"names":["_loggerProxy","_interopRequireDefault","require","_parameter","_util","_constants","createMuteState","exports","type","meeting","enabled","LoggerProxy","logger","info","concat","id","muteState","MuteState","_meeting$remoteVideoM","_meeting$unmuteVideoA","_classCallCheck2","default","_defineProperty2","AUDIO","VIDEO","ParameterError","ignoreMuteStateChange","state","client","localMute","server","remoteMute","remoteMuted","remoteVideoMuted","unmuteAllowed","unmuteVideoAllowed","syncToServerInProgress","_createClass2","key","value","init","_meeting$mediaPropert","_meeting$mediaPropert2","applyUnmuteAllowedToStream","muteLocalStream","initialMute","mediaProperties","audioStream","muted","videoStream","undefined","applyClientStateToServer","handleLocalStreamChange","enable","mute","reason","_meeting$mediaPropert3","setServerMuted","_meeting$mediaPropert4","handleLocalStreamMuteStateChange","newMuteState","userMuteState","systemMuteState","_meeting$mediaPropert5","_meeting$mediaPropert6","_meeting$mediaPropert7","userMuted","systemMuted","_meeting$mediaPropert8","_meeting$mediaPropert9","_meeting$mediaPropert10","applyClientStateLocally","getClientLocalMuteState","_this","localMuteState","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","_promise","resolve","then","sendRemoteMuteRequestToServer","catch","e","warn","_this2","audioMuted","videoMuted","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","handleLocusDelta","remoteUpdateError","reject","_this3","members","muteMember","selfId","_meeting$mediaPropert11","setUnmuteAllowed","_meeting$mediaPropert12","handleServerRemoteMuteUpdate","handleServerLocalUnmuteRequired","_meeting$mediaPropert13","_meeting$mediaPropert14","isMuted","isRemotelyMuted","isUnmuteAllowed","isLocallyMuted"],"sources":["muteState.ts"],"sourcesContent":["import {ServerMuteReason} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const createMuteState = (type, meeting, enabled: boolean) => {\n // todo: remove the meeting argument (SPARK-399695)\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n const muteState = new MuteState(type, meeting, enabled);\n\n return muteState;\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n\n This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called\n*/\nexport class MuteState {\n state: {\n client: {\n enabled: boolean; // indicates if audio/video is enabled at all or not\n localMute: boolean;\n };\n server: {localMute: boolean; remoteMute: boolean; unmuteAllowed: boolean};\n syncToServerInProgress: boolean;\n };\n\n type: any;\n ignoreMuteStateChange: boolean;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(type: string, meeting: any, enabled: boolean) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.ignoreMuteStateChange = false;\n this.state = {\n client: {\n enabled,\n localMute: true,\n },\n server: {\n localMute: true,\n // because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined\n remoteMute: type === AUDIO ? meeting.remoteMuted : meeting.remoteVideoMuted ?? false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : meeting.unmuteVideoAllowed ?? true,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Starts the mute state machine. Needs to be called after a new MuteState instance is created.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public init(meeting: any) {\n this.applyUnmuteAllowedToStream(meeting);\n\n // if we are remotely muted, we need to apply that to the local stream now (mute on-entry)\n if (this.state.server.remoteMute) {\n this.muteLocalStream(meeting, this.state.server.remoteMute, 'remotelyMuted');\n }\n\n const initialMute =\n this.type === AUDIO\n ? meeting.mediaProperties.audioStream?.muted\n : meeting.mediaProperties.videoStream?.muted;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#init --> ${this.type}: local stream initial mute state: ${initialMute}`\n );\n\n if (initialMute !== undefined) {\n this.state.client.localMute = initialMute;\n } else {\n // there is no stream, so it's like we are locally muted\n // (this is important especially for transcoded meetings, in which the SDP m-line direction always stays \"sendrecv\")\n this.state.client.localMute = true;\n }\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * This method needs to be called whenever the local audio/video stream has changed.\n * It reapplies the remote mute state onto the new stream and also reads the current\n * local mute state from the stream and updates the internal state machine and sends\n * any required requests to the server.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public handleLocalStreamChange(meeting: any) {\n return this.init(meeting);\n }\n\n /**\n * Enables/disables audio/video\n *\n * @param {Object} meeting - the meeting object\n * @param {boolean} enable\n * @returns {void}\n */\n public enable(meeting: any, enable: boolean) {\n this.state.client.enabled = enable;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Mutes/unmutes local stream\n *\n * @param {Object} meeting - the meeting object\n * @param {Boolean} mute - true to mute the stream, false to unmute it\n * @param {ServerMuteReason} reason - reason for muting/unmuting\n * @returns {void}\n */\n private muteLocalStream(meeting: any, mute: boolean, reason: ServerMuteReason) {\n this.ignoreMuteStateChange = true;\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setServerMuted(mute, reason);\n } else {\n meeting.mediaProperties.videoStream?.setServerMuted(mute, reason);\n }\n this.ignoreMuteStateChange = false;\n }\n\n /**\n * This method should be called when the local stream mute state is changed\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {void}\n */\n public handleLocalStreamMuteStateChange(meeting?: any) {\n if (this.ignoreMuteStateChange) {\n return;\n }\n\n // either user or system may have triggered a mute state change, but localMute should reflect both\n let newMuteState: boolean;\n let userMuteState: boolean;\n let systemMuteState: boolean;\n if (this.type === AUDIO) {\n newMuteState = meeting.mediaProperties.audioStream?.muted;\n userMuteState = meeting.mediaProperties.audioStream?.userMuted;\n systemMuteState = meeting.mediaProperties.audioStream?.systemMuted;\n } else {\n newMuteState = meeting.mediaProperties.videoStream?.muted;\n userMuteState = meeting.mediaProperties.videoStream?.userMuted;\n systemMuteState = meeting.mediaProperties.videoStream?.systemMuted;\n }\n\n LoggerProxy.logger.info(\n `Meeting:muteState#handleLocalStreamMuteStateChange --> ${this.type}: local stream new mute state: ${newMuteState} (user mute: ${userMuteState}, system mute: ${systemMuteState})`\n );\n\n this.state.client.localMute = newMuteState;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Applies the current mute state to the local stream (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any, reason?: ServerMuteReason) {\n this.muteLocalStream(meeting, this.state.client.localMute, reason);\n }\n\n /** Returns true if client is locally muted - it takes into account not just the client local mute state,\n * but also whether audio/video is enabled at all\n *\n * @returns {boolean}\n */\n private getClientLocalMuteState() {\n return this.state.client.enabled ? this.state.client.localMute : true;\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: any) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteState = this.getClientLocalMuteState();\n const localMuteRequiresSync = localMuteState !== this.state.server.localMute;\n const remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${localMuteState} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n LoggerProxy.logger.warn(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: error: ${e}`\n );\n\n // failed to apply client state to server, so revert stream mute state to server state\n this.muteLocalStream(\n meeting,\n this.state.server.localMute || this.state.server.remoteMute,\n 'clientRequestFailed'\n );\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted = this.type === AUDIO ? this.getClientLocalMuteState() : undefined;\n const videoMuted = this.type === VIDEO ? this.getClientLocalMuteState() : undefined;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n if (locus) {\n meeting.locusInfo.handleLocusDelta(locus, meeting);\n }\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n const remoteMute = this.getClientLocalMuteState();\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute, this.type === AUDIO)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /** Applies the current value for unmute allowed to the underlying stream\n *\n * @param {Meeting} meeting\n * @returns {void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private applyUnmuteAllowedToStream(meeting: any) {\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n } else {\n meeting.mediaProperties.videoStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n }\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Meeting} meeting\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n if (unmuteAllowed !== undefined) {\n this.state.server.unmuteAllowed = unmuteAllowed;\n this.applyUnmuteAllowedToStream(meeting);\n }\n if (muted !== undefined) {\n this.state.server.remoteMute = muted;\n\n // We never want to unmute the local stream from a server remote mute update.\n // Moderated unmute is handled by a different function.\n if (muted) {\n this.muteLocalStream(meeting, muted, 'remotelyMuted');\n }\n }\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [unmuteAllowed] whether the user is allowed to unmute self\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting: any, unmuteAllowed: boolean) {\n if (!this.state.client.enabled) {\n LoggerProxy.logger.warn(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received while ${this.type} is disabled -> local unmute will not result in ${this.type} being sent`\n );\n } else {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute (unmuteAllowed=${unmuteAllowed})`\n );\n }\n\n // todo: I'm seeing \"you can now unmute yourself \" popup when this happens - but same thing happens on web.w.c so we can ignore for now\n this.state.server.remoteMute = false;\n this.state.server.unmuteAllowed = unmuteAllowed;\n\n this.applyUnmuteAllowedToStream(meeting);\n\n // change user mute state to false, but keep localMute true if overall mute state is still true\n this.muteLocalStream(meeting, false, 'localUnmuteRequired');\n if (this.type === AUDIO) {\n this.state.client.localMute = meeting.mediaProperties.audioStream?.muted;\n } else {\n this.state.client.localMute = meeting.mediaProperties.videoStream?.muted;\n }\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted.\n * It only checks the mute status, ignoring the fact whether audio/video is enabled.\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isRemotelyMuted() {\n return this.state.server.remoteMute;\n }\n\n /**\n * Returns true if unmute is allowed\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isUnmuteAllowed() {\n return this.state.server.unmuteAllowed;\n }\n\n /**\n * Returns true if the user is locally muted or audio/video is disabled\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isLocallyMuted() {\n return this.getClientLocalMuteState();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA;AACO,IAAMI,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAIE,IAAI,EAAEC,OAAO,EAAEC,OAAgB,EAAK;EAClE;;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,0CAAAC,MAAA,CACoBN,IAAI,0CAAAM,MAAA,CAAuCL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,EAAE,CACjG,CAAC;EAED,IAAMC,SAAS,GAAG,IAAIC,SAAS,CAACT,IAAI,EAAEC,OAAO,EAAEC,OAAO,CAAC;EAEvD,OAAOM,SAAS;AAClB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOaC,SAAS,GAAAV,OAAA,CAAAU,SAAA;EAapB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,SAAAA,UAAYT,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;AACA;EANE;IAAAI,GAAA;IAAAC,KAAA,EAOA,SAAAuE,eAAA,EAAwB;MACtB,OAAO,IAAI,CAACtC,uBAAuB,CAAC,CAAC;IACvC;EAAC;EAAA,OAAAvD,SAAA;AAAA"}
1
+ {"version":3,"names":["_loggerProxy","_interopRequireDefault","require","_parameter","_util","_constants","createMuteState","exports","type","meeting","enabled","LoggerProxy","logger","info","concat","id","muteState","MuteState","_meeting$remoteVideoM","_meeting$unmuteVideoA","_classCallCheck2","default","_defineProperty2","AUDIO","VIDEO","ParameterError","ignoreMuteStateChange","state","client","localMute","server","remoteMute","remoteMuted","remoteVideoMuted","unmuteAllowed","unmuteVideoAllowed","syncToServerInProgress","_createClass2","key","value","init","_meeting$mediaPropert","_meeting$mediaPropert2","applyUnmuteAllowedToStream","muteLocalStream","initialMute","mediaProperties","audioStream","muted","videoStream","undefined","applyClientStateToServer","handleLocalStreamChange","enable","mute","reason","_meeting$mediaPropert3","setServerMuted","_meeting$mediaPropert4","handleLocalStreamMuteStateChange","newMuteState","userMuteState","systemMuteState","_meeting$mediaPropert5","_meeting$mediaPropert6","_meeting$mediaPropert7","userMuted","systemMuted","_meeting$mediaPropert8","_meeting$mediaPropert9","_meeting$mediaPropert10","applyClientStateLocally","getClientLocalMuteState","_this","localMuteState","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","_promise","resolve","then","sendRemoteMuteRequestToServer","catch","e","warn","_this2","audioMuted","videoMuted","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","handleLocusDelta","remoteUpdateError","reject","_this3","members","muteMember","selfId","_meeting$mediaPropert11","setUnmuteAllowed","_meeting$mediaPropert12","handleServerRemoteMuteUpdate","handleServerLocalUnmuteRequired","_meeting$mediaPropert13","_meeting$mediaPropert14","isMuted","isRemotelyMuted","isUnmuteAllowed","isLocallyMuted"],"sources":["muteState.ts"],"sourcesContent":["import {ServerMuteReason} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const createMuteState = (type, meeting, enabled: boolean) => {\n // todo: remove the meeting argument (SPARK-399695)\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n const muteState = new MuteState(type, meeting, enabled);\n\n return muteState;\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n\n This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called\n*/\nexport class MuteState {\n state: {\n client: {\n enabled: boolean; // indicates if audio/video is enabled at all or not\n localMute: boolean;\n };\n server: {localMute: boolean; remoteMute: boolean; unmuteAllowed: boolean};\n syncToServerInProgress: boolean;\n };\n\n type: any;\n ignoreMuteStateChange: boolean;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(type: string, meeting: any, enabled: boolean) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.ignoreMuteStateChange = false;\n this.state = {\n client: {\n enabled,\n localMute: true,\n },\n server: {\n localMute: true,\n // because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined\n remoteMute: type === AUDIO ? meeting.remoteMuted : meeting.remoteVideoMuted ?? false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : meeting.unmuteVideoAllowed ?? true,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Starts the mute state machine. Needs to be called after a new MuteState instance is created.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public init(meeting: any) {\n this.applyUnmuteAllowedToStream(meeting);\n\n // if we are remotely muted, we need to apply that to the local stream now (mute on-entry)\n if (this.state.server.remoteMute) {\n this.muteLocalStream(meeting, this.state.server.remoteMute, 'remotelyMuted');\n }\n\n const initialMute =\n this.type === AUDIO\n ? meeting.mediaProperties.audioStream?.muted\n : meeting.mediaProperties.videoStream?.muted;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#init --> ${this.type}: local stream initial mute state: ${initialMute}`\n );\n\n if (initialMute !== undefined) {\n this.state.client.localMute = initialMute;\n } else {\n // there is no stream, so it's like we are locally muted\n // (this is important especially for transcoded meetings, in which the SDP m-line direction always stays \"sendrecv\")\n this.state.client.localMute = true;\n }\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * This method needs to be called whenever the local audio/video stream has changed.\n * It reapplies the remote mute state onto the new stream and also reads the current\n * local mute state from the stream and updates the internal state machine and sends\n * any required requests to the server.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public handleLocalStreamChange(meeting: any) {\n return this.init(meeting);\n }\n\n /**\n * Enables/disables audio/video\n *\n * @param {Object} meeting - the meeting object\n * @param {boolean} enable\n * @returns {void}\n */\n public enable(meeting: any, enable: boolean) {\n this.state.client.enabled = enable;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Mutes/unmutes local stream\n *\n * @param {Object} meeting - the meeting object\n * @param {Boolean} mute - true to mute the stream, false to unmute it\n * @param {ServerMuteReason} reason - reason for muting/unmuting\n * @returns {void}\n */\n private muteLocalStream(meeting: any, mute: boolean, reason: ServerMuteReason) {\n this.ignoreMuteStateChange = true;\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setServerMuted(mute, reason);\n } else {\n meeting.mediaProperties.videoStream?.setServerMuted(mute, reason);\n }\n this.ignoreMuteStateChange = false;\n }\n\n /**\n * This method should be called when the local stream mute state is changed\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {void}\n */\n public handleLocalStreamMuteStateChange(meeting?: any) {\n if (this.ignoreMuteStateChange) {\n return;\n }\n\n // either user or system may have triggered a mute state change, but localMute should reflect both\n let newMuteState: boolean;\n let userMuteState: boolean;\n let systemMuteState: boolean;\n if (this.type === AUDIO) {\n newMuteState = meeting.mediaProperties.audioStream?.muted;\n userMuteState = meeting.mediaProperties.audioStream?.userMuted;\n systemMuteState = meeting.mediaProperties.audioStream?.systemMuted;\n } else {\n newMuteState = meeting.mediaProperties.videoStream?.muted;\n userMuteState = meeting.mediaProperties.videoStream?.userMuted;\n systemMuteState = meeting.mediaProperties.videoStream?.systemMuted;\n }\n\n LoggerProxy.logger.info(\n `Meeting:muteState#handleLocalStreamMuteStateChange --> ${this.type}: local stream new mute state: ${newMuteState} (user mute: ${userMuteState}, system mute: ${systemMuteState})`\n );\n\n this.state.client.localMute = newMuteState;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Applies the current mute state to the local stream (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any, reason?: ServerMuteReason) {\n this.muteLocalStream(meeting, this.state.client.localMute, reason);\n }\n\n /** Returns true if client is locally muted - it takes into account not just the client local mute state,\n * but also whether audio/video is enabled at all\n *\n * @returns {boolean}\n */\n private getClientLocalMuteState() {\n return this.state.client.enabled ? this.state.client.localMute : true;\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: any) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteState = this.getClientLocalMuteState();\n const localMuteRequiresSync = localMuteState !== this.state.server.localMute;\n const remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${localMuteState} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n LoggerProxy.logger.warn(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: error: ${e}`\n );\n\n // failed to apply client state to server, so revert stream mute state to server state\n this.muteLocalStream(\n meeting,\n this.state.server.localMute || this.state.server.remoteMute,\n 'clientRequestFailed'\n );\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted = this.type === AUDIO ? this.getClientLocalMuteState() : undefined;\n const videoMuted = this.type === VIDEO ? this.getClientLocalMuteState() : undefined;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n if (locus) {\n meeting.locusInfo.handleLocusDelta(locus, meeting);\n }\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n const remoteMute = this.getClientLocalMuteState();\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute, this.type === AUDIO)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /** Applies the current value for unmute allowed to the underlying stream\n *\n * @param {Meeting} meeting\n * @returns {void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private applyUnmuteAllowedToStream(meeting: any) {\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n } else {\n meeting.mediaProperties.videoStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n }\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Meeting} meeting\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n if (unmuteAllowed !== undefined) {\n this.state.server.unmuteAllowed = unmuteAllowed;\n this.applyUnmuteAllowedToStream(meeting);\n }\n if (muted !== undefined) {\n this.state.server.remoteMute = muted;\n this.muteLocalStream(meeting, muted, 'remotelyMuted');\n }\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [unmuteAllowed] whether the user is allowed to unmute self\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting: any, unmuteAllowed: boolean) {\n if (!this.state.client.enabled) {\n LoggerProxy.logger.warn(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received while ${this.type} is disabled -> local unmute will not result in ${this.type} being sent`\n );\n } else {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute (unmuteAllowed=${unmuteAllowed})`\n );\n }\n\n // todo: I'm seeing \"you can now unmute yourself \" popup when this happens - but same thing happens on web.w.c so we can ignore for now\n this.state.server.remoteMute = false;\n this.state.server.unmuteAllowed = unmuteAllowed;\n\n this.applyUnmuteAllowedToStream(meeting);\n\n // change user mute state to false, but keep localMute true if overall mute state is still true\n this.muteLocalStream(meeting, false, 'localUnmuteRequired');\n if (this.type === AUDIO) {\n this.state.client.localMute = meeting.mediaProperties.audioStream?.muted;\n } else {\n this.state.client.localMute = meeting.mediaProperties.videoStream?.muted;\n }\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted.\n * It only checks the mute status, ignoring the fact whether audio/video is enabled.\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isRemotelyMuted() {\n return this.state.server.remoteMute;\n }\n\n /**\n * Returns true if unmute is allowed\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isUnmuteAllowed() {\n return this.state.server.unmuteAllowed;\n }\n\n /**\n * Returns true if the user is locally muted or audio/video is disabled\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isLocallyMuted() {\n return this.getClientLocalMuteState();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA;AACO,IAAMI,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAIE,IAAI,EAAEC,OAAO,EAAEC,OAAgB,EAAK;EAClE;;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,0CAAAC,MAAA,CACoBN,IAAI,0CAAAM,MAAA,CAAuCL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,EAAE,CACjG,CAAC;EAED,IAAMC,SAAS,GAAG,IAAIC,SAAS,CAACT,IAAI,EAAEC,OAAO,EAAEC,OAAO,CAAC;EAEvD,OAAOM,SAAS;AAClB,CAA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