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
Open
feat: Make fetchBlob() use Cross-Origin Storage when available, else fall back to Cache API for Wasm / JS caching#940tomayac wants to merge 3 commits into
fetchBlob() use Cross-Origin Storage when available, else fall back to Cache API for Wasm / JS caching#940tomayac wants to merge 3 commits into
Conversation
✅ Deploy Preview for ffmpegwasm canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Cross-Origin Storage case:
Caching the resources in Cross-Origin Storage, shared across origins (see the popup window of the extension, the
ffmpeg-core.wasmfile is shared betweenhttp://localhost:3000andhttps://tomayac.github.io):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.wasmresource (and the JavaScript) is shared.