@tradalab/mediakit 2.9.0 → 2.10.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/README.md +31 -1
- package/dist/detect-worker.js +1140 -14
- package/dist/detect-worker.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +198 -140
- package/dist/index.js.map +1 -1
- package/dist/worker.js +1200 -67
- package/dist/worker.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -6,6 +6,35 @@ face retouching.
|
|
|
6
6
|
|
|
7
7
|
The examples named below live in the repository under `web/example/`; `make example` serves them.
|
|
8
8
|
|
|
9
|
+
### Upgrading to 2.10.0
|
|
10
|
+
|
|
11
|
+
No change to the API an app calls; serve the new `worker.js`, `detect-worker.js` and
|
|
12
|
+
`mediakit.wasm`, and install `@tradalab/tskit`, now a dependency (a bundler picks it up; a page
|
|
13
|
+
that loads `dist/index.js` through an import map maps `@tradalab/tskit/assets` and
|
|
14
|
+
`@tradalab/tskit/progress` too, as the examples do).
|
|
15
|
+
|
|
16
|
+
**New: every file mediakit fetches is downloaded once per origin and kept.** The MediaPipe runtime,
|
|
17
|
+
the models, the face cover and its onnxruntime wasm, `mediakit.wasm` and `wasm_exec.js` now go
|
|
18
|
+
through one manager on the page (`@tradalab/tskit/assets`): workers ask the page for them instead of
|
|
19
|
+
fetching on their own, and the bytes are kept in Cache Storage under `mediakit-v<version>`, which
|
|
20
|
+
does not depend on HTTP caching. Measured on Edge with three pipelines started at once on a server
|
|
21
|
+
sending no cache headers (the case of a self-signed certificate): 15 requests before, 6 of them for
|
|
22
|
+
the 13.5 MB MediaPipe wasm; 4 now, one per file; 0 on the next page load, where the first pipeline
|
|
23
|
+
was ready in 1.7 s instead of 2.6 s. Output pixels unchanged. Where Cache Storage is missing (not a
|
|
24
|
+
secure context) the files are kept in memory for the page. The files of older mediakit versions
|
|
25
|
+
are deleted from Cache Storage the first time a page of this version uses mediakit.
|
|
26
|
+
|
|
27
|
+
The MediaPipe runtime, `wasm_exec.js` and onnxruntime's glue now load from `blob:` URLs made from
|
|
28
|
+
those bytes. A page with a Content-Security-Policy has to allow `blob:` in `script-src` (and in
|
|
29
|
+
`worker-src` where it is set); without it the detectors fail to load and `health.parts` says so.
|
|
30
|
+
|
|
31
|
+
**New: `clearCachedAssets()`** deletes what this version keeps on disk, for a "free up space"
|
|
32
|
+
setting. Pipelines already running keep working; the next one downloads what it needs again.
|
|
33
|
+
|
|
34
|
+
`preloadDetectors` keeps its signature and its progress rules; it now fills Cache Storage rather
|
|
35
|
+
than the HTTP cache, so it helps on hosts that do not send cache headers too. Images the app gives
|
|
36
|
+
(backgrounds, LUTs, makeup textures) are still fetched as before.
|
|
37
|
+
|
|
9
38
|
### Upgrading to 2.9.0
|
|
10
39
|
|
|
11
40
|
No change for an app that does not read the new fields; serve the new `worker.js`,
|
|
@@ -38,7 +67,8 @@ gives no usable size (no `Content-Length`, or a compressed response, whose `Cont
|
|
|
38
67
|
not the size the browser hands over); show `done`/`files` then. `loaded` never passes a known
|
|
39
68
|
`total`. It is called at the start, at most every 100 ms while bytes arrive, and once per finished
|
|
40
69
|
file, the last call with `done === files`. A file that fails, or answers with an error status,
|
|
41
|
-
counts as done and adds no bytes
|
|
70
|
+
counts as done and adds no bytes; one that breaks off partway takes back the bytes it had sent, so
|
|
71
|
+
`loaded` can drop. A callback that throws is not called again. The MediaPipe
|
|
42
72
|
runtime and onnxruntime load in workers that report nothing, so this is the only progress there
|
|
43
73
|
is: an app that wants a progress line calls `preloadDetectors` when the camera screen opens and
|
|
44
74
|
shows it, and the detectors then load from the HTTP cache.
|