long-screen 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +58 -2
- package/THIRD_PARTY_NOTICES.txt +1044 -0
- package/convert-worker.js +43 -0
- package/core-helper.js +1 -0
- package/core.simd.wasm +0 -0
- package/core.threads.wasm +0 -0
- package/core.wasm +0 -0
- package/index.d.ts +158 -0
- package/index.js +37 -0
- package/package.json +43 -4
- package/worker.js +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yi-Ting Chiu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# long-screen
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Turn a screen recording into one big screenshot, inside your own web page. The recording can move along any path (scroll, pan, diagonal, loop back) as long as it shows every part you want in the picture. Everything runs in the visitor's browser: the video is decoded with WebCodecs and reconstructed by [Long Screen](https://github.com/t41372/long-screen)'s Rust engine, compiled to WebAssembly and run in a Worker. Nothing is uploaded.
|
|
4
|
+
|
|
5
|
+
Reconstruction is heuristic. A finished run does not prove the picture is right; what the run could not resolve is reported as diagnostics and as separate fragment prints.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install long-screen
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { reconstruct } from 'long-screen';
|
|
17
|
+
|
|
18
|
+
const run = reconstruct(file, {
|
|
19
|
+
locale: 'en', // or 'zh'
|
|
20
|
+
onProgress: (p) => console.log(p.phase, Math.round(p.fraction * 100) + '%'),
|
|
21
|
+
});
|
|
22
|
+
const { status, prints, diagnostics } = await run.result;
|
|
23
|
+
if (prints.length) document.querySelector('img').src = URL.createObjectURL(prints[0].png);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`reconstruct(source, options)` takes a `Blob` or `File` (MP4, MOV or WebM the browser can decode) and returns `{ result, pause(), resume(), stop(), cancel() }`:
|
|
27
|
+
|
|
28
|
+
- `result` resolves to `{ status, error?, frames, prints, diagnostics }`. Each print is one composed picture (`kind` `moving`, `fixed`, `presentation`, or a numbered `fragment`) with its size and a native-resolution `png` Blob; transparent pixels were never seen in the recording. `diagnostics` lists everything the run noticed, each with a `code`, a `severity` and a `message` in the chosen locale.
|
|
29
|
+
- `stop()` finishes early and still resolves with what was composed (`status: 'partial'`); `cancel()` throws the run away and rejects with an `AbortError`.
|
|
30
|
+
- `options.settings` takes the app's settings (`analysisSize`, `memoryMB`, `tileSize`, `temporalPolicy`, `framing`, `compute`); the types in `index.d.ts` document each.
|
|
31
|
+
|
|
32
|
+
The call keeps its working data in an IndexedDB database of its own and deletes it before `result` settles. The PNGs are held in memory, so a very long print costs its PNG size in RAM.
|
|
33
|
+
|
|
34
|
+
## Serving the files
|
|
35
|
+
|
|
36
|
+
The package is a folder of files that load each other by relative URL: `index.js` starts `worker.js`, which loads one of `core.wasm`, `core.simd.wasm` or `core.threads.wasm` and may start `core-helper.js` and `convert-worker.js`. Serve them from your own origin (browsers do not run a Worker from another origin), with `.wasm` as `application/wasm`.
|
|
37
|
+
|
|
38
|
+
- **Vite, webpack 5**: nothing to do; they follow `new URL('./file', import.meta.url)` and emit the files (checked with Vite 8.3 and webpack 5.111). For Vite's dev server add `optimizeDeps: { exclude: ['long-screen'] }`, or its dev server's pre-bundling moves `index.js` away from its files.
|
|
39
|
+
- **esbuild, Rollup without a URL plugin, `deno bundle`**: they leave those URLs alone, so copy the package's `*.js` and `*.wasm` files next to the bundle that imports `index.js`.
|
|
40
|
+
- **No bundler**: copy the folder into your site and `import { reconstruct } from '/vendor/long-screen/index.js'`.
|
|
41
|
+
|
|
42
|
+
## Cross-origin isolation
|
|
43
|
+
|
|
44
|
+
On a cross-origin-isolated page the engine runs on several threads. Send these headers with the page (and keep every subresource same-origin or CORP/CORS-enabled):
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
Cross-Origin-Opener-Policy: same-origin
|
|
48
|
+
Cross-Origin-Embedder-Policy: require-corp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Without them it runs the single-thread SIMD build. The prints are the same; only the speed differs.
|
|
52
|
+
|
|
53
|
+
## Browser support
|
|
54
|
+
|
|
55
|
+
Recent Chrome, Edge and Safari (WebCodecs, OffscreenCanvas, module Workers). Firefox decodes only what its WebCodecs supports.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT, © 2026 Yi-Ting Chiu. The bundled files include third-party code (mediabunny, i18next, client-zip and the Rust crates compiled into the WebAssembly core); their licences are in `THIRD_PARTY_NOTICES.txt`.
|