Skip to content

An H5P-to-SCORM page in the browser: drop a .h5p, download the SCORM 1.2 zip (#122) - #123

Merged
alekswebnet merged 3 commits into
mainfrom
feat/scorm-in-browser
Nov 3, 2026
Merged

alekswebnet merged 3 commits into
mainfrom
feat/scorm-in-browser

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

Closes #122.

h5p-embed --scorm writes a SCORM 1.2 zip that six LMSs play and grade, and the people who need one — designers and teachers with Canvas, Moodle or Blackboard — do not run npx. Their route, H5P → Lumi → SCORM, has had Lumi's export broken since April, and no converter ran in the browser. This adds a page that does: a .h5p chosen or dropped becomes the same zip, built in the browser from the site's own copies of the player, the runtime and the library pack, with nothing uploaded.

What changed

  • lib/scorm.mjs is split as h5p-author: an entry that runs in a browser #108 split h5p-author's build. lib/scorm-core.mjs reads the package, plans its parts with the player's ./plan, lays out the entries and writes them into a zip.js writer, and imports no Node. lib/scorm.mjs is the Node side, the files from the installed packages and the zip to a path; buildScorm() is unchanged for callers. lib/scorm-browser.mjs, exported as ./scorm/browser, is the page's: buildScormInPage({ file, base, pack | packBase, assets, version, packVersion, onProgress }) fetches the player's files, the runtime (its file list from MANIFEST.json, since a folder on a server cannot be listed) and the parts the plan names, checks each part against the index's SHA-256, and returns the zip as a Blob. lib/shared.mjs holds EmbedError and the player's file names for the modules that import no Node; build.mjs re-exports the error.
  • The page, site/scorm.html, with site/scorm-page.js (startScormPage(), exported as ./scorm-page.js), scorm-main.js and scorm-page.css. A written site has no bundler, so scripts/build.mjs bundles the script with zip.js and the player's ./plan into dist/scorm-page.js (zip.js's licence in its header); buildSite copies it, the launch page's template as scorm-launch.html and the bridge as scorm.js, writes scorm.html with the policy, and puts the player's and the pack's versions into config.js for the zip's notice. The page says which LMSs the zip is checked in and what each needs.
  • The demo has it at /demo/scorm.html, in the site's own design, running the package's script with the demo's copies: the pack's parts as Vite emits them, the launch page, the bridge, embed.css and libraries.txt as ?raw strings, the player's version from a define, and the player's built files from the site root, which a dev middleware serves from the player's dist/.
  • Tests. tests/scorm-browser.test.ts runs the builder in Node, which has fetch, File and crypto.subtle, against a written site, and holds its zip to the command's entry for entry — names, stored or deflated, bytes — for the quiz and for the export without its libraries; the pack given as its export; the refusals, in the command's words; a part served with the wrong bytes; a site without the pack; a file the site lacks. tests/scorm-page.test.ts drives the page in Chromium: a chosen file, the download, which is the command's zip and plays unpacked, a refusal, and the next file after it. scorm.test.ts's quiz helpers moved to tests/helpers/ for the three to share.
  • README, AGENTS.md and docs/compatibility.md.

Decided (2026-11-03)

SCORM 1.2 only; H5P's own result rule holds, so content that reports no result stays incomplete; the supported LMSs are the ones tested. Canvas, the audience's LMS, runs its SCORM on Rustici's SCORM Cloud by all accounts and cannot be tested here: Canvas Free-for-Teacher has no SCORM upload.

Checked

  • The embed package's suite, 55 tests, and its typecheck; the demo's typecheck and build.
  • The built demo under the production headers (pnpm preview:demo), in Chromium: the quiz and the formulas export each built, downloaded and compared with the command's zip, entry for entry; a refusal shown; no console error or policy violation but /_vercel/insights/script.js, which the preview does not serve.

Release

Embed gets a minor (1.4.0): two new entries and a new page in every written site. Nothing else changes version. The demo deploys with main.

🤖 Generated with Claude Code

alekswebnet and others added 3 commits November 3, 2026 15:27
…corm (#122)

The people who need a SCORM package do not run npx, and their route, H5P
through Lumi, has had Lumi's export broken since April. A page on every
written site, and on the demo at /demo/scorm.html, now builds the zip the
command writes from a picked or dropped .h5p, in the browser, with nothing
uploaded.

lib/scorm.mjs is split as #108 split h5p-author's build: scorm-core.mjs
reads the package, plans its parts, lays out the entries and writes them,
and imports no Node; scorm.mjs is the Node side, unchanged for callers;
scorm-browser.mjs, ./scorm/browser, builds in a page from the site's own
copies, each part checked against the index's SHA-256, and returns a Blob.
scripts/build.mjs bundles the page's script with zip.js and the player's
./plan for the written site, which has no bundler. The demo runs the same
script in the site's own design.

scorm-browser.test.ts holds the page's zip to the command's entry for
entry, in Node; scorm-page.test.ts drives the page in Chromium.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alekswebnet
alekswebnet merged commit 828047d into main Nov 3, 2026
8 checks passed
@alekswebnet
alekswebnet deleted the feat/scorm-in-browser branch November 3, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An H5P-to-SCORM page in the browser: drop a .h5p, download the SCORM 1.2 zip, nothing uploaded

1 participant