@webex/plugin-meetings 3.12.0-llmrefactor.14 → 3.12.0-llmrefactor.15
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.
- package/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +130 -4
- package/ai-docs/ARCHITECTURE.md +207 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +46 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/in-meeting-actions.js +2 -0
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +4 -0
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +3 -1
- package/dist/meeting/util.js.map +1 -1
- package/dist/meetings/index.js +8 -4
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/meeting/in-meeting-actions.d.ts +2 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +20 -20
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +38 -1
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/meeting/ai-docs/meeting-spec.md +401 -0
- package/src/meeting/in-meeting-actions.ts +4 -0
- package/src/meeting/index.ts +4 -0
- package/src/meeting/util.ts +5 -2
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +4 -0
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/multistream/ai-docs/multistream-spec.md +292 -0
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/test/unit/spec/interpretation/index.ts +93 -0
- package/test/unit/spec/meeting/in-meeting-actions.ts +2 -0
- package/test/unit/spec/meeting/index.js +5 -0
- package/test/unit/spec/meeting/utils.js +26 -15
- package/test/unit/spec/meetings/index.js +11 -0
|
@@ -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`
|