Skip to content

fix(recording): keep live webcam preview visible - #749

Merged
meiiie merged 3 commits into
mainfrom
fix/webcam-live-preview-bounds
Jul 11, 2026
Merged

fix(recording): keep live webcam preview visible#749
meiiie merged 3 commits into
mainfrom
fix/webcam-live-preview-bounds

Conversation

@meiiie

@meiiie meiiie commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Keeps the floating webcam preview fully visible while recording. The fallback HUD expands only when recording and the live webcam preview are both active; webcam-disabled and idle states remain compact.

Root cause and fix

On Windows at 125% scale, recording contracted the HUD to 860x160 while the 288x288 preview stayed anchored 120px above the bottom, placing its top at -248px. Capture/editor/export were healthy; the preview was clipped by the compact live HUD viewport.

The renderer now reports preview visibility through typed preload IPC. Electron recomputes fallback bounds from recording + preview state and resets visibility with the HUD lifecycle. No webcam encoding, editor/export composition, styling, or persisted placement changes.

Verification

  • Focused HUD/webcam coverage: 4 files / 24 tests, including webcam-visible idle state
  • Strict TypeScript and targeted Biome: pass
  • Full Vitest: 105 files, 992 pass, 1 skip
  • Production/native build, Windows NSIS package, and packaged binary smoke: pass
  • Packaged Windows 11 at 125%: webcam-on uses 860x540, preview (540,132,288,288), fully inside and not overlapping controls; webcam-off remains 860x160 and WGC mux completes

Risk

The change affects only fallback HUD bounds. Windows x64 was runtime-tested. macOS/Linux, negative-origin multi-monitor layouts, and other scale factors remain reasoned-only.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The HUD overlay now tracks webcam preview visibility from the renderer through Electron IPC and uses it to determine fallback expansion during recording. The new expansion rule is covered by tests, and preview visibility resets when the HUD window is initialized or the renderer unmounts.

Changes

HUD webcam preview visibility

Layer / File(s) Summary
Fallback expansion rule and tests
electron/hudOverlayBounds.ts, electron/hudOverlayBounds.test.ts
Adds and tests the rule that expands fallback bounds when manually expanded or when recording with a visible webcam preview.
Electron visibility state and bounds wiring
electron/electron-env.d.ts, electron/preload.ts, electron/windows.ts
Adds the renderer API and IPC handler, tracks webcam visibility, recalculates HUD bounds during recording, and resets state on window creation.
Renderer preview lifecycle synchronization
src/components/launch/LaunchWindow.tsx
Sends webcam preview visibility changes to Electron and hides the preview on unmount.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LaunchWindowContent
  participant electronAPI
  participant preload
  participant windows.ts
  LaunchWindowContent->>electronAPI: Set webcam preview visibility
  electronAPI->>preload: Call hudOverlaySetWebcamPreviewVisible
  preload->>windows.ts: Send visibility IPC event
  windows.ts->>windows.ts: Recalculate HUD overlay bounds
Loading

Possibly related PRs

Suggested labels: Checked

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: keeping the live webcam preview visible during recording.
Description check ✅ Passed The PR description covers the summary, root cause, verification, and risk, so it is mostly complete.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/webcam-live-preview-bounds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
electron/hudOverlayBounds.test.ts (1)

147-178: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case for webcam-visible-but-not-recording.

The three cases cover the key branches, but none verify that webcamPreviewVisible: true alone (without recordingActive) does not trigger expansion. Without this case, someone could change the logic to fallbackExpanded || webcamPreviewVisible (dropping the recordingActive && guard) and all existing tests would still pass.

✅ Suggested additional test case
 	it("preserves manual fallback expansion outside recording", () => {
 		expect(
 			shouldExpandHudOverlayFallback({
 				fallbackExpanded: true,
 				recordingActive: false,
 				webcamPreviewVisible: false,
 			}),
 		).toBe(true);
 	});
+
+	it("does not expand for webcam preview visibility when not recording", () => {
+		expect(
+			shouldExpandHudOverlayFallback({
+				fallbackExpanded: false,
+				recordingActive: false,
+				webcamPreviewVisible: true,
+			}),
+		).toBe(false);
+	});
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@electron/hudOverlayBounds.test.ts` around lines 147 - 178, Add a test in the
shouldExpandHudOverlayFallback suite covering webcamPreviewVisible: true with
recordingActive: false and fallbackExpanded: false, and assert that
shouldExpandHudOverlayFallback returns false.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@electron/hudOverlayBounds.test.ts`:
- Around line 147-178: Add a test in the shouldExpandHudOverlayFallback suite
covering webcamPreviewVisible: true with recordingActive: false and
fallbackExpanded: false, and assert that shouldExpandHudOverlayFallback returns
false.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 66777852-9727-49b4-9f16-d8608da1be59

📥 Commits

Reviewing files that changed from the base of the PR and between 641d223 and f8ccb5c.

📒 Files selected for processing (6)
  • electron/electron-env.d.ts
  • electron/hudOverlayBounds.test.ts
  • electron/hudOverlayBounds.ts
  • electron/preload.ts
  • electron/windows.ts
  • src/components/launch/LaunchWindow.tsx

@meiiie

meiiie commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@meiiie
meiiie merged commit ec82094 into main Jul 11, 2026
5 checks passed
@meiiie
meiiie deleted the fix/webcam-live-preview-bounds branch July 11, 2026 06:25
LemonStudio-hub pushed a commit to OpenTake-io/OpenTake that referenced this pull request Jul 22, 2026
…live-preview-bounds

fix(recording): keep live webcam preview visible
LemonStudio-hub pushed a commit to OpenTake-io/OpenTake that referenced this pull request Jul 24, 2026
…live-preview-bounds

fix(recording): keep live webcam preview visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant