Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I modify the source code so it's possible to load .wasm code not from file? #628

Open
VladiStep opened this issue Dec 7, 2023 · 3 comments

Comments

@VladiStep
Copy link

VladiStep commented Dec 7, 2023

I am trying to embed "ogv.js" files into one JS-file, but it seems like I can't load .wasm code not from file.
The generated code for "ogv-demuxer-ogg-wasm.js" contains hardcoded string "ogv-demuxer-ogg-wasm.wasm":
image

Also, I can't find where it comes from (there's no "ogv-demuxer-ogg-wasm.wasm" in the source code anywhere).

@VladiStep
Copy link
Author

I just want to add it to a Tampermonkey script that will replace all <audio> elements with .ogg audio with OGVPlayer.
It's for Safari.

@bvibber
Copy link
Owner

bvibber commented Mar 14, 2024

Use the -s SINGLE_FILE=1 option in the emscripten build and modify the Makefile to avoid copying the wasm files. This will increase the size of the javascript package because it has to base64 the wasm.

// If set to 1, embeds all subresources in the emitted file as base64 string
// literals. Embedded subresources may include (but aren't limited to) wasm,
// asm.js, and static memory initialization code.
//
// When using code that depends on this option, your Content Security Policy may
// need to be updated. Specifically, embedding asm.js requires the script-src
// directive to allow 'unsafe-inline', and using a Worker requires the
// child-src directive to allow blob:. If you aren't using Content Security
// Policy, or your CSP header doesn't include either script-src or child-src,
// then you can safely ignore this warning.
// [link]
var SINGLE_FILE = false;

@bvibber
Copy link
Owner

bvibber commented Mar 14, 2024

On main branch (work in progress refactoring, so beware it is not stable) you can undo this commit:

d03dce9

to turn single-file mode on, as I was experimenting with it for simplifying packaging.

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

No branches or pull requests

2 participants