Skip to content

Stop the export from hanging forever when the hidden film stalls #33

Open

Description

@blixvip

The render loop in exportPreview() (public/demo.mjs:318-343) can wait forever. If the queue is empty and ended is false, it calls film.play() and sleeps 250 ms (demo.mjs:321-322), with no upper limit. Two cases leave the button on "Rendering 42%" and disabled until the page is reloaded:

  • film.onerror = reject (demo.mjs:294) only matters before loadeddata. A network or decode error later in the file is never seen, so the loop keeps polling.
  • If film.play() keeps rejecting (the .catch(() => {}) at lines 321/333 hides this), no frame or ended event ever arrives.

Expected: a stalled export ends in "Export failed" and re-enables Download (the existing finally already cleans up).

Fix direction: set film.onerror again after loading, so it records the error in failure and calls wake(). Track the time of the last captured frame. If none has arrived for about 15 s while document.visibilityState === 'visible', set failure. Don't count time while the tab is hidden, since hidden tabs pause requestVideoFrameCallback.

Done when throttling the network to "Offline" mid-export in DevTools ends in "Export failed" within about 15 s, and normal exports are unchanged.

Activity

  1. added
    bugSomething isn't working
    help wantedExtra attention is needed
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions