Skip to content

fix(web): session timer + resume mic after screen lock (iOS) - #4

Merged
momentmaker merged 1 commit into
mainfrom
fix/ios-session-timer-lock
Jun 17, 2026
Merged

momentmaker merged 1 commit into
mainfrom
fix/ios-session-timer-lock

Conversation

@momentmaker

Copy link
Copy Markdown
Member

Two session bugs reported on iPhone (after the WASM-backend crash fix landed):

Timer never started

composeSession passed a hardcoded elapsed: '0:00'. Now tracks the recording start (first begin() gesture, reset when a new session binds) and renders M:SS live (the rAF loop redraws ~30fps).

Recording stops after a screen lock

iOS Safari suspends (or non-standardly "interrupts") the AudioContext on screen-lock / backgrounding; nothing resumed it, so frames stopped for good when the user returned. Added:

  • AudioCapture.resume() — resumes the context when it isn't running.
  • LiveModeSession.resumeCapture() — called from visibilitychange→visible and a pointer tap (iOS often requires a user gesture for resume() to take).

Recording genuinely can't run while the screen is locked (an OS limitation for web pages) — this restores it on return.

tsc clean · 219 vitest · canary 2/2 · build ok. Lock behavior needs a real iPhone test after deploy.

🤖 Generated with Claude Code

Two session bugs, surfaced on iOS:

- Timer never started: composeSession passed a hardcoded elapsed '0:00'. Track
  the recording start (first begin() gesture, reset when a new session binds) and
  render M:SS live from it (the rAF loop already redraws ~30fps).

- Recording died after a screen lock: iOS Safari suspends (or 'interrupts') the
  AudioContext when the screen locks / the tab backgrounds, and nothing resumed
  it, so frames stopped for good on return. Add AudioCapture.resume() (resume the
  context when it isn't running) + LiveModeSession.resumeCapture(), called from
  both visibilitychange→visible and a pointer tap (iOS often needs a user gesture
  for resume() to take). Recording genuinely can't run while LOCKED (an OS limit
  for web pages) — this restores it on return.

tsc clean; 219 vitest pass; net-silence canary 2/2; build ok. Lock behavior needs
a real iPhone test after deploy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@momentmaker
momentmaker merged commit 4b62fd1 into main Jun 17, 2026
5 checks passed
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