Skip to content

v0.9.5

Choose a tag to compare

@alekswebnet alekswebnet released this 15 Oct 13:07

@missing-elements/h5p-offline-player 0.9.5, @missing-elements/h5p-runtime 0.2.4, @missing-elements/h5p-normalize 0.1.3, @missing-elements/h5p-verify 0.1.5.

A refused storage write no longer fails a download from a host without Range

On a host that ignores Range, the player indexes the archive while it downloads, so the frame can start before the last byte arrives, and it keeps that index in browser storage as it goes. If the browser refused one of those writes, usually because storage was full:

  • every later write of the index was skipped, so the frame could no longer start early;
  • each skipped write raised an unhandled rejection in the console;
  • at the end, the load failed with error, even though the whole archive had been stored.

Now a refused write costs only the early start. The player logs one warning, and the frame starts once the download is complete.

A library.json that cannot be read is named when the package loads

The player checks that the libraries a package carries have everything they depend on. It treated a library.json it could not read, damaged or not valid JSON, as one with no dependencies and let the package through. The runtime then failed on the same file with "Unexpected end of JSON input", which names no file. Now the load stops with error code bad-archive, and the message names the file: H5P.Foo-1.2/library.json could not be read: ….

source is cleared with the package

player.source kept describing the previous package in two cases: after src was removed, and while the next load started. A load that failed at its first request was therefore reported with the previous package's source. source is now null in both cases, like metadata and libraryBundle.

Runtime 0.2.4: a stalled upgrades.js no longer holds the content back

Before playing content written for an older minor version of a library, the runtime fetches that library's upgrades.js. That fetch had no time limit, so a host that stalled on it held the content back indefinitely. It now gives up after 20 seconds, like the runtime's other reads of library files. The content then plays as it was written, and the console says the upgrade failed. h5p-verify reports that as a warning.

The content upgrade and the content check also now read library names with one parser. The upgrade therefore also finds sub-content that names its library as H5P.Foo-1.0, a form H5P accepts, as well as H5P.Foo 1.0.

The fix ships in the runtime, so it also reaches players older than 0.9.5.

Types

The resize and statechange event details are exported as PlayerResizeDetail and PlayerStateChangeDetail.

@missing-elements/h5p-normalize 0.1.3

  • An unknown option, such as --bogus, printed a Node stack trace. It now prints the message and the usage and exits with code 2, as h5p-verify and h5p-embed do.
  • A run that fails partway now closes its output file before deleting the .part file. Until now the file stayed open, which on Windows stops it from being deleted.
  • --output together with --dry-run now says that the output is ignored, since a dry run writes nothing.
  • The README on npm has been rewritten.
  • extensionOf is no longer exported from the package's entry. It was never documented. The documented API, normalizeArchive, formatBytes and archiveFingerprint, is unchanged.

@missing-elements/h5p-verify 0.1.5

  • A browser that crashed, or a page that closed, while the verifier waited for ready was reported as the package timing out. It is now reported as the check failing to run: "The browser stopped before the package could be judged: …".
  • A file that exists but cannot be read is reported with the reason. Until now it was reported as "No such file".
  • It requires player 0.9.5 and runtime 0.2.4, so it plays packages with the fixes above.

Upgrading

On a CDN, update both URLs: h5p-offline-player@0.9.5 and h5p-runtime@0.2.4. Copy dist/h5p-sw.js from 0.9.5 onto your site again, since the Service Worker changed as well. With a bundler, update both packages.

@missing-elements/h5p-embed stays at 0.6.2 and @missing-elements/h5p-cmi5 at 0.4.2: their own code did not change in a way a host would notice. Embed 0.6.2 accepts player 0.9.5 and runtime 0.2.4, so a player domain gets these fixes when its site is written again with them installed.

Full Changelog: v0.9.4...v0.9.5