@missing-elements/h5p-offline-player 0.1.0 → 0.1.1
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 +11 -6
- package/dist/VERSION +1 -1
- package/dist/frame-assets/MANIFEST.json +1 -1
- package/dist/h5p-player.js +4 -1773
- package/dist/h5p-sw-mount.js +9 -75
- package/dist/h5p-sw.js +9 -75
- package/package.json +23 -22
- package/types/node/tsconfig.node.tsbuildinfo +1 -1
- package/types/node/vite.plugins.d.ts +6 -0
- package/types/shared/chunk-store.d.ts +35 -4
- package/types/shared/constants.d.ts +19 -1
- package/types/shared/source-reader.d.ts +21 -0
- package/types/shared/source.d.ts +10 -20
- package/types/shared/storage.d.ts +18 -0
- package/types/sw/frame-boot.d.ts +32 -0
- package/types/sw/package-reader.d.ts +6 -2
- package/types/sw/watermark-wait.d.ts +21 -0
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @missing-elements/h5p-offline-player
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@missing-elements/h5p-offline-player)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
3
6
|
> **Not production ready.** This is an early release under active development. The API, the
|
|
4
7
|
> worker protocol and the cache layout can still change between versions, and the browser
|
|
5
8
|
> coverage is Chromium first. Try it, report what breaks, but do not put it in front of learners
|
|
@@ -22,10 +25,6 @@ The player is three things: the element (`h5p-player.js`, an ES module), a Servi
|
|
|
22
25
|
has to be served from **your own origin**, because browsers refuse to register a worker from
|
|
23
26
|
anywhere else. The other two can come from your bundle or from a CDN.
|
|
24
27
|
|
|
25
|
-
> The package is being published to npm. Until it lands, build it from source: `git clone`,
|
|
26
|
-
> `npm install`, `npm run build`, and serve `dist/` where the snippets below say the package's
|
|
27
|
-
> files go.
|
|
28
|
-
|
|
29
28
|
**A · With a bundler** (Vite, webpack 5, Rollup):
|
|
30
29
|
|
|
31
30
|
```bash
|
|
@@ -85,7 +84,9 @@ reads the archive in place and answers the H5P runtime's requests out of it:
|
|
|
85
84
|
- the archive's **central directory** is read over HTTP `Range` requests, so a 300 MB package
|
|
86
85
|
costs a few kilobytes before it starts;
|
|
87
86
|
- **large spans are pulled by several connections at once** and reassembled in order, because a
|
|
88
|
-
single connection is often capped well below the link
|
|
87
|
+
single connection is often capped well below the link — the first one streams straight into
|
|
88
|
+
the inflate, and the others open once it flows, so a slow link still sees its first bytes
|
|
89
|
+
within a second or two;
|
|
89
90
|
- **small entries and scripts** are inflated once into a Cache API store;
|
|
90
91
|
- **large stored media** is sliced straight out of the archive — never extracted, never stored;
|
|
91
92
|
- **large deflated media** is inflated into 8 MB chunks by a page-side worker, and served
|
|
@@ -212,7 +213,7 @@ Properties: `src`, `file` (a `File` from a picker — setting it loads), `pkgId`
|
|
|
212
213
|
| `progress` | Download or extraction progress, `fraction` 0–1 (or `null` when the total is unknown) |
|
|
213
214
|
| `resize` | The content's height changed |
|
|
214
215
|
| `statechange` | `state` changed |
|
|
215
|
-
| `error` | `code`: `no-cors`, `no-worker`, `network`, `quota`, `bad-archive`, `runtime` |
|
|
216
|
+
| `error` | `code`: `no-cors`, `no-worker`, `network`, `quota`, `bad-archive`, `runtime`. A `runtime` error after `ready` leaves `state` at `ready`: the content threw but is still running |
|
|
216
217
|
|
|
217
218
|
```js
|
|
218
219
|
const player = document.querySelector('h5p-player')
|
|
@@ -234,6 +235,10 @@ no "open in another browser" banner. Those belong to the host page, built out of
|
|
|
234
235
|
- `h5p-sw.js` is served from the site's own origin — browsers reject cross-origin Service Worker
|
|
235
236
|
registration. With a bundler this is automatic. Frame assets may come from a CDN.
|
|
236
237
|
- Package URLs send CORS headers. `Range` support is optional but avoids a full download first.
|
|
238
|
+
- Storage is optional on a host that honours `Range`, and for a file picked from disk: the
|
|
239
|
+
player caches what fits and serves the rest straight from the archive. A host without `Range`
|
|
240
|
+
makes it a requirement — the whole archive has to be stored — and a package larger than the
|
|
241
|
+
room the browser gives the site is refused with `error: quota`, naming the size it needed.
|
|
237
242
|
|
|
238
243
|
Integration details, including bundler-specific setup and single-worker hosts, are in
|
|
239
244
|
[h5p-player-setup.md](h5p-player-setup.md). The design is in
|
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.1
|