Skip to content

Add background audio pomodoro timer prototype - #12

Open
hummusonrails wants to merge 1 commit into
AkongaLabs:mainfrom
hummusonrails:bounty/pomodoro-background-audio
Open

Add background audio pomodoro timer prototype#12
hummusonrails wants to merge 1 commit into
AkongaLabs:mainfrom
hummusonrails:bounty/pomodoro-background-audio

Conversation

@hummusonrails

Copy link
Copy Markdown

Bounty Solution Submission

Problem Statement

This PR implements the prototype requested in #1: a minimal single-page timer that keeps accurate countdown time in inactive Chrome tabs and plays a completion chime after the user has unlocked browser audio.

Solution Approach

The app uses a single HTML file with embedded CSS and JavaScript. It unlocks an AudioContext from the Start button click, calculates countdown state from an absolute deadline instead of interval counts, and provides graceful visual fallback messaging if Chrome blocks sound.

Technical Implementation

  • Package Manager: None required; this is a dependency-free single HTML file.
  • Database Setup: Not applicable.
  • Environment Variables: None.
  • Build Process: None. Open pomodoro-timer.html directly in Chrome or serve it as a static file.

Testing Evidence

  • Test Coverage: Static validation of the embedded JavaScript and required browser capability hooks.
  • Critical Flows Tested: JavaScript syntax validation, required AudioContext/Notification hooks, inactive-tab timing hooks, ARIA timer attributes, and input bounds.
  • Test Results:
    • node -e "const fs=require('fs'); const html=fs.readFileSync('pomodoro-timer.html','utf8'); if(!html.includes('<script>')) throw new Error('missing script'); const js=html.match(/<script>([\s\S]*)<\/script>/)[1]; new Function(js); console.log('embedded JavaScript syntax OK');" -> embedded JavaScript syntax OK
    • node -e "const fs=require('fs'); const html=fs.readFileSync('pomodoro-timer.html','utf8'); const required=['AudioContext','Notification','visibilitychange','role=\"timer\"','aria-live=\"polite\"','min=\"1\"','max=\"999\"']; for (const token of required) if (!html.includes(token)) throw new Error('missing '+token); console.log('static requirement checks OK');" -> static requirement checks OK

Demo Evidence

Setup Instructions

  1. Open pomodoro-timer.html in recent Chrome desktop.
  2. Enter a timer duration from 1 to 999 minutes.
  3. Click Start once while the tab is visible to unlock Chrome audio.
  4. Switch tabs/apps and wait for completion to verify the chime and reset behavior.

Database Setup

Not applicable.

Architectural Decisions

The timer uses an absolute wall-clock deadline and recalculates remaining seconds on each interval tick, visibilitychange, and window focus event. That avoids drift caused by Chrome's background timer throttling. The completion chime is generated with Web Audio oscillators, avoiding external assets and keeping the deliverable to one HTML app file.

Bun/Yarn Justification

Not applicable; no package manager is needed.


Pre-submission Checklist:

  • All bounty requirements met
  • Tests written and passing
  • Working demo available
  • Code is self-explanatory
  • Setup instructions complete
  • @adrianmurage tagged for review

I confirm this submission meets all requirements and is ready for review.

@hummusonrails
hummusonrails marked this pull request as ready for review May 21, 2026 06:10
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