Skip to content

v0.4.0

Choose a tag to compare

@alekswebnet alekswebnet released this 07 Oct 01:36
· 236 commits to main since this release

h5p-standalone's options as attributes, the package's own metadata in the frame, and stable activity ids on every statement.

Package Version
@missing-elements/h5p-offline-player 0.4.0
@missing-elements/h5p-normalize 0.1.2

@missing-elements/h5p-cmi5 stays at 0.4.1 and @missing-elements/h5p-verify at 0.1.0: neither has changed. The demo site picks up its changes on the next deploy.

Player

Added

  • h5p-standalone's options, by their own names. Anyone coming from h5p-standalone can carry its configuration over as attributes:

    Attribute h5p-standalone What it does
    frame, copyright, export, icon, embed the same H5P's action bar under the content and its buttons; bare attribute means on, all off by default
    fullscreen="off" fullScreen takes the fullscreen button away; on by default
    download-url downloadUrl what the download button offers; defaults to the package URL
    embed-code, resize-code embedCode, resizeCode what the embed button offers, :w and :h standing for the size, and the sizing script shown beside it
    custom-css, custom-js customCss, customJs stylesheets and scripts loaded in the frame after the runtime's own, space separated; their origins are allowed by the frame's CSP without allow-origins
    reporting reportingIsEnabled the submit button in content types that have one: Question Set, Interactive Video, Course Presentation, Interactive Book
    activity-id xAPIObjectIRI the id statements carry as their object

    And user, a property, { name, mail }: the actor of every statement. It is read with the load, so set it before src. It is never stored.

    <h5p-player src="https://host.example/course.h5p" frame copyright export
                activity-id="https://lms.example/activities/course-1"></h5p-player>

    The options that decided a content folder's layout (h5pJsonPath, librariesPath, contentJsonPath) are decided by the .h5p itself; the ones that posted results to a server (ajax.*, postUserStatistics) are the xapi and finished events; the saved state (contentUserData, saveFreq) is resume. The setup guide's new section, Coming from h5p-standalone, maps every option.

  • The package's own metadata reaches the runtime. The title, licence, authors, source and change log from h5p.json are handed to H5P, so the copyright button shows the package's licence beside its media's notices, and every statement's object carries the content's title in definition.name. h5p-standalone presents every package as "Undisclosed"; this player did the same until now.

  • reporting works where h5p-standalone's flag does not. H5PIntegration.reportingIsEnabled is read by two content types; the rest expect the flag on the instance, which only h5p.com's core sets. With reporting the frame sets it on the instance too.

Changed

  • Statements name the package URL as their object. Until now the object id was the frame's own URL, which carries a hash of the package and so changed with every re-upload of the same file. It is now the package URL by default, or activity-id if set; a picked file keeps the frame URL, having no other. An LRS that keyed activities on the old ids will see new ids from this version on; the old ones never matched across builds anyway.
  • Every shipped file opens with a one-line notice naming the package, its version and its MIT licence, as the Service Worker scripts already did for zip.js. Bundlers emit each file on its own, and nothing from the package root travels with it.
  • The Service Worker scripts bundle zip.js 2.23.0, up from 2.17.0.

Fixed

  • A src no browser can fetch is refused with a reason. A file:, ftp:, javascript: or other non-fetchable URL now fails at once with error: network and a message naming the scheme, instead of a generic failure from the probe.

Upgrading

Sites that serve the package's dist/ through a bundler or from a CDN need nothing. Sites that copy h5p-sw.js by hand need to copy the new one, as with every release; the console warns until they do. Nothing in the existing API changed; the new attributes are all off by default, and the only behaviour a host may notice without setting one is the activity id above.

Normalizer

@missing-elements/h5p-normalize 0.1.2 updates its one dependency, zip.js, to 2.23.0. No change in what it writes.

Demo site

  • The player page shows H5P's action bar: Reuse downloads the package, Rights of use shows its licences, Embed offers the iframe code for this site's /embed page around it, with h5p.org's resizer script under "advanced".
  • /embed takes the display options from its query string, by the attribute names: &frame&copyright&export&icon, &reporting, &fullscreen=off, &activity-id=…, &custom-css=…. Not custom-js or user.
  • The xAPI example names a learner through user, so its statements show a real actor and the package URL as object.
  • A light and dark theme switch and a GitHub link in every page's header; the brand mark, favicon, app icons and social card now read "H5P". The README opens with a short recording of pasting a URL and playing.
  • The build scripts fetch content types from H5P Group's new hub host, hub-api.h5p.org. The element keeps using api.h5p.org for libraries="hub", because the new host sends no CORS headers yet.

Repository

Issue templates, contributing guidelines, a security policy, a CI workflow and CodeQL scanning. Of CodeQL's first fourteen findings, two were real and are fixed in the demo's tests; twelve flagged the element's own iframe.src, which is the same-origin frame URL by construction, and are dismissed with that reason. The test runner now runs the packages one at a time, which ends a race two packages' asset syncs had on CI.

Full Changelog: v0.3.2...v0.4.0