Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions apps/demo/demo/player-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,69 @@ progress[hidden] { display: none; }
.message.offer:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.offer button[hidden] { display: none; }

/* ---------------------------------------------------------------- the SCORM page's steps */

/* A step: its number in a disc before its heading, and hidden until the page can reach it. */
.step[hidden] { display: none; }
.step h2 { display: flex; align-items: center; gap: 0.6rem; }
.step-number {
display: inline-grid;
flex: none;
place-items: center;
width: 1.75rem;
height: 1.75rem;
border-radius: 50%;
background: var(--accent);
color: var(--accent-ink);
font-size: 0.875rem;
font-weight: 650;
letter-spacing: 0;
}
.step-hint { color: var(--muted); font-size: 0.925rem; }

/* A file's row in the review: its name, size and a button to take it out; what its zip will hold,
or why none can be written, in a strip whose left edge takes the state's colour as the status
strip's does; its title in the LMS; and, with several files, its own zip. */
.scorm-rows { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.scorm-row {
padding: 0.85rem 1rem;
border: 1px solid var(--line);
border-left: 3px solid var(--line-strong);
border-radius: var(--radius-sm);
background: var(--surface);
}
.scorm-row[data-state="built"] { border-left-color: var(--ok); }
.scorm-row[data-state="refused"],
.scorm-row[data-state="failed"] { border-left-color: var(--danger); }
.scorm-row[data-state="reading"],
.scorm-row[data-state="building"] { border-left-color: var(--accent); }
.scorm-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.scorm-row-name { font-weight: 600; overflow-wrap: anywhere; }
.scorm-row-size { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
/* A small button beside the name, where the page's own rule draws a large one. */
button.scorm-row-remove { min-height: 2rem; margin-left: auto; padding: 0.2rem 0.75rem; font-size: 0.85rem; }
.scorm-row-facts { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.925rem; }
.scorm-row[data-state="refused"] .scorm-row-facts,
.scorm-row[data-state="failed"] .scorm-row-facts { color: var(--danger); }
.scorm-row-title { display: grid; gap: 0.3rem; margin-top: 0.65rem; font-size: 0.85rem; font-weight: 600; }
.scorm-row-title input {
min-width: 0;
min-height: 2.5rem;
padding: 0.4rem 0.75rem;
border: 1px solid var(--line-strong);
border-radius: var(--radius-sm);
background: var(--bg);
color: inherit;
font: inherit;
font-size: 0.95rem;
font-weight: 400;
transition: border-color var(--ease), box-shadow var(--ease);
}
.scorm-row-title input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scorm-row-title input:disabled { opacity: 0.6; }
.scorm-row-download { display: inline-block; margin-top: 0.6rem; font-weight: 600; }
.scorm-row-download[hidden] { display: none; }

/* ---------------------------------------------------------------- the player's box */

h5p-player {
Expand Down
64 changes: 42 additions & 22 deletions apps/demo/demo/scorm.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Convert H5P to SCORM in your browser — h5p-offline-player</title>
<meta name="description" content="Drop a .h5p file and download it as a SCORM 1.2 package for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<meta name="description" content="Drop .h5p files, check each one, and download them as SCORM 1.2 packages for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<link rel="canonical" href="%SITE_URL%/demo/scorm.html" />
<meta name="theme-color" content="#2f6df6" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="h5p-offline-player by Missing Elements" />
<meta property="og:locale" content="en_US" />
<meta property="og:title" content="Convert H5P to SCORM in your browser — h5p-offline-player" />
<meta property="og:description" content="Drop a .h5p file and download it as a SCORM 1.2 package for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<meta property="og:description" content="Drop .h5p files, check each one, and download them as SCORM 1.2 packages for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<meta property="og:url" content="%SITE_URL%/demo/scorm.html" />
<meta property="og:image" content="%SITE_URL%/demo/og-image.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="h5p-offline-player: self-hosted H5P, with no H5P server" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Convert H5P to SCORM in your browser — h5p-offline-player" />
<meta name="twitter:description" content="Drop a .h5p file and download it as a SCORM 1.2 package for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<meta name="twitter:description" content="Drop .h5p files, check each one, and download them as SCORM 1.2 packages for Moodle, ILIAS, OpenOLAT, Chamilo or SCORM Cloud. Built in your browser with nothing uploaded; the LMS records the score, the result, each answer, the time and the learner's place." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<!-- partial: head -->
<script type="module" src="/demo/scorm-page.js"></script>
Expand All @@ -32,29 +32,49 @@
<p class="eyebrow">SCORM</p>
<h1>H5P to SCORM</h1>
<p class="lede">
Drop a <code>.h5p</code> file here, or choose one, and download it as a SCORM 1.2 package
for your LMS. It is built in your browser with the player this site serves, and nothing is
uploaded: the package never leaves your computer.
Drop <code>.h5p</code> files here, or choose them, check what each zip will hold, and
download them as SCORM 1.2 packages for your LMS. They are built in your browser with the
player this site serves, and nothing is uploaded: the packages never leave your computer.
</p>

<form class="controls">
<label class="file">
Choose a .h5p file
<input type="file" id="file" accept=".h5p,application/zip" />
</label>
</form>
<section class="step" data-step="choose">
<h2><span class="step-number">1</span> Choose</h2>
<form class="controls">
<label class="file">
Choose .h5p files
<input type="file" id="file" accept=".h5p,application/zip" multiple />
</label>
<span class="step-hint">or drop them anywhere on this page; each becomes a zip of its own</span>
</form>
</section>

<div class="status" data-state="idle">
<span class="badge" id="state" data-state="idle">idle</span>
<span id="status"></span>
<a id="download" hidden>Download</a>
</div>
<section class="step" data-step="review" hidden>
<h2><span class="step-number">2</span> Review</h2>
<p>
What each zip will hold, read from the package before anything is built. The title is
what the LMS lists the package by; change it here if you like.
</p>
<ul class="scorm-rows" id="files"></ul>
</section>

<!-- The live region is on the page from the start, as on the player page, so that a refusal
put into it is announced. -->
<div role="status" aria-live="polite">
<p class="message error" id="notice" hidden></p>
</div>
<section class="step" data-step="download" hidden>
<h2><span class="step-number">3</span> Download</h2>
<form class="controls">
<button type="button" class="primary" id="build">Build the SCORM package</button>
</form>

<div class="status" data-state="idle">
<span class="badge" id="state" data-state="idle">idle</span>
<span id="status" aria-live="polite"></span>
<a id="download" hidden>Download</a>
</div>

<!-- The live region is on the page from the start, as on the player page, so that a refusal
put into it is announced. -->
<div role="status" aria-live="polite">
<p class="message error" id="notice" hidden></p>
</div>
</section>

<h2>In the LMS</h2>
<p>
Expand Down
5 changes: 3 additions & 2 deletions design/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ packages/embed/ @missing-elements/h5p-embed — the embed page as a st
lib/scorm-core.mjs what the SCORM zip is wherever it is written, and no Node import: the
package read and its parts planned, the entries laid out, the zip written
into a zip.js writer; lib/scorm-browser.mjs, `./scorm/browser`,
buildScormInPage(): the same zip in a page, from a File, the files
fetched from the site and the zip a Blob; lib/shared.mjs, EmbedError and
planScormInPage() and buildScormInPage(): the same zip in a page, from a
File, read and planned first (#137), the files fetched from the site and
the zip a Blob; lib/shared.mjs, EmbedError and
the player's file names, for the modules that import no Node (#122)
scorm/ the SCORM package's launch page (index.html, its title, language and
build filled in by the writer), scorm.js, its bridge to the LMS's API,
Expand Down
54 changes: 49 additions & 5 deletions design/scorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,15 @@ one row each; an LMS added here gets a row there.
compressor, as one bundled for 1.4 does, gets the one at `base` or a zip without it, whose page
names none and whose bridge writes the state plain, rather than an export that fails for a file
it never had to serve), each part checked against the index's SHA-256 since it came
over the network, and the zip a `Blob`. The runtime's files are named by a list,
over the network, and the zip a `Blob`, in two steps since #137: `planScormInPage` reads and
plans, and the plan's `write` fetches and writes (below). The runtime's files are named by a list,
`RUNTIME_FILES`, plus the fonts from its `MANIFEST.json`, since a folder on a server cannot be
listed; `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, so a
file the runtime adds shows up there. `site/scorm-page.js` is the page's script,
`startScormPage()`, which reads `#file`, `#status`, `#download` and `#notice`, and a `#state`
badge where the page has one; the written site loads it as `scripts/build.mjs` bundles it with
`startScormPage()`, which reads `#file`, `#status`, `#download` and `#notice`, a `#state`
badge where the page has one, and `#files` and `#build` where it works in steps (below); the
written site loads it as `scripts/build.mjs` bundles it with
zip.js and the player's `./plan` (`dist/scorm-page.js`, zip.js's licence in its header, since the
site has no bundler), from `scorm.html`, with the launch page and the bridge copied beside it as
`scorm-launch.html`, `scorm.js` and `lz-string.js` and the player's and the pack's versions in
Expand All @@ -293,8 +295,50 @@ one row each; an LMS added here gets a row there.
Decided with the owner that day: SCORM 1.2 only, H5P's result rule kept,
the tested LMSs the supported ones. Canvas, the audience's LMS, runs its SCORM on Rustici's
SCORM Cloud by all accounts and cannot be tested here, since Canvas Free-for-Teacher has no SCORM
upload. `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.
upload.
- **The page works in steps, and the title is the teacher's** (#137, 2026-11-05). The University
of Tennessee's in-browser converter (Nick Pook, MIT, h5p-standalone inside) reviews each package
before it builds, lets the title be changed and takes several files; the owner asked for the
same here, the build staying ours: their zips, measured on 2026-11-05 under a stand-in for an
LMS and in SCORM Cloud, sent no score, no answers and no time, and never resumed. So a page
shows what a zip will hold before anything is written, from the plan the build then uses:
`planScormInPage` reads
the package and plans its parts, and returns the facts, the main library with the version its
`preloadedDependencies` give it (`mainLibraryOf`), the title, the size, the parts and their size
from the pack's index, with `write`, which fetches the files and writes the zip, as often as
asked; `buildScormInPage` is the two at once. A refusal comes at planning, by name, before
anything but the pack's index is fetched. **The title** is `title` on both builders and
`--title` on the command, cleaned by `scormTitle` as `h5p.json`'s is, an empty one leaving the
package's; it goes into the manifest's organisation and item, which the LMS lists, and the
launch page's `<title>`, and not into the build stamp, so a zip written again under another
title keeps learners' places, nor into the package, which goes in as exported. **The page**
works in steps where it holds `#files`, a list, and `#build`, a button, as both pages here do:
① choose, ② review, ③ download, each step the closest `[data-step]` around them, shown once it
can be reached. A file chosen or dropped gets a row (the same file twice, by name, size and date,
is one), whose facts sit in a live region (`role="status"`) from the moment the row appears, so
that what the reading found is announced. Every row is drawn again on any change, a key typed
in a title among them, so the page writes a region's text, and `#status`'s, only when it
changes: written again as it was, a region may be read out again, and a test types a title key
by key and counts no change to either. `#build` writes the rows one after another, a failure
shown in its row while the others go on; `#download` is then the zip, or, for several, one zip
holding them all, each stored as it is with its sizes and CRC in its local header (`addStored`,
the package's way since #92), while each row links its own; a title changed after a build takes
that zip back. A page with only the four elements of before builds the first file at once and
shows a refusal in `#notice`, as up to 1.5, since `startScormPage` and its page are covered by
docs/compatibility.md and a host's own page has to keep working. Not taken from their page: a
contents list, a SCORM Cloud link, an export of the settings, switches for playing offline and
for resume, since every zip here carries all it plays and always resumes, and an accessibility
check, which would need knowledge of each content type. The SCORM version and the grading
options are #138's.

`scorm-page.test.ts` drives the written site's page in Chromium: a chosen file read into its row
and built on Build, the download, which is the command's zip and plays unpacked; three files at
once, a refusal in its row beside two that build, a title given, each row's zip and the zip of
all, a row taken out, a title changed after the build; files dropped, the same one only once;
and a page with only the four elements, which builds at once and refuses in `#notice`.
`scorm-browser.test.ts` holds the plan's facts to the command's zip, two writes of one plan
under two titles to the same zip but for the manifest and the page, and a title given to the
page's builder to the command's `--title`, entry for entry.

`tests/scorm.test.ts` checks the zip, the parts it carries, its stored entries' local headers and
its refusals in Node. In Chromium it plays the unpacked zip under a page that holds the API and
Expand Down
6 changes: 3 additions & 3 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ What is covered of the pack itself: the `pack` export, `parts/` with its `index.
question's `cmi.interactions.n`), and what it keeps in `cmi.suspend_data`, which a zip written
by a later version reads back unless the libraries it carries from the pack have changed: 1.5
writes it compressed and still reads what 1.4 wrote plain.
- **The SCORM page**, `scorm.html` on a written site, and **`buildScormInPage()`** and
**`startScormPage()`**, with their options and types: the same zip as `buildScorm()`'s, built in
the browser.
- **The SCORM page**, `scorm.html` on a written site, and **`planScormInPage()`**,
**`buildScormInPage()`** and **`startScormPage()`**, with their options and types: the same zip
as `buildScorm()`'s, built in the browser.

A written site is a folder of copies and changes only when it is written again: upgrading is
running the new version of the command and deploying the folder. A SCORM zip likewise, replaced in
Expand Down
Loading
Loading