@webex/plugin-meetings 3.12.0-next.16 → 3.12.0-next.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +207 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/dist/aiEnableRequest/index.js +15 -2
  40. package/dist/aiEnableRequest/index.js.map +1 -1
  41. package/dist/annotation/index.js +2 -2
  42. package/dist/annotation/index.js.map +1 -1
  43. package/dist/breakouts/breakout.js +8 -3
  44. package/dist/breakouts/breakout.js.map +1 -1
  45. package/dist/breakouts/events.js +29 -14
  46. package/dist/breakouts/events.js.map +1 -1
  47. package/dist/breakouts/index.js +99 -4
  48. package/dist/breakouts/index.js.map +1 -1
  49. package/dist/common/errors/webex-errors.js +49 -5
  50. package/dist/common/errors/webex-errors.js.map +1 -1
  51. package/dist/config.js +2 -2
  52. package/dist/config.js.map +1 -1
  53. package/dist/constants.js +37 -10
  54. package/dist/constants.js.map +1 -1
  55. package/dist/controls-options-manager/index.js +46 -10
  56. package/dist/controls-options-manager/index.js.map +1 -1
  57. package/dist/hashTree/constants.js +4 -1
  58. package/dist/hashTree/constants.js.map +1 -1
  59. package/dist/hashTree/hashTreeParser.js +1096 -391
  60. package/dist/hashTree/hashTreeParser.js.map +1 -1
  61. package/dist/hashTree/utils.js +20 -0
  62. package/dist/hashTree/utils.js.map +1 -1
  63. package/dist/index.js +7 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  66. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  67. package/dist/interceptors/locusRetry.js +24 -9
  68. package/dist/interceptors/locusRetry.js.map +1 -1
  69. package/dist/interpretation/index.js +55 -12
  70. package/dist/interpretation/index.js.map +1 -1
  71. package/dist/interpretation/interpretation.types.js +7 -0
  72. package/dist/interpretation/interpretation.types.js.map +1 -0
  73. package/dist/interpretation/siLanguage.js +1 -1
  74. package/dist/locus-info/controlsUtils.js +4 -1
  75. package/dist/locus-info/controlsUtils.js.map +1 -1
  76. package/dist/locus-info/index.js +615 -176
  77. package/dist/locus-info/index.js.map +1 -1
  78. package/dist/locus-info/infoUtils.js +36 -5
  79. package/dist/locus-info/infoUtils.js.map +1 -1
  80. package/dist/locus-info/types.js +20 -0
  81. package/dist/locus-info/types.js.map +1 -1
  82. package/dist/media/MediaConnectionAwaiter.js +15 -2
  83. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  84. package/dist/media/index.js +8 -2
  85. package/dist/media/index.js.map +1 -1
  86. package/dist/media/properties.js +4 -5
  87. package/dist/media/properties.js.map +1 -1
  88. package/dist/meeting/in-meeting-actions.js +7 -1
  89. package/dist/meeting/in-meeting-actions.js.map +1 -1
  90. package/dist/meeting/index.js +1688 -835
  91. package/dist/meeting/index.js.map +1 -1
  92. package/dist/meeting/locusMediaRequest.js +229 -82
  93. package/dist/meeting/locusMediaRequest.js.map +1 -1
  94. package/dist/meeting/muteState.js +10 -1
  95. package/dist/meeting/muteState.js.map +1 -1
  96. package/dist/meeting/request.js +5 -2
  97. package/dist/meeting/request.js.map +1 -1
  98. package/dist/meeting/util.js +37 -3
  99. package/dist/meeting/util.js.map +1 -1
  100. package/dist/meeting/voicea-meeting.js +2 -1
  101. package/dist/meeting/voicea-meeting.js.map +1 -1
  102. package/dist/meeting-info/meeting-info-v2.js +9 -3
  103. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  104. package/dist/meetings/index.js +300 -128
  105. package/dist/meetings/index.js.map +1 -1
  106. package/dist/meetings/meetings.types.js +6 -1
  107. package/dist/meetings/meetings.types.js.map +1 -1
  108. package/dist/meetings/request.js +39 -0
  109. package/dist/meetings/request.js.map +1 -1
  110. package/dist/meetings/util.js +116 -18
  111. package/dist/meetings/util.js.map +1 -1
  112. package/dist/member/index.js +10 -0
  113. package/dist/member/index.js.map +1 -1
  114. package/dist/member/types.js.map +1 -1
  115. package/dist/member/util.js +30 -0
  116. package/dist/member/util.js.map +1 -1
  117. package/dist/members/index.js +101 -43
  118. package/dist/members/index.js.map +1 -1
  119. package/dist/members/util.js +8 -1
  120. package/dist/members/util.js.map +1 -1
  121. package/dist/metrics/constants.js +7 -1
  122. package/dist/metrics/constants.js.map +1 -1
  123. package/dist/multistream/codec/constants.js +63 -0
  124. package/dist/multistream/codec/constants.js.map +1 -0
  125. package/dist/multistream/mediaRequestManager.js +62 -15
  126. package/dist/multistream/mediaRequestManager.js.map +1 -1
  127. package/dist/multistream/receiveSlot.js +9 -0
  128. package/dist/multistream/receiveSlot.js.map +1 -1
  129. package/dist/multistream/remoteMediaManager.js +32 -4
  130. package/dist/multistream/remoteMediaManager.js.map +1 -1
  131. package/dist/reachability/clusterReachability.js.map +1 -1
  132. package/dist/reachability/index.js +121 -83
  133. package/dist/reachability/index.js.map +1 -1
  134. package/dist/reachability/reachability.types.js +2 -0
  135. package/dist/reachability/reachability.types.js.map +1 -1
  136. package/dist/reachability/util.js +45 -0
  137. package/dist/reachability/util.js.map +1 -1
  138. package/dist/reactions/reactions.type.js.map +1 -1
  139. package/dist/recording-controller/index.js +1 -3
  140. package/dist/recording-controller/index.js.map +1 -1
  141. package/dist/roap/turnDiscovery.js +8 -1
  142. package/dist/roap/turnDiscovery.js.map +1 -1
  143. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  144. package/dist/types/config.d.ts +2 -2
  145. package/dist/types/constants.d.ts +13 -1
  146. package/dist/types/controls-options-manager/index.d.ts +16 -0
  147. package/dist/types/hashTree/constants.d.ts +1 -0
  148. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  149. package/dist/types/hashTree/utils.d.ts +7 -0
  150. package/dist/types/index.d.ts +3 -0
  151. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  152. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  153. package/dist/types/locus-info/index.d.ts +106 -8
  154. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  155. package/dist/types/locus-info/types.d.ts +22 -1
  156. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  157. package/dist/types/media/properties.d.ts +6 -2
  158. package/dist/types/meeting/in-meeting-actions.d.ts +6 -0
  159. package/dist/types/meeting/index.d.ts +176 -11
  160. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  161. package/dist/types/meeting/request.d.ts +1 -0
  162. package/dist/types/meeting/util.d.ts +9 -0
  163. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  164. package/dist/types/meetings/index.d.ts +40 -19
  165. package/dist/types/meetings/meetings.types.d.ts +15 -0
  166. package/dist/types/meetings/request.d.ts +14 -0
  167. package/dist/types/member/index.d.ts +1 -0
  168. package/dist/types/member/types.d.ts +1 -0
  169. package/dist/types/member/util.d.ts +9 -0
  170. package/dist/types/members/index.d.ts +15 -2
  171. package/dist/types/members/util.d.ts +1 -5
  172. package/dist/types/metrics/constants.d.ts +6 -0
  173. package/dist/types/multistream/codec/constants.d.ts +7 -0
  174. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  175. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  176. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  177. package/dist/types/reachability/index.d.ts +10 -3
  178. package/dist/types/reachability/reachability.types.d.ts +7 -0
  179. package/dist/types/reachability/util.d.ts +17 -0
  180. package/dist/types/reactions/reactions.type.d.ts +3 -0
  181. package/dist/webinar/index.js +307 -161
  182. package/dist/webinar/index.js.map +1 -1
  183. package/package.json +23 -23
  184. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  185. package/src/aiEnableRequest/index.ts +16 -0
  186. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  187. package/src/annotation/index.ts +6 -4
  188. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  189. package/src/breakouts/breakout.ts +3 -1
  190. package/src/breakouts/events.ts +33 -11
  191. package/src/breakouts/index.ts +122 -2
  192. package/src/common/errors/webex-errors.ts +50 -3
  193. package/src/config.ts +2 -2
  194. package/src/constants.ts +21 -3
  195. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  196. package/src/controls-options-manager/index.ts +62 -10
  197. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  198. package/src/hashTree/constants.ts +7 -0
  199. package/src/hashTree/hashTreeParser.ts +861 -193
  200. package/src/hashTree/utils.ts +19 -0
  201. package/src/index.ts +6 -0
  202. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  203. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  204. package/src/interceptors/locusRetry.ts +26 -5
  205. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  206. package/src/interpretation/index.ts +65 -10
  207. package/src/interpretation/interpretation.types.ts +11 -0
  208. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  209. package/src/locus-info/controlsUtils.ts +3 -1
  210. package/src/locus-info/index.ts +566 -164
  211. package/src/locus-info/infoUtils.ts +41 -6
  212. package/src/locus-info/types.ts +26 -1
  213. package/src/media/MediaConnectionAwaiter.ts +21 -4
  214. package/src/media/ai-docs/media-spec.md +267 -0
  215. package/src/media/index.ts +10 -1
  216. package/src/media/properties.ts +8 -3
  217. package/src/meeting/ai-docs/meeting-spec.md +401 -0
  218. package/src/meeting/in-meeting-actions.ts +12 -0
  219. package/src/meeting/index.ts +946 -120
  220. package/src/meeting/locusMediaRequest.ts +106 -6
  221. package/src/meeting/muteState.ts +10 -1
  222. package/src/meeting/request.ts +11 -0
  223. package/src/meeting/util.ts +51 -7
  224. package/src/meeting/voicea-meeting.ts +1 -1
  225. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  226. package/src/meeting-info/meeting-info-v2.ts +10 -4
  227. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  228. package/src/meetings/index.ts +200 -80
  229. package/src/meetings/meetings.types.ts +19 -0
  230. package/src/meetings/request.ts +43 -0
  231. package/src/meetings/util.ts +117 -4
  232. package/src/member/ai-docs/member-spec.md +196 -0
  233. package/src/member/index.ts +10 -0
  234. package/src/member/types.ts +1 -0
  235. package/src/member/util.ts +29 -0
  236. package/src/members/ai-docs/members-spec.md +256 -0
  237. package/src/members/index.ts +70 -7
  238. package/src/members/util.ts +12 -4
  239. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  240. package/src/metrics/constants.ts +6 -0
  241. package/src/multistream/ai-docs/multistream-spec.md +292 -0
  242. package/src/multistream/codec/constants.ts +58 -0
  243. package/src/multistream/mediaRequestManager.ts +119 -28
  244. package/src/multistream/receiveSlot.ts +18 -0
  245. package/src/multistream/remoteMediaManager.ts +23 -1
  246. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  247. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  248. package/src/reachability/clusterReachability.ts +3 -2
  249. package/src/reachability/index.ts +47 -16
  250. package/src/reachability/reachability.types.ts +11 -0
  251. package/src/reachability/util.ts +36 -0
  252. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  253. package/src/reactions/reactions.type.ts +3 -0
  254. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  255. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  256. package/src/recording-controller/index.ts +1 -2
  257. package/src/roap/ai-docs/roap-spec.md +241 -0
  258. package/src/roap/turnDiscovery.ts +9 -1
  259. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  260. package/src/webinar/index.ts +216 -38
  261. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  262. package/test/unit/spec/annotation/index.ts +3 -3
  263. package/test/unit/spec/breakouts/breakout.ts +9 -3
  264. package/test/unit/spec/breakouts/events.ts +120 -2
  265. package/test/unit/spec/breakouts/index.ts +223 -3
  266. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  267. package/test/unit/spec/controls-options-manager/index.js +139 -32
  268. package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
  269. package/test/unit/spec/hashTree/utils.ts +37 -0
  270. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  271. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  272. package/test/unit/spec/interpretation/index.ts +119 -4
  273. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  274. package/test/unit/spec/locus-info/index.js +1014 -58
  275. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  276. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  277. package/test/unit/spec/media/index.ts +92 -0
  278. package/test/unit/spec/media/properties.ts +23 -23
  279. package/test/unit/spec/meeting/in-meeting-actions.ts +6 -0
  280. package/test/unit/spec/meeting/index.js +2838 -109
  281. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  282. package/test/unit/spec/meeting/muteState.js +81 -0
  283. package/test/unit/spec/meeting/request.js +12 -0
  284. package/test/unit/spec/meeting/utils.js +189 -17
  285. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  286. package/test/unit/spec/meeting-info/meetinginfov2.js +76 -10
  287. package/test/unit/spec/meetings/index.js +544 -49
  288. package/test/unit/spec/meetings/request.js +141 -0
  289. package/test/unit/spec/meetings/utils.js +402 -51
  290. package/test/unit/spec/member/index.js +7 -0
  291. package/test/unit/spec/member/util.js +89 -0
  292. package/test/unit/spec/members/index.js +216 -0
  293. package/test/unit/spec/members/request.js +37 -1
  294. package/test/unit/spec/members/utils.js +63 -0
  295. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  296. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  297. package/test/unit/spec/reachability/index.ts +128 -46
  298. package/test/unit/spec/reachability/util.ts +31 -0
  299. package/test/unit/spec/recording-controller/index.js +9 -8
  300. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  301. package/test/unit/spec/webinar/index.ts +332 -31
