From 800222ef0a507fe23375d75d9932ad0c48441478 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Thu, 5 Nov 2026 21:21:22 +0200 Subject: [PATCH] feat(scorm): SCORM 2004, a pass mark and completion as 100, as options A zip written with none of them is the SCORM 1.2 zip written before: its manifest, launch page and notice are unchanged, and only the bridge is new code, which plays such a page as it did. - SCORM 2004 4th Edition (--scorm-version 2004): its manifest, API_1484_11, completion and success apart, the scaled score, each answer with its words as the description and a urn:uuid id, ISO 8601 times, 64,000 characters of saved state. A 2004 session always ends suspended: ended normal after a finish, Moodle 4.5 handed the next launch an empty data model within the same attempt, and the completion it kept was written over. - A pass mark (--pass-mark): 1.2's mastery score or 2004's objective measure; the bridge holds the score to the LMS's mark, else the zip's, in place of the content's own pass. - Completion as 100 (--completion-score): content that finishes without a score records 100. The page gets an Options step for all three, page-wide. Checked in Moodle 4.5 and SCORM Cloud. --- apps/demo/demo/player-page.css | 32 +++ apps/demo/demo/scorm.html | 58 +++-- design/scorm.md | 76 +++++- docs/compatibility.md | 5 +- packages/embed/README.md | 73 ++++-- packages/embed/bin/h5p-embed.mjs | 34 ++- packages/embed/lib/scorm-browser.mjs | 26 +- packages/embed/lib/scorm-core.mjs | 115 +++++++- packages/embed/lib/scorm.mjs | 23 +- packages/embed/scorm/index.html | 2 +- packages/embed/scorm/scorm.js | 243 +++++++++++++---- packages/embed/site/scorm-page.css | 46 ++++ packages/embed/site/scorm-page.js | 57 +++- packages/embed/site/scorm.html | 45 +++- packages/embed/tests/package-types.ts | 9 +- packages/embed/tests/scorm-browser.test.ts | 23 ++ packages/embed/tests/scorm-page.test.ts | 41 +++ packages/embed/tests/scorm.test.ts | 289 ++++++++++++++++++++- 18 files changed, 1031 insertions(+), 166 deletions(-) diff --git a/apps/demo/demo/player-page.css b/apps/demo/demo/player-page.css index 2b326855..fb9e3e44 100644 --- a/apps/demo/demo/player-page.css +++ b/apps/demo/demo/player-page.css @@ -705,6 +705,38 @@ button.scorm-row-remove { min-height: 2rem; margin-left: auto; padding: 0.2rem 0 .scorm-row-download { display: inline-block; margin-top: 0.6rem; font-weight: 600; } .scorm-row-download[hidden] { display: none; } +/* The options, one card: the version as two radios, the pass mark, and completion as 100, each + with a line of what it does. */ +.scorm-options { + display: grid; + gap: 1rem; + padding: 0.95rem 1rem; + border: 1px solid var(--line); + border-radius: var(--radius); + background: var(--surface); +} +.scorm-options fieldset { margin: 0; padding: 0; border: 0; } +.scorm-options legend { margin-bottom: 0.35rem; padding: 0; font-weight: 600; } +.scorm-options fieldset label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; margin: 0.3rem 0; } +.scorm-options input[type="radio"], .scorm-options input[type="checkbox"] { accent-color: var(--accent); } +.scorm-option { display: grid; gap: 0.35rem; justify-items: start; } +.scorm-option label[for="pass-mark"], .scorm-check { font-weight: 600; } +.scorm-check { display: flex; align-items: baseline; gap: 0.5rem; } +#pass-mark { + width: 10rem; + 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; + transition: border-color var(--ease), box-shadow var(--ease); +} +#pass-mark:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } +#pass-mark[aria-invalid="true"] { border-color: var(--danger); } +.scorm-options .step-hint { font-size: 0.875rem; } + /* ---------------------------------------------------------------- the player's box */ h5p-player { diff --git a/apps/demo/demo/scorm.html b/apps/demo/demo/scorm.html index 60e1389a..2edfd784 100644 --- a/apps/demo/demo/scorm.html +++ b/apps/demo/demo/scorm.html @@ -4,14 +4,14 @@ Convert H5P to SCORM in your browser — h5p-offline-player - + - + @@ -19,7 +19,7 @@ - + @@ -33,7 +33,7 @@

H5P to SCORM

Drop .h5p 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 + download them as SCORM 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.

@@ -57,8 +57,32 @@

2 Review

+ + + +