Skip to content

fix: abort ffmpeg asset downloads on cancel#1292

Open
Sammmyyyyyyy wants to merge 1 commit into
magic-peach:mainfrom
Sammmyyyyyyy:fix/ffmpeg-abort-signal
Open

fix: abort ffmpeg asset downloads on cancel#1292
Sammmyyyyyyy wants to merge 1 commit into
magic-peach:mainfrom
Sammmyyyyyyy:fix/ffmpeg-abort-signal

Conversation

@Sammmyyyyyyy
Copy link
Copy Markdown

Description

Implements proper cancellation support for FFmpeg core asset loading inside the worker pipeline.

Previously, cancelling export/loading only stopped the UI flow while large FFmpeg assets (ffmpeg-core.js, ffmpeg-core.wasm, and ffmpeg-core.worker.js) continued downloading in the background without interruption.

This PR propagates AbortSignal support through all FFmpeg asset fetches and worker loading flows to ensure downloads are immediately terminated when a cancel action is triggered.

Related Issue

Closes #1247

Type of Contribution

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • GSSoC contribution

Participant Info

  • GitHub username: Sammmyyyyyyy
  • Contribution level (Beginner/Intermediate/Advanced): Intermediate

##Changes Made

  • Added AbortSignal support to fetchWithIntegrity
  • Propagated abort signals through loadCore
  • Added dedicated worker-level AbortController handling
  • Added cancellation handling for:
    • ffmpeg-core.js
    • ffmpeg-core.wasm
      -ffmpeg-core.worker.js
  • Added safer AbortError handling during load/export cancellation
  • Prevented stale FFmpeg initialization after cancellation events

##Impact

  • Stops unnecessary ~32 MB background downloads immediately on cancel
  • Prevents wasted bandwidth usage on slow or metered connections
  • Avoids stale worker state and resource leaks during interrupted export sessions

Recording / Loom link: ## Checklist

  • I have read the contribution guidelines
  • My changes follow the project structure
  • I have tested my changes in Chrome, Firefox, and Safari
  • bun run lint passes (no ESLint errors)
  • bunx tsc --noEmit passes (no TypeScript errors)
  • New interactive elements have aria-label / accessible names
  • No console.log statements left in
  • This PR is related to a valid issue
  • Screen recording attached above (required for UI/feature/design changes)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@Sammmyyyyyyy is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Sammmyyyyyyy!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

🟠 GSSoC'26 PR detected — thanks for contributing under GirlScript Summer of Code 2026!

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions
Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @Sammmyyyyyyy

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added gssoc'26 GirlScript Summer of Code 2026 level:intermediate Intermediate level - 35 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance type:refactor Code refactor labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc'26 GirlScript Summer of Code 2026 level:intermediate Intermediate level - 35 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance type:refactor Code refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [GSSoC'26] fetchWithIntegrity in ffmpeg.worker.ts has no AbortSignal -- WASM download cannot be cancelled, wastes up to 32 MB of bandwidth

1 participant