Skip to content

v0.1.7

Choose a tag to compare

@alekswebnet alekswebnet released this 28 Sep 09:48
· 324 commits to main since this release

What's new

Libraries from the hub now work offline

When the libraries source can't be reached (no network, the H5P hub is down, or it returns a server error), the player now uses the copy of that bundle it downloaded before.

This means a package exported without its own libraries, which h5p.com and h5p.org do by default, now plays offline once it has played online with libraries="hub" or a bundle URL.

  • If the bundle was never downloaded before, you get the same error as before, naming the missing libraries.
  • When online, the player still checks the source first, so a bundle that has changed there is downloaded again.

A clear error for http: URLs on https: pages

Browsers block these as mixed content. 0.1.6 reported this as no-cors, which pointed to the wrong fix. It is now a network error that names the blocked URL and suggests its https: version. http://localhost and 127.0.0.1 still work.

zip.js licence in the worker files

h5p-sw.js and h5p-sw-mount.js now start with zip.js's full BSD-3-Clause licence as a /*! … */ comment. The notice now travels with the file when a bundler emits it on its own.

Fixes

  • Package contents: removed six stale type-declaration files. Four described this repository's own build configuration (types/node/…) and two described source files deleted long ago (types/shared/mp4.d.ts, types/sw/stream-utils.d.ts). Nothing imported them.
  • README on npm: links now work on npmjs.com. Relative links such as LICENSE and the setup guide previously led nowhere.

Related

The package normalizer is now its own npm package, @missing-elements/h5p-normalize. It rewrites a .h5p once so its video and audio stream:

npx @missing-elements/h5p-normalize course.h5p

Upgrading

Nothing breaks: there are no new attributes or events.

  • With a bundler: update the package.

  • Without a build step: if you serve h5p-sw.js yourself, copy the new one as well. With an older worker, the element still plays, but the offline library fallback doesn't apply and the console warns about the version mismatch.

    npm i @missing-elements/h5p-offline-player@0.1.7

Full changelog: v0.1.6...v0.1.7