Skip to content

export: ask for the video file before the offline render (user-gesture window) - #239

Merged
petersalomonsen merged 1 commit into
masterfrom
export-picker-first
Sep 13, 2026
Merged

petersalomonsen merged 1 commit into
masterfrom
export-picker-first

Conversation

@petersalomonsen

Copy link
Copy Markdown
Owner

What

Fixes SecurityError: Failed to execute 'showSaveFilePicker' on 'Window': Must be handling a user gesture on "Shader video with sound" (#237) with a real-length song.

The save dialog may only open within the click's user-gesture window (a few seconds). The offline audio render of a long song takes longer, so by the time exportVideo asked for the file the gesture had expired. The video-only export never hit this because it asks straight after the dialog.

  • pickVideoFile() exported from fragmentshader.js; exportVideo() takes { fileHandle } and only asks itself when none is given.
  • The videoaudio path picks the file first, then compiles/renders at 48 kHz, then exports into the handle.
  • e2e counts picker calls: exactly one, before the render.

🤖 Generated with Claude Code

…e window)

"Shader video with sound" failed on a real song with SecurityError: the save
dialog may only open while the user's click is still active (a few seconds),
and the offline audio render of a 4-minute song takes longer than that. The
video-only path never hit it because it asks for the file straight after the
dialog. Now the file is picked first, then the song is rendered, then the
handle is passed into exportVideo. The e2e counts picker calls: exactly one,
up front.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying webassemblymusic with  Cloudflare Pages  Cloudflare Pages

Latest commit: d2f25fe
Status: ✅  Deploy successful!
Preview URL: https://af9545f5.webassemblymusic.pages.dev
Branch Preview URL: https://export-picker-first.webassemblymusic.pages.dev

View logs

@petersalomonsen
petersalomonsen merged commit b5c14e8 into master Sep 13, 2026
9 checks passed
@petersalomonsen
petersalomonsen deleted the export-picker-first branch September 13, 2026 15:40
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