Skip to content

v1.0.1

Choose a tag to compare

@alekswebnet alekswebnet released this 19 Oct 14:37

@missing-elements/h5p-offline-player 1.0.1 and @missing-elements/h5p-embed 1.0.1. The runtime, the libraries, the verifier, cmi5 and the normalizer stay at 1.0.0.

Fixed: the first load after upgrading to 1.0 (#49)

On a site a browser had visited before, upgrading from 0.10 to 1.0 could fail the first load, three ways. Each was reproduced with the published files and is fixed.

  • A copy of the runtime kept from before. The runtime's files keep their names from one version to the next, and the demo and every site h5p-embed writes let a browser keep them for an hour. A returning browser ran 0.2's boot script under the new worker: "Cannot read properties of undefined (reading 'H5P')" on every play for that hour. The demo and the embed site now serve /frame-assets/ and /libraries/ with Cache-Control: no-cache, so the browser asks each time and gets a 304 when nothing changed. If you serve copied folders yourself, do the same; the README and docs/single-worker.md say how.
  • Too short a wait for the new worker. The element waits three seconds for its updated worker and then goes ahead with the one it has. That is right within a major, whose older worker serves the element, and not across one. With h5p-sw.js answered after four seconds, the load went ahead with the 0.10 worker, the new one took over halfway through, and the load stayed in indexing. For a worker of another major the element now waits up to thirty seconds, and a load started during that wait waits on it too.
  • A page still open from before the upgrade. The 1.0.0 notes said a tab still open on 0.10 keeps playing. On a host that serves the runtime at one path — the demo, an embed site, a copy of dist/ — it did not: the boot script at that path is 1.0's by then, and the next load stopped with "The player's Service Worker is older than this runtime". The worker now names the boot route in such a page's frame document too, and the 1.0 boot script boots from it.

A visitor who hit any of these only needs to reload: the new worker is active after the first failed load.

@missing-elements/h5p-embed 1.0.1

  • The headers it writes serve /frame-assets/* and /libraries/* with Cache-Control: no-cache; resizer.js keeps its hour.
  • It requires player 1.0.1.
  • Write the site again with --force and deploy it.

Upgrading

  • On a CDN, change the player's URL to @missing-elements/h5p-offline-player@1.0.1 and copy its dist/h5p-sw.js onto your site again. The runtime's URL stays at 1.0.0.
  • With a bundler, update @missing-elements/h5p-offline-player. The bundler emits the new worker.
  • With your own Service Worker that mounts the player (mountH5P), build and deploy it again.
  • With copied folders, copy dist/ again, and serve frame-assets/ and the library pack's folder with Cache-Control: no-cache.

Full Changelog: v1.0.0...v1.0.1