Skip to content

Add 3-2-1 countdown before recording starts#458

Closed
theabhipareek wants to merge 2 commits intosiddharthvaddem:mainfrom
theabhipareek:main
Closed

Add 3-2-1 countdown before recording starts#458
theabhipareek wants to merge 2 commits intosiddharthvaddem:mainfrom
theabhipareek:main

Conversation

@theabhipareek
Copy link
Copy Markdown

Pull Request: 3-2-1 Countdown Before Recording Starts

Description

This PR implements a 3-2-1 countdown timer that displays when users press the Record button. The actual recording begins only after the countdown completes, giving users time to prepare before capture starts.

Motivation

Problem: Users could accidentally record setup actions because capture started immediately when pressing Record.

Solution: A visible countdown provides a pre-roll buffer, allowing users to:

  • Prepare their screen/content before recording begins
  • Cancel the countdown if needed by pressing Record again
  • Have better control over when actual capture starts

Related Issue: #453 - Add 3-2-1 countdown before recording starts

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

Resolves: siddharthvaddem/openscreen#453

Technical Changes

1. useScreenRecorder Hook (src/hooks/useScreenRecorder.ts)

  • Added state management:
    • countdownSeconds: number - tracks current countdown value (3, 2, 1, 0)
    • isCountingDown: boolean - flag to display countdown UI
  • Created startCountdown() function:
    • Displays countdown from 3 to 0 (1 second per count)
    • Automatically calls startRecording() after countdown completes
    • Can be cancelled by calling toggleRecording() again
  • Modified toggleRecording():
    • Now calls startCountdown() instead of directly calling startRecording()
    • If already counting down, cancels the countdown
  • Updated return type to expose countdown state

2. LaunchWindow Component (src/components/launch/LaunchWindow.tsx)

  • Created countdown overlay UI with:
    • Large centered countdown numbers (3, 2, 1)
    • Semi-transparent dark overlay background (bg-black/70)
    • Red pulsing animated text effect (text-red-500)
    • Smooth fade in/out transitions using CSS
    • Z-index layering to appear above existing UI
  • Countdown displays only when isCountingDown === true
  • Positioned absolutely over the entire launch window

3. User Flow

User presses Record
    ↓
startCountdown() triggered
    ↓
Overlay shows "3" (wait 1s)
    ↓
Overlay shows "2" (wait 1s)
    ↓
Overlay shows "1" (wait 1s)
    ↓
Overlay hides, startRecording() called
    ↓
Recording begins with elapsed timer at 0

Screenshots / Video

Countdown States:

![Countdown 3](path/to/countdown-3.png)
![Countdown 2](path/to/countdown-2.png)
![Countdown 1](path/to/countdown-1.png)
![Recording Started](path/to/recording-started.png)

Testing

Manual Testing Steps:

  1. Start Countdown

    • Open Launch Window
    • Select a screen/window to record
    • Press the Record button
    • ✅ Verify: Overlay displays "3" with red pulsing effect
  2. Countdown Progression

    • Wait 1 second
    • ✅ Verify: Overlay changes to "2"
    • Wait 1 second
    • ✅ Verify: Overlay changes to "1"
    • Wait 1 second
    • ✅ Verify: Overlay disappears and recording begins
  3. Cancel Countdown

    • Press Record button again
    • Countdown is running (showing "2" or "1")
    • Press Record button
    • ✅ Verify: Countdown cancels and overlay disappears
  4. Recording Controls After Countdown

    • Let countdown complete and recording starts
    • ✅ Verify: Pause button works
    • ✅ Verify: Stop button works
    • ✅ Verify: Restart button works
    • ✅ Verify: Elapsed time displays correctly
  5. Edge Cases

    • ✅ Verify: Rapidly pressing Record doesn't break countdown
    • ✅ Verify: Webcam + microphone still work with countdown
    • ✅ Verify: System audio capture still works with countdown

Build Validation:

npm run build-vite
npm run dev

Checklist

  • I have performed a self-review of my code.
  • I have added necessary UI/countdown logic.
  • I have tested the countdown flow manually.
  • I have linked the related issue ([Feature]: Add 3-2-1 countdown before recording starts #453).
  • Code follows existing patterns and conventions.
  • No breaking changes to existing functionality.

Additional Notes

Benefits:

  • ✅ Users get 3-second pre-roll buffer
  • ✅ Better control over recording start time
  • ✅ Can cancel countdown if needed
  • ✅ Smooth, polished UX with animations
  • ✅ No impact on existing recording features

Future Enhancements (Optional):

  • Make countdown duration configurable (2-5 seconds)
  • Add sound/beep during countdown
  • Show countdown in system tray notification
  • Keyboard shortcut to skip countdown during active countdown

Copilot AI and others added 2 commits April 16, 2026 05:23
…before-recording

 Add 3-2-1 countdown before recording starts
@siddharthvaddem
Copy link
Copy Markdown
Owner

please add videos in your prs 🙏

@siddharthvaddem
Copy link
Copy Markdown
Owner

also why does it say 0 changes lmao

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.

[Feature]: Add 3-2-1 countdown before recording starts

3 participants