Comparing version
{ | ||
"name": "webm-wasm", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "webm-wasm lets you create webm videos in JavaScript via WebAssembly.", | ||
"scripts": { | ||
"install": "napa", | ||
"build:dockerimage": "docker image inspect -f '.' webmwasm || docker build -t webmwasm .", | ||
@@ -8,0 +7,0 @@ "build:emscripten": "docker run --rm -v $(pwd):/src -e SKIP_LIBYUV=\"${SKIP_LIBYUV}\" -e SKIP_LIBVPX=\"${SKIP_LIBVPX}\" -e SKIP_LIBWEBM=\"${SKIP_LIBWEBM}\" webmwasm ./build.sh", |
@@ -5,4 +5,10 @@ # webm-wasm | ||
Works in all major browsers (although Safari can’t play webm 🐼). | ||
The wasm module was created by [emscripten’ing][emscripten] [libvpx], [libwebm] and [libyuv]. | ||
``` | ||
$ npm install --save webm-wasm | ||
``` | ||
## Usage | ||
@@ -25,3 +31,3 @@ | ||
height: 512 | ||
// More constructor options below | ||
// ... more constructor options below | ||
}); | ||
@@ -42,2 +48,4 @@ // 5. Start sending frames! | ||
(You can find an implementation of `nextMessage()` in [`src/worker/webm-worker.js`][nextMessage]) | ||
### Constructor options | ||
@@ -53,2 +61,17 @@ | ||
### From a CDN | ||
Worker code can’t be loaded from another origin directly, even when the source is CORS-enabled. It is, however, still possible to load webm-wasm from a CDN like [unpkg.com] with a little workaround: | ||
```js | ||
const buffer = await fetch( | ||
"https://unpkg.com/webm-wasm@<version>/dist/webm-worker.umd.js" | ||
).then(r => r.arrayBuffer()); | ||
const worker = new Worker( | ||
URL.createObjectURL(new Blob([buffer], { type: "text/javascript" })) | ||
); | ||
worker.postMessage("https://unpkg.com/webm-wasm@<version>/dist/webm-wasm.wasm"); | ||
// Continue as normal | ||
``` | ||
### WebAssembly | ||
@@ -76,2 +99,16 @@ | ||
## Demos | ||
To run the web demos, start the websever using | ||
``` | ||
$ npm run serve | ||
``` | ||
To run the node demos, run them directly (requires Node 11+): | ||
``` | ||
$ node --experimental-worker ./node-simple.js | ||
``` | ||
## Building | ||
@@ -83,2 +120,3 @@ | ||
$ npm install | ||
$ npx napa | ||
$ npm run build | ||
@@ -91,2 +129,4 @@ ``` | ||
[nextMessage]: https://github.com/GoogleChromeLabs/webm-wasm/blob/63b96a4f0e2821f34f972827f800259222ef9142/src/worker/webm-worker.js#L37-L46 | ||
[unpkg.com]: https://unpkg.com | ||
[docker]: https://www.docker.com/ | ||
@@ -93,0 +133,0 @@ [transferable streams]: https://www.chromestatus.com/features/5298733486964736 |
@@ -22,3 +22,3 @@ /** | ||
export function initWasmModule(moduleFactory, wasmUrl) { | ||
function initWasmModule(moduleFactory, wasmUrl) { | ||
return new Promise(resolve => { | ||
@@ -25,0 +25,0 @@ const module = moduleFactory({ |
@@ -48,3 +48,3 @@ /** | ||
export function initWasmModule(moduleFactory, wasmUrl) { | ||
function initWasmModule(moduleFactory, wasmUrl) { | ||
return new Promise(resolve => { | ||
@@ -51,0 +51,0 @@ const module = moduleFactory({ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
2802958
0.16%132
43.48%0
-100%8
33.33%