@@ -1,5 +1,15 @@
1
1
  import {SELF_ROLES, DISPLAY_HINTS, INTERSTITIAL_DISPLAY_HINTS} from '../constants';
2
2
 
3
+ // these values have to match what Locus sends us
4
+ export enum DisplayHintSection {
5
+ JOINED = 'joined',
6
+ MODERATOR = 'moderator',
7
+ COHOST = 'coHost',
8
+ PRESENTER = 'presenter',
9
+ PANELIST = 'panelist',
10
+ ATTENDEE = 'attendee',
11
+ }
12
+
3
13
  const InfoUtils: any = {};
4
14
 
5
15
  InfoUtils.parse = (info, roles, isJoined = true) => {
@@ -7,6 +17,9 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
7
17
  policy: InfoUtils.parsePolicy(info),
8
18
  moderator: InfoUtils.parseModerator(info),
9
19
  coHost: InfoUtils.parseCoHost(info),
20
+ presenter: InfoUtils.parsePresenter(info),
21
+ panelist: InfoUtils.parsePanelist(info),
22
+ attendee: InfoUtils.parseAttendee(info),
10
23
  };
11
24
 
12
25
  let userDisplayHints = isJoined
@@ -27,6 +40,18 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
27
40
  userDisplayHints = {...userDisplayHints, ...parsed.moderator};
28
41
  }
29
42
 
43
+ if (roles.includes(SELF_ROLES.PRESENTER)) {
44
+ userDisplayHints = {...userDisplayHints, ...parsed.presenter};
45
+ }
46
+
47
+ if (roles.includes(SELF_ROLES.PANELIST)) {
48
+ userDisplayHints = {...userDisplayHints, ...parsed.panelist};
49
+ }
50
+
51
+ if (roles.includes(SELF_ROLES.ATTENDEE)) {
52
+ userDisplayHints = {...userDisplayHints, ...parsed.attendee};
53
+ }
54
+
30
55
  parsed.userDisplayHints = Object.keys(userDisplayHints);
31
56
 
32
57
  if (info.sipUri) {
@@ -44,8 +69,8 @@ InfoUtils.parse = (info, roles, isJoined = true) => {
44
69
  return parsed;
45
70
  };
46
71
 
47
- InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
48
- const displayHints = {};
72
+ InfoUtils.parseDisplayHintSection = (info: any, displayHintKey: DisplayHintSection) => {
73
+ const displayHints: Record<string, boolean> = {};
49
74
 
50
75
  if (
51
76
  info &&
@@ -53,7 +78,7 @@ InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
53
78
  info.displayHints[displayHintKey] &&
54
79
  info.displayHints[displayHintKey].length > 0
55
80
  ) {
56
- info.displayHints[displayHintKey].forEach((key) => {
81
+ info.displayHints[displayHintKey].forEach((key: any) => {
57
82
  displayHints[key] = true;
58
83
  });
59
84
  }
@@ -61,20 +86,30 @@ InfoUtils.parseDisplayHintSection = (info, displayHintKey) => {
61
86
  return displayHints;
62
87
  };
63
88
 
64
- InfoUtils.parsePolicy = (info) => InfoUtils.parseDisplayHintSection(info, 'joined');
89
+ InfoUtils.parsePolicy = (info) =>
90
+ InfoUtils.parseDisplayHintSection(info, DisplayHintSection.JOINED);
65
91
 
66
92
  InfoUtils.parseModerator = (info) => {
67
- const displayHints = InfoUtils.parseDisplayHintSection(info, 'moderator');
93
+ const displayHints = InfoUtils.parseDisplayHintSection(info, DisplayHintSection.MODERATOR);
68
94
 
69
95
  return {...displayHints, [DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND]: true};
70
96
  };
71
97
 
72
98
  InfoUtils.parseCoHost = (info) => {
73
- const displayHints = InfoUtils.parseDisplayHintSection(info, 'coHost');
99
+ const displayHints = InfoUtils.parseDisplayHintSection(info, DisplayHintSection.COHOST);
74
100
 
75
101
  return {...displayHints, [DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND]: true};
76
102
  };
77
103
 
104
+ InfoUtils.parsePresenter = (info) =>
105
+ InfoUtils.parseDisplayHintSection(info, DisplayHintSection.PRESENTER);
106
+
107
+ InfoUtils.parsePanelist = (info) =>
108
+ InfoUtils.parseDisplayHintSection(info, DisplayHintSection.PANELIST);
109
+
110
+ InfoUtils.parseAttendee = (info) =>
111
+ InfoUtils.parseDisplayHintSection(info, DisplayHintSection.ATTENDEE);
112
+
78
113
  InfoUtils.isLocked = (policy) => policy.LOCK_STATUS_LOCKED || false;
79
114
 
80
115
  InfoUtils.isUnlocked = (policy) => policy.LOCK_STATUS_UNLOCKED || false;
@@ -1,15 +1,33 @@
1
+ import {Enum} from '../constants';
1
2
  import {HtMeta} from '../hashTree/types';
2
3
 
4
+ export const EndMeetingReason = {
5
+ maxMeetingDuration: 'MAX_MEETING_DURATION',
6
+ allParticipantsLeft: 'ALL_PARTICIPANTS_LEFT',
7
+ sipHostLeft: 'SIP_HOST_LEFT',
8
+ noHost: 'NO_HOST',
9
+ waitingForMpsEndMeetingTimeout: 'WAITING_FOR_MPS_END_MEETING_TIMEOUT',
10
+ fraudDetection: 'FRAUD_DETECTION',
11
+ meetingEndedByHost: 'MEETING_ENDED_BY_HOST',
12
+ meetingUpdated: 'MEETING_UPDATED', // Locus code has comment about EndMeetingIfPossible reason for this one
13
+ meetingCancelled: 'MEETING_CANCELLED', // Locus code has comment about EndMeetingIfPossible reason for this one
14
+ autoEndWithSingleParticipant: 'AUTO_END_WITH_SINGLE_PARTICIPANT',
15
+ breakoutEnded: 'BREAKOUT_ENDED', // indicates that only a breakout session ended, not the whole meeting
16
+ } as const;
17
+
18
+ export type EndMeetingReason = Enum<typeof EndMeetingReason>;
19
+
3
20
  export type LocusFullState = {
4
21
  active: boolean;
5
22
  count: number;
6
23
  lastActive: string;
7
24
  locked: boolean;
8
25
  sessionId: string;
9
- seessionIds: string[];
26
+ sessionIds: string[];
10
27
  startTime: number;
11
28
  state: string;
12
29
  type: string;
30
+ endMeetingReason?: EndMeetingReason;
13
31
  };
14
32
 
15
33
  export type Links = {
@@ -59,3 +77,10 @@ export type ReplacesInfo = {
59
77
  replacedAt: string;
60
78
  sessionId: string;
61
79
  };
80
+
81
+ export const LocusErrorCodes = {
82
+ LOCUS_INACTIVE: 2403004,
83
+ LOCUS_USER_FULL: 2423001,
84
+ } as const;
85
+
86
+ export type LocusErrorCodes = Enum<typeof LocusErrorCodes>;
@@ -10,6 +10,10 @@ export interface MediaConnectionAwaiterProps {
10
10
  correlationId: string;
11
11
  }
12
12
 
13
+ export interface FailureResult {
14
+ iceConnected: boolean;
15
+ }
16
+
13
17
  /**
14
18
  * @class MediaConnectionAwaiter
15
19
  */
@@ -58,6 +62,17 @@ export default class MediaConnectionAwaiter {
58
62
  return this.webrtcMediaConnection.getConnectionState() === ConnectionState.Failed;
59
63
  }
60
64
 
65
+ /**
66
+ * Returns true if ICE connection state indicates connectivity.
67
+ *
68
+ * @returns {boolean}
69
+ */
70
+ private isIceConnected(): boolean {
71
+ const state = this.webrtcMediaConnection.getIceConnectionState();
72
+
73
+ return state === 'connected' || state === 'completed';
74
+ }
75
+
61
76
  /**
62
77
  * Returns true if the ICE Gathering is completed, false otherwise.
63
78
  *
@@ -105,7 +120,7 @@ export default class MediaConnectionAwaiter {
105
120
 
106
121
  this.defer.reject({
107
122
  iceConnected: this.iceConnected,
108
- });
123
+ } satisfies FailureResult);
109
124
  }
110
125
 
111
126
  if (!this.isConnected()) {
@@ -148,7 +163,7 @@ export default class MediaConnectionAwaiter {
148
163
  `Media:MediaConnectionAwaiter#iceConnectionStateHandler --> ICE connection state change -> ${iceConnectionState}`
149
164
  );
150
165
 
151
- if (iceConnectionState === 'connected' && !this.iceConnected) {
166
+ if (this.isIceConnected() && !this.iceConnected) {
152
167
  this.iceConnected = true;
153
168
  }
154
169
 
@@ -249,13 +264,13 @@ export default class MediaConnectionAwaiter {
249
264
 
250
265
  this.defer.reject({
251
266
  iceConnected: this.iceConnected,
252
- });
267
+ } satisfies FailureResult);
253
268
  }
254
269
 
255
270
  /**
256
271
  * Waits for the webrtc media connection to be connected.
257
272
  *
258
- * @returns {Promise}
273
+ * @returns {Promise<void>} In case of failure, the promise is rejected with FailureResult
259
274
  */
260
275
  waitForMediaConnectionConnected(): Promise<void> {
261
276
  if (this.isConnected()) {
@@ -269,6 +284,8 @@ export default class MediaConnectionAwaiter {
269
284
  'Media:MediaConnectionAwaiter#waitForMediaConnectionConnected --> Waiting for media connection to be connected'
270
285
  );
271
286
 
287
+ this.iceConnected = this.isIceConnected();
288
+
272
289
  this.webrtcMediaConnection.on(
273
290
  MediaConnectionEventNames.PEER_CONNECTION_STATE_CHANGED,
274
291
  this.peerConnectionStateCallback
@@ -0,0 +1,267 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: module-spec
3
+ generated_from: module-spec@0.2.2
4
+ generator_plugin: repo-annotation@1.0.5+codex.20260818094939
5
+ generated_by: codex
6
+ approved_by: repository user
7
+ updated_at: 2026-08-22T15:21:29Z
8
+ validation_status: pass-with-warnings
9
+ -->
10
+ # MEDIA — SPEC
11
+
12
+ > Start here → root [`AGENTS.md`](../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md). This is the canonical source-local spec for `src/media/`.
13
+
14
+ ## Metadata
15
+
16
+ | Field | Value |
17
+ |---|---|
18
+ | Module id | `media` |
19
+ | Source path(s) | `src/media/` |
20
+ | Parent spec | — |
21
+ | Doc kind | Module spec |
22
+ | Coverage score | 93% assessed 2026-08-22; 13/14 mandatory fields present; all critical and Important fields present; one noncritical polish gap remains; pending independent validation of the participant-role repair |
23
+ | Generated from | `module-spec` @ SDLC template library `0.2.2` |
24
+ | generated_by / approved_by / updated_at | codex / repository user / 2026-08-22T15:21:29Z |
25
+ | Validation status | pass-with-warnings |
26
+
27
+ ## Evidence Rules
28
+
29
+ Requirements cite current implementation and mirrored unit-test paths. Current code wins over retained prose when they conflict; commit and PR history are excluded by repository-owner decision. Missing test evidence is stated as a gap rather than inferred.
30
+
31
+ ## Source Material Register
32
+
33
+ | Source material | Scope | Decision | Detail location or disposition |
34
+ |---|---|---|---|
35
+ | Retained package README and upgrade guide | overview / API / behavior / tests | used and verified; local-media acquisition, add/update/stop media, ready/stopped events, and teardown guidance were placed into behavior and test strategy |
36
+ | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
37
+
38
+ ## Overview
39
+
40
+ `src/media/` contains 4 direct source/reference file(s) and has 3 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
41
+
42
+ ## Purpose / Responsibility
43
+
44
+ Creates/configures media-core connections, derives media properties, awaits readiness, and exposes media lifecycle helpers to Meeting.
45
+
46
+ ## Stack
47
+
48
+ TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests. Build target: `yarn workspace @webex/plugin-meetings build:src`.
49
+
50
+ ## Folder / Package Structure
51
+
52
+ ```text
53
+ src/media/
54
+ ├── MediaConnectionAwaiter.ts — MediaConnectionAwaiter implementation responsibility
55
+ ├── index.ts — module facade/controller or primary exports
56
+ ├── properties.ts — properties implementation responsibility
57
+ ├── util.ts — normalization/helper functions
58
+ └── ai-docs/media-spec.md — canonical module specification
59
+ ```
60
+
61
+ ## Key Files (source of truth)
62
+
63
+ | File | Holds |
64
+ |---|---|
65
+ | `src/media/MediaConnectionAwaiter.ts` | MediaConnectionAwaiter implementation responsibility |
66
+ | `src/media/index.ts` | module facade/controller or primary exports |
67
+ | `src/media/properties.ts` | properties implementation responsibility |
68
+ | `src/media/util.ts` | normalization/helper functions |
69
+ | `test/unit/spec/media/MediaConnectionAwaiter.ts` and 2 sibling test file(s) | mirrored characterization/unit coverage |
70
+
71
+ ## Public Surface
72
+
73
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
74
+ |---|---|---|---|---|---|---|
75
+ | `media.1` | SDK / in-process | `MediaProperties.setMediaDirection()`, `setMediaSettings()`, `setMediaPeerConnection()`, and `getVideoDeviceId()` / `setVideoDeviceId()` | Hold the media-core configuration and preferred camera identity used by Meeting. | Preserve default directions, null-device behavior, and setter names. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
76
+ | `media.2` | SDK / in-process | local stream setters: `setLocalAudioStream()`, `setLocalVideoStream()`, `setLocalShareAudioStream()`, `setLocalShareVideoStream()`, and `hasLocalShareStream()` | Keep microphone, camera, and share tracks distinct so Meeting can publish and stop them independently. | Preserve optional-stream inputs and the boolean share predicate. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
77
+ | `media.3` | SDK / in-process | remote setters: `setRemoteAudioStream()`, `setRemoteVideoStream()`, `setRemoteShareStream()`, `setRemoteQualityLevel()` | Store the remote media projections consumed by Meeting and UI code. | Preserve independent audio, video, share, and quality fields. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
78
+ | `media.4` | SDK / lifecycle | `unsetRemoteMedia()`, `unsetRemoteShareStream()`, `unsetRemoteStreams()`, and `unsetPeerConnection()` | Detach stored references when the owning Meeting explicitly replaces or tears down media. | These methods do not close the peer connection or stop tracks themselves. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
79
+ | `media.5` | SDK / async | `MediaProperties.waitForMediaConnectionConnected()` plus `MediaConnectionAwaiter.connectionStateChange()`, `peerConnectionStateHandler()`, `iceConnectionStateHandler()`, `iceGatheringStateHandler()`, `onTimeout()`, and `waitForMediaConnectionConnected()` | Resolve readiness or reject with `{iceConnected}` after concrete connection/ICE event and timeout evaluation. | Preserve the single retry for incomplete ICE gathering and listener cleanup on settlement. | `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
80
+ | `media.6` | diagnostic | `MediaProperties.getCurrentConnectionInfo()`, `sendMediaIssueMetric()`, and `MediaConnectionAwaiter.sendMetric()` | Derive connection/IP diagnostics and emit bounded media issue information. | Preserve metric throttling and the existing unknown/fallback values. | `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
81
+ | `media.7` | exported types/constants | `BundlePolicy`, `MediaDirection`, `IPVersion`, `MediaConnectionAwaiterProps`, and `FailureResult` | Provide the concrete configuration and failure shapes used across the meetings package. | Definitions are partitioned precisely: BundlePolicy is in the media index, MediaDirection and IPVersion are in properties, and the awaiter props/result types are in MediaConnectionAwaiter. Add fields compatibly; raw enum/type values are shared package contracts. | `src/media/index.ts`, `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
82
+
83
+ ### Emitted events
84
+
85
+ Current source emits or forwards these observable literals for this operation boundary. Preserve literal values, scope, payload shape, and emission timing; a constant name alone is not a substitute for the consumer-visible value.
86
+
87
+ | Event literal | Constant / expression | Emission evidence |
88
+ |---|---|---|
89
+ | `media:activeSpeakerChanged` | `EVENT_TRIGGERS.ACTIVE_SPEAKER_CHANGED` | `src/meeting/index.ts` |
90
+ | `media:codec:loaded` | `EVENT_TRIGGERS.MEDIA_CODEC_LOADED` | `src/meetings/util.ts` |
91
+ | `media:codec:missing` | `EVENT_TRIGGERS.MEDIA_CODEC_MISSING` | `src/meetings/util.ts` |
92
+ | `media:inboundAudio:issueDetected` | `EVENT_TRIGGERS.MEDIA_INBOUND_AUDIO_ISSUE_DETECTED` | `src/meeting/index.ts` |
93
+ | `media:negotiated` | `EVENT_TRIGGERS.MEDIA_NEGOTIATED` | `src/meeting/index.ts` |
94
+ | `media:ready` | `EVENT_TRIGGERS.MEDIA_READY` | `src/meeting/index.ts` |
95
+ | `media:remoteAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED` | `src/meeting/index.ts` |
96
+ | `media:remoteInterpretationAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_INTERPRETATION_AUDIO_CREATED` | `src/meeting/index.ts` |
97
+ | `media:remoteScreenShareAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED` | `src/meeting/index.ts` |
98
+ | `media:remoteVideo:layoutChanged` | `EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED` | `src/meeting/index.ts` |
99
+ | `media:remoteAudioSourceCountChanged` | `EVENT_TRIGGERS.REMOTE_AUDIO_SOURCE_COUNT_CHANGED` | `src/meeting/index.ts` |
100
+ | `media:remoteVideoSourceCountChanged` | `EVENT_TRIGGERS.REMOTE_VIDEO_SOURCE_COUNT_CHANGED` | `src/meeting/index.ts` |
101
+ | `media:stopped` | `EVENT_TRIGGERS.MEDIA_STOPPED` | `src/meeting/index.ts` |
102
+
103
+ Compatibility notes:
104
+ - Prefer additive options and payload fields. Preserve method/event names, rejection semantics, and cleanup timing; route public changes through `src/index.ts` or the documented owning object.
105
+
106
+ ## Requires (dependencies)
107
+
108
+ Browser WebRTC, @webex/internal-media-core, media helpers, meeting/Locus signaling, ROAP, and logging/metrics.
109
+
110
+ ## Requirements
111
+
112
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
113
+ |---|---|---|---|---|---|---|
114
+ | `MEDIA-R-001` | create and configure a media connection. | Creates/configures media-core connections, derives media properties, awaits readiness, and exposes media lifecycle helpers to Meeting. | `src/media/index.ts` | `test/unit/spec/media/index.ts` | none | PRESENT |
115
+ | `MEDIA-R-002` | `MediaProperties` attaches/replaces local and remote streams and the peer connection; `util.ts` constructs a `MediaStream` from received tracks. `MediaConnectionAwaiter` registers connection-readiness listeners and schedules its timeout, but its terminal branches do not all clear the timer explicitly. | Stream ownership must remain separate from readiness waiting, and documentation must preserve the timer asymmetry visible on immediate connection failure. | `src/media/properties.ts`, `src/media/util.ts`, `src/media/MediaConnectionAwaiter.ts` | `test/unit/spec/media/properties.ts`, `test/unit/spec/media/MediaConnectionAwaiter.ts` | none | PRESENT |
116
+ | `MEDIA-R-003` | Connection failure or timeout rejects with the awaiter result and `MediaConnectionAwaiter.clearCallbacks()` removes only the listeners it registered. It does not close the peer connection or unset streams; explicit `MediaProperties` unset methods detach stored references, while Meeting owns connection closure. | Callers must distinguish readiness-listener cleanup from transport and stream teardown. | `src/media/MediaConnectionAwaiter.ts`, `src/media/properties.ts`, `src/meeting/index.ts` | `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/properties.ts` | none | PRESENT |
117
+ | `MEDIA-R-004` | Media properties translate meeting options and local-stream state into media-core connection configuration. | Meeting callers should not depend directly on low-level media-core option shapes. | `src/media/properties.ts`, `src/media/index.ts` | `test/unit/spec/media/properties.ts`, `test/unit/spec/media/index.ts` | none | PRESENT |
118
+ | `MEDIA-R-005` | Readiness awaiting resolves on connection success after clearing the timer and listeners. On immediate connection failure, `connectionStateChange()` removes listeners and rejects but does not clear the scheduled timer; timeout settlement runs from the timer itself and removes listeners. | Consumers and maintainers must not infer uniform timer cleanup when the failure branch leaves its timeout callback scheduled. | `src/media/MediaConnectionAwaiter.ts` | `test/unit/spec/media/MediaConnectionAwaiter.ts` | characterize the post-failure timer callback and idempotent defer settlement | PRESENT |
119
+ | `MEDIA-R-006` | `MediaProperties.unsetRemoteStreams()` and `unsetPeerConnection()` detach the owned remote streams and connection during replacement/teardown; `util.ts` only creates a `MediaStream` from tracks. | Teardown ownership must be explicit so browser tracks and media-core callbacks do not outlive their meeting. | `src/media/properties.ts`, `src/media/util.ts` | `test/unit/spec/media/properties.ts` | none | PRESENT |
120
+
121
+ ## Design Overview
122
+
123
+ `index.ts` exports media-facing types and helpers; `util.ts` only creates a `MediaStream`; `properties.ts` owns local/remote streams, the peer connection, teardown, and construction of `MediaConnectionAwaiter`, which waits on WebRTC/ICE events with bounded timeouts.
124
+
125
+ ## Data Flow
126
+
127
+ ```mermaid
128
+ flowchart LR
129
+ Meeting[Meeting media operations] --> Props[properties.ts]
130
+ Props --> Core[internal-media-core connection]
131
+ Props --> Awaiter[MediaConnectionAwaiter.ts]
132
+ Awaiter --> Core
133
+ Tracks[MediaStreamTrack inputs] --> Util[util.ts createMediaStream]
134
+ Util --> Props
135
+ Props --> Output[local/remote streams and connection result]
136
+ ```
137
+
138
+ ## Sequence Diagram(s)
139
+
140
+ Sequence coverage:
141
+
142
+ | Operation group | Diagram | Failure coverage |
143
+ |---|---|---|
144
+ | UC-1…UC-5 — media properties and readiness operation groups | Media properties and readiness primary sequence | connection failure, bounded ICE timeout, listener removal, and explicit owner teardown |
145
+ | UC-1…UC-5 — media properties and readiness alternate/failure paths | Media properties and readiness alternate/failure sequence | WebRTC connection failure, incomplete ICE gathering after the bounded retry, missing tracks, or teardown during wait |
146
+
147
+ ### Media properties and readiness primary sequence
148
+
149
+ ```mermaid
150
+ sequenceDiagram
151
+ participant M as Meeting
152
+ participant P as MediaProperties
153
+ participant C as WebRTC media connection
154
+ participant A as MediaConnectionAwaiter
155
+ M->>P: set streams / peer connection
156
+ P->>A: waitForMediaConnectionConnected()
157
+ A->>C: subscribe to connection and ICE changes
158
+ alt connected
159
+ C-->>A: connected/completed
160
+ A-->>P: resolve
161
+ else failed or timeout
162
+ C--xA: failed/incomplete
163
+ A--xP: failure result
164
+ end
165
+ A->>C: remove the awaiter's registered listeners
166
+ P-->>M: connection outcome
167
+ ```
168
+
169
+ ### Media properties and readiness alternate/failure sequence
170
+
171
+ ```mermaid
172
+ sequenceDiagram
173
+ participant P as MediaProperties
174
+ participant A as MediaConnectionAwaiter
175
+ participant C as Media-core connection
176
+ P->>A: waitForMediaConnectionConnected()
177
+ A->>C: register connection and ICE listeners
178
+ alt connection reaches connected/completed
179
+ C-->>A: readiness event
180
+ A-->>P: resolve once; clear timer and listeners
181
+ else failure, closure, or timeout
182
+ C--xA: terminal event or timer expiry
183
+ A--xP: reject and remove listeners; immediate failure leaves timer scheduled
184
+ end
185
+ ```
186
+
187
+ ## Class / Component Relationships
188
+
189
+ ```mermaid
190
+ classDiagram
191
+ class Meeting
192
+ class Props
193
+ class Core
194
+ class Awaiter
195
+ class Tracks
196
+ class Util
197
+ class Output
198
+ Meeting --> Props
199
+ Props --> Core
200
+ Props --> Awaiter
201
+ Awaiter --> Core
202
+ Tracks --> Util
203
+ Util --> Props
204
+ Props --> Output
205
+ ```
206
+
207
+ The arrows identify ownership and delegation inside `src/media/`; files that only declare types or constants are not presented as transports.
208
+
209
+ ## Use Cases
210
+
211
+ - **UC-1:** Store media direction, media settings, preferred video device, and the active media-core connection on `MediaProperties`. Evidence: `src/media/properties.ts`.
212
+ - **UC-2:** Assign microphone, camera, share-audio, and share-video streams independently and test local sharing with `hasLocalShareStream()`. Evidence: `src/media/properties.ts`.
213
+ - **UC-3:** Replace or unset remote audio, video, and share references without treating those assignments as track or peer-connection closure. Evidence: `src/media/properties.ts`.
214
+ - **UC-4:** Await connection readiness, retry one incomplete ICE-gathering timeout, and remove only the awaiter's WebRTC listeners when it settles. Evidence: `src/media/MediaConnectionAwaiter.ts`.
215
+ - **UC-5:** Derive current connection diagnostics and throttle repeated media-issue metric submission. Evidence: `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts`.
216
+
217
+ ## State Model
218
+
219
+ Media connection, transceivers/streams, readiness waiters, and listener cleanup are held for the meeting media lifetime.
220
+
221
+ ## Business Rules & Invariants
222
+
223
+ - Every readiness waiter exposes one defer result and removes registered listeners on its terminal path. Success clears the timer; immediate connection failure does not, so its timeout callback may still run later. Closed media is not reused, and permission/negotiation failures remain visible. Enforced by `src/media/MediaConnectionAwaiter.ts` and supporting code under `src/media/`.
224
+
225
+ ## Concurrency & Reactive Flow
226
+
227
+ - Each `MediaConnectionAwaiter` uses one defer for its specific media-core connection and removes its WebRTC listeners on terminal paths. The connected path clears its timer; the immediate failed-state path does not. Replacing or tearing down media uses `MediaProperties.unsetRemoteStreams()` and `unsetPeerConnection()` so old stream/connection references are detached before reuse.
228
+
229
+ ## Protocol / Wire Format
230
+
231
+ - External payloads are parsed/serialized by files under `src/media/` and existing Webex/media dependencies. Preserve current field names, enum/raw values, sequence identifiers, and compatibility behavior; do not treat the normalized client model as the wire schema.
232
+
233
+ ## Error Handling & Failure Modes
234
+
235
+ | Condition | Signal | Caller recovery |
236
+ |---|---|---|
237
+ | Media connection reports immediate failure | `connectionStateChange()` rejects with its connection result and removes registered listeners but does not clear the scheduled timer. | Tear down or replace the connection; do not assume rejection canceled the timeout callback. |
238
+ | Media does not become ready before the awaiter's timeout | The timeout callback rejects with its connection result and removes registered listeners; one retry timer is scheduled when ICE gathering is incomplete on the first expiry. | Tear down or replace that connection before beginning a new media attempt. |
239
+ | Media connection reaches the expected connected/completed state | The awaiter resolves once and removes its listeners and timer. | Continue using the established connection. |
240
+ | Remote streams or peer connection are replaced/removed | `MediaProperties` unsets the owned stream or connection reference; `util.ts` only constructs a `MediaStream` from supplied tracks. | Do not assign transport lifecycle ownership to the utility helper. |
241
+
242
+ ## Pitfalls
243
+
244
+ - Event listeners can fire before or after a wait begins. Register and inspect atomically. The connected path clears its timeout and listeners; the immediate failed-state path removes listeners but leaves the scheduled timeout callback in place, and timeout settlement removes listeners from within the timer path.
245
+ - Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
246
+
247
+ ## Key Design Trade-off
248
+
249
+ - A media-core adapter isolates Meeting from lower-level WebRTC details, adding translation code but keeping public meeting semantics stable.
250
+
251
+ ## Test-Case Strategy (module)
252
+
253
+ Use the current mirrored suites: `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/index.ts`, `test/unit/spec/media/properties.ts`. Characterize the media-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
254
+
255
+ | Behavior / Requirement | Existing test evidence | Gap |
256
+ |---|---|---|
257
+ | `MEDIA-R-001` | `test/unit/spec/media/index.ts` | cover property assignment, readiness waiting, diagnostics, and explicit teardown separately |
258
+ | `MEDIA-R-002` | `test/unit/spec/media/index.ts` | awaiter settlement versus Meeting-owned peer closure needs a boundary assertion |
259
+ | `MEDIA-R-003` | `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/properties.ts` | add a boundary assertion that awaiter rejection removes listeners but neither closes the connection nor unsets `MediaProperties` references |
260
+ | `MEDIA-R-004` | `test/unit/spec/media/properties.ts` | none |
261
+ | `MEDIA-R-005` | `test/unit/spec/media/MediaConnectionAwaiter.ts` | verify event-before-await race |
262
+ | `MEDIA-R-006` | `test/unit/spec/media/properties.ts` | verify unset during partial setup and replacement |
263
+
264
+ ## Traceability
265
+
266
+ - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
267
+ - Coverage state and contracts baseline: `../../../.sdd/manifest.json`
@@ -142,9 +142,11 @@ Media.createMediaConnection = (
142
142
  enableExtmap?: boolean;
143
143
  turnServerInfo?: TurnServerInfo;
144
144
  bundlePolicy?: BundlePolicy;
145
+ iceTransportPolicy?: RTCIceTransportPolicy;
145
146
  iceCandidatesTimeout?: number;
146
147
  disableAudioMainDtx?: boolean;
147
148
  enableAudioTwcc?: boolean;
149
+ enableAv1SlidesSupport?: boolean;
148
150
  stopIceGatheringAfterFirstRelayCandidate?: boolean;
149
151
  }
150
152
  ) => {
@@ -156,16 +158,18 @@ Media.createMediaConnection = (
156
158
  enableExtmap,
157
159
  turnServerInfo,
158
160
  bundlePolicy,
161
+ iceTransportPolicy,
159
162
  iceCandidatesTimeout,
160
163
  disableAudioMainDtx,
161
164
  enableAudioTwcc,
165
+ enableAv1SlidesSupport,
162
166
  stopIceGatheringAfterFirstRelayCandidate,
163
167
  } = options;
164
168
 
165
169
  const iceServers = [];
166
170
 
167
171
  // we might not have any TURN server if TURN discovery failed or wasn't done or we land on a video mesh node
168
- if (turnServerInfo?.urls.length > 0) {
172
+ if (turnServerInfo && turnServerInfo.urls.length > 0) {
169
173
  // TURN-TLS server
170
174
  iceServers.push({
171
175
  urls: turnServerInfo.urls,
@@ -178,12 +182,17 @@ Media.createMediaConnection = (
178
182
  const config: MultistreamConnectionConfig = {
179
183
  iceServers,
180
184
  disableAudioTwcc: !enableAudioTwcc,
185
+ enableAV1SlidesSupport: !!enableAv1SlidesSupport,
181
186
  };
182
187
 
183
188
  if (bundlePolicy) {
184
189
  config.bundlePolicy = bundlePolicy;
185
190
  }
186
191
 
192
+ if (iceTransportPolicy) {
193
+ config.iceTransportPolicy = iceTransportPolicy;
194
+ }
195
+
187
196
  if (disableAudioMainDtx !== undefined) {
188
197
  config.disableAudioMainDtx = disableAudioMainDtx;
189
198
  }
@@ -43,6 +43,7 @@ export default class MediaProperties {
43
43
  shareAudioStream?: LocalSystemAudioStream;
44
44
  videoDeviceId: any;
45
45
  videoStream?: LocalCameraStream;
46
+ srtpCipher: string | undefined;
46
47
  namespace = MEETINGS;
47
48
  mediaIssueCounters: {[key: string]: number} = {};
48
49
  throttledSendMediaIssueMetric: ReturnType<typeof throttle>;
@@ -454,10 +455,14 @@ export default class MediaProperties {
454
455
  *
455
456
  * @param {string} issueType
456
457
  * @param {string} issueSubType
457
- * @param {string} correlationId
458
+ * @param {Object} metadata
458
459
  * @returns {void}
459
460
  */
460
- public sendMediaIssueMetric(issueType: string, issueSubType: string, correlationId) {
461
+ public sendMediaIssueMetric(
462
+ issueType: string,
463
+ issueSubType: string,
464
+ metadata: {correlationId: string; isMultistream: boolean}
465
+ ) {
461
466
  const key = `${issueType}_${issueSubType}`;
462
467
 
463
468
  const count = (this.mediaIssueCounters[key] || 0) + 1;
@@ -465,7 +470,7 @@ export default class MediaProperties {
465
470
  this.mediaIssueCounters[key] = count;
466
471
 
467
472
  this.throttledSendMediaIssueMetric({
468
- correlationId,
473
+ ...metadata,
469
474
  ...this.mediaIssueCounters,
470
475
  });
471
476
  }