Skip to content

Fix silent audio on deployed site and add sound toggle - #168

Merged
PromSereyreaksa merged 2 commits into
mainfrom
fix/generation-progress-feedback
Oct 14, 2026
Merged

PromSereyreaksa merged 2 commits into
mainfrom
fix/generation-progress-feedback

Conversation

@PromSereyreaksa

Copy link
Copy Markdown
Member

Summary

Audio played locally but was silent on the Railway deployment. This PR fixes it:

  • Autoplay unlock: clicking Play now calls AudioContext.resume() and audio.play() synchronously from the click handler, before the first await, so the browser treats them as part of the user gesture.
  • No Web Audio routing of <audio> elements: a MediaElementSource on a cross-origin track served without CORS headers outputs silence, so elements now play directly and the context is only resumed.
  • Same-origin iframe: raw films always load via srcdoc with sandbox="allow-scripts allow-same-origin".
  • Load timing: waits for the iframe load event and checks typeof motifySoundtrack === 'function' before OfflineAudioContext.startRendering(). If the server-side WAV is missing, a local WAV fallback is rendered.
  • Diagnostics: logs [Audio] motifySoundtrack found, [Audio] WAV rendered (duration, peak amplitude), and [Audio] AudioContext state on play.
  • Sound on/off button next to Play in the scene bar.
  • Also includes the pending generation-progress UI fixes.

Test plan

  • npm run type-check
  • npm run build
  • npm run test:run (646 passed)
  • On Railway: press Play and check that DevTools shows the [Audio] logs and sound plays

🤖 Generated with Claude Code

- Unlock audio from the Play click: AudioContext.resume() and audio.play()
  start before the handler yields, so deployed HTTPS origins allow sound.
- Never route <audio> elements through a MediaElementSource, which plays
  silence for cross-origin tracks without CORS headers.
- Load raw films via srcdoc with sandbox="allow-scripts allow-same-origin"
  and wait for the iframe load event plus a motifySoundtrack function check
  before running OfflineAudioContext.startRendering().
- Render a local WAV fallback when the server-side soundtrack is missing.
- Add [Audio] console diagnostics (soundtrack found, WAV duration/peak,
  AudioContext state on play).
- Add a sound on/off button next to Play.
- Include pending generation-progress UI fixes.
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
motionly Ready Ready Preview Oct 14, 2026 9:27pm UTC

The fetch stub wrapped a jsdom Blob in a Response, which Node 20 rejects;
the code under test swallowed the rejection, so CI saw empty font CSS.
Use a string body with a content-type header instead.
@PromSereyreaksa
PromSereyreaksa merged commit 2738f8e into main Oct 14, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 619ed90e Deployed Oct 14, 2026 by vercel[bot]
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