Skip to content

feat: Make fetchBlob() use Cross-Origin Storage when available, else fall back to Cache API for Wasm / JS caching#940

Open
tomayac wants to merge 3 commits into
ffmpegwasm:mainfrom
tomayac:main
Open

feat: Make fetchBlob() use Cross-Origin Storage when available, else fall back to Cache API for Wasm / JS caching#940
tomayac wants to merge 3 commits into
ffmpegwasm:mainfrom
tomayac:main

Conversation

@tomayac

@tomayac tomayac commented Jun 5, 2026

Copy link
Copy Markdown

On the Chrome team, we're considering a new browser API and storage mechanism called Cross-Origin Storage (COS), which would allow for resources (like large Wasm files as in the ffmpeg.wasm project's case) that are identified by their hashes to be shared across origins. (Dear maintainers: @lucasgelfond, @jeromewu, feel free to reach out directly if you have questions, tomac AT google . com.)

The present PR adds support for this proposed API as a progressive enhancement, falling back to the Cache API. It also adds a simple "hello world" app that shows the progressive enhancement and the caching in both cases in action. You can test the COS API by installing the COS extension. Even without the extension installed, the PR improves upon the status quo by adding default caching.

Regular case:

Caching the resources in the Cache API, isolated per origin:

Screenshot 2026-06-05 at 15 16 08

Cross-Origin Storage case:

Caching the resources in Cross-Origin Storage, shared across origins (see the popup window of the extension, the ffmpeg-core.wasm file is shared between http://localhost:3000 and https://tomayac.github.io):

Screenshot 2026-06-05 at 15 20 28

With the extension installed, after opening the first demo link, try the same demo on another origin and you should see how the ffmpeg-core.wasm resource (and the JavaScript) is shared.

@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy Preview for ffmpegwasm canceled.

Name Link
🔨 Latest commit 55b5db5
🔍 Latest deploy log https://app.netlify.com/projects/ffmpegwasm/deploys/6a22cf5fa79c5f00087c3056

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