Add live camera preview to media preflight
Merged
CH
1mo ago+431+431+012345678901234567890123456789-5-5-0123456789
Summary
Add a live, mirrored camera preview to the media preflight ("Check your setup"), allowing candidates to verify their framing and lighting before joining an interview.
Closes #414
Changes
- Display a live camera preview in the preflight Camera section using the existing camera track, without an additional
getUserMedia()request. - Mirror the preview and keep it within the existing preflight layout.
- Hide and clear the preview when the camera is skipped, lost, or the preflight ends.
- Preserve the existing face-presence detection and Google Meet presentation behavior.
- Add browser regression tests covering preview visibility, skipping and re-enabling the camera, preflight completion, and Meet presentation mode.
- Update the existing DOM contract test to verify camera-preview cleanup alongside face-check reset.
Testing
Passed:
- Camera preview browser tests: 4/4
- DOM contract tests: 38/38
- Google Meet tests: 9/9
- Preflight speech tests: 6/6
- ESLint, Prettier, and
git diff --check - Manual testing with a physical webcam, including face detection, skipping the camera, and re-enabling it
Full test suite: ./scripts/test.sh completed with 1,329 passing, 4 failing, and 4 skipped tests.
Three failing tests passed when rerun individually:
candidate-cases.test.js: 24/24editor-pipeline.test.js: 38/38example-board-ui.test.js: 4/4
The remaining failure concerns the lobby height exceeding an 800px viewport (824px measured locally).
Summary by cubic
Adds a live, mirrored camera preview to the media preflight so candidates can check their framing and lighting before joining an interview.
- Reuses the existing camera track, so no additional
getUserMedia()request is made. - Shows the full camera frame, matching what the face-presence check receives.
- Hides and clears the preview when the camera is skipped, lost, muted, or the preflight ends, and restores it when a muted track becomes usable again.
- Removes preview event listeners when the camera is skipped or the preflight ends, so late track events can't restore the preview.
- Preserves face-presence detection and Google Meet presentation behavior.
- Adds browser regression tests for preview visibility, skip/re-enable, temporary mute, preflight completion, and Meet presentation mode, plus a DOM contract update for preview cleanup.