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
9 changes: 7 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ apps/demo/ the demo app: the dev server for the whole repository,
demo/cmi5.html with demo/cmi5-page.js is a cmi5 assignable unit around
the element, on @missing-elements/h5p-cmi5, and demo/cmi5-course.zip the
course structure for importing it into an LMS, naming the hosted page;
demo/element.js is the one import of the element every page loads
demo/element.js is the one import of the element every page loads;
demo/theme.js the light/dark switch, a classic script every page
loads in its head before the stylesheet, since the CSP allows no
inline script and a pinned theme has to be on <html> before the
first paint
tests/ cmi5.test.ts: the cmi5 page against a mock LMS and LRS on a second
origin, through the dev server and a real browser
cmi5-catapult/ docker-compose.yml for ADL's CATAPULT player, MySQL and the SQL LRS;
Expand Down Expand Up @@ -1175,7 +1179,8 @@ SPA-fallback trap described above cannot happen there.
fallback stays for those, and for an in-app browser.
- **The pages carry their metadata, and the origin is filled in at build time.** Titles,
descriptions, canonical links, Open Graph and Twitter tags, JSON-LD for the software on the
front page, `robots.txt` and `sitemap.xml`, and the GitHub link in every page's navigation. The
front page, `robots.txt` and `sitemap.xml`, and the GitHub link at the right of every page's
header, an icon beside the theme switch. The
absolute URLs are written as `%SITE_URL%` in the HTML and replaced by `siteUrlPlugin`
(`apps/demo/vite.config.ts`), which runs before Vite's own `%ENV%` pass so Vite does not warn about a
name it does not know. `build-demo.mjs` decides the origin — `SITE_URL` if set, else Vercel's
Expand Down
Binary file modified apps/demo/app/icons/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/demo/app/icons/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/demo/app/icons/icon-maskable-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions apps/demo/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
under /assets/ would point them at nothing. The build copies both as they are. -->
<link rel="manifest" href="/app/manifest.webmanifest" vite-ignore />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<link rel="stylesheet" href="/app/app.css" />
<script type="module" src="/demo/element.js"></script>
Expand All @@ -44,15 +47,25 @@

<body>
<header class="topbar">
<a class="brand" href="/app/"><span class="brand-mark" aria-hidden="true">H5</span>H5P Offline Player</a>
<a class="brand" href="/app/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />H5P Offline Player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/" aria-current="page">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html">Normalize</a>
<a href="/demo/">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down
17 changes: 15 additions & 2 deletions apps/demo/demo/cmi5.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<meta name="twitter:description" content="The player as a cmi5 assignable unit: launched by an LMS, statements to its LRS, completion by the mastery score, with the build's revision on every statement." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<script type="module" src="/demo/element.js"></script>
<script type="module" src="/demo/cmi5-page.js"></script>
Expand All @@ -30,15 +33,25 @@

<body>
<header class="topbar">
<a class="brand" href="/"><span class="brand-mark" aria-hidden="true">H5</span>h5p-offline-player</a>
<a class="brand" href="/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />h5p-offline-player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html">Normalize</a>
<a href="/demo/" aria-current="page">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down
19 changes: 17 additions & 2 deletions apps/demo/demo/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,34 @@
<meta name="twitter:description" content="For a site that cannot host a file: frame the player page, size it with H5P's own resizer protocol, and receive xAPI statements on request." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<script type="module" src="/demo/analytics.js"></script>
</head>

<body>
<header class="topbar">
<a class="brand" href="/"><span class="brand-mark" aria-hidden="true">H5</span>h5p-offline-player</a>
<a class="brand" href="/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />h5p-offline-player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html">Normalize</a>
<a href="/demo/" aria-current="page">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down Expand Up @@ -104,6 +117,8 @@ <h2>What this page received</h2>
if (data.action === 'hello') source.postMessage({ context: 'h5p', action: 'hello' }, origin)
if (data.action === 'resize') {
frame.style.height = `${data.scrollHeight}px`
// Content is up: the box around it goes, so its rounded corners stop clipping it (player-page.css).
frame.dataset.loaded = ''
write(`resize ${data.scrollHeight}px`)
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/demo/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions apps/demo/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,35 @@
<meta name="twitter:description" content="The whole integration in two lines, and the other ways to embed a browser-only H5P player: xAPI, cmi5, a file from disk, an iframe, two players on one page." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<script type="module" src="/demo/element.js"></script>
<script type="module" src="/demo/analytics.js"></script>
</head>

<body>
<header class="topbar">
<a class="brand" href="/"><span class="brand-mark" aria-hidden="true">H5</span>h5p-offline-player</a>
<a class="brand" href="/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />h5p-offline-player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html">Normalize</a>
<a href="/demo/" aria-current="page">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down
17 changes: 15 additions & 2 deletions apps/demo/demo/local-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,35 @@
<meta name="twitter:description" content="Hand the element a File from a picker and it is read with slice(), never loaded whole. The way around a host that sends no CORS headers." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<script type="module" src="/demo/element.js"></script>
<script type="module" src="/demo/analytics.js"></script>
</head>

<body>
<header class="topbar">
<a class="brand" href="/"><span class="brand-mark" aria-hidden="true">H5</span>h5p-offline-player</a>
<a class="brand" href="/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />h5p-offline-player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html">Normalize</a>
<a href="/demo/" aria-current="page">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down
17 changes: 15 additions & 2 deletions apps/demo/demo/normalize.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,34 @@
<meta name="twitter:description" content="Why video and audio compressed inside an .h5p cannot be played on demand, how to tell whether a package is affected, and how to fix it once with the normalizer." />
<meta name="twitter:image" content="%SITE_URL%/demo/og-image.png" />
<link rel="icon" type="image/svg+xml" href="/demo/favicon.svg" />
<!-- Ahead of the stylesheet, so a pinned theme is on <html> before anything is painted. A
classic script, which Vite leaves alone; the build copies it as it is. -->
<script src="/demo/theme.js" vite-ignore></script>
<link rel="stylesheet" href="/demo/player-page.css" />
<script type="module" src="/demo/analytics.js"></script>
</head>

<body>
<header class="topbar">
<a class="brand" href="/"><span class="brand-mark" aria-hidden="true">H5</span>h5p-offline-player</a>
<a class="brand" href="/"><img class="brand-mark" src="/demo/favicon.svg" alt="" width="32" height="32" />h5p-offline-player</a>
<nav aria-label="Site">
<a href="/">Player</a>
<a href="/app/">App</a>
<a href="/demo/setup.html">Setup</a>
<a href="/demo/normalize.html" aria-current="page">Normalize</a>
<a href="/demo/">Examples</a>
<a href="https://github.com/missing-elements/h5p-offline-player" rel="noopener">GitHub</a>
</nav>
<div class="topbar-actions">
<button type="button" class="icon-button theme-toggle" aria-label="Switch theme">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path class="icon-moon" d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
<g class="icon-sun"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" /></g>
</svg>
</button>
<a class="icon-button" href="https://github.com/missing-elements/h5p-offline-player" rel="noopener" aria-label="GitHub repository" title="GitHub repository">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.9 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3" /></svg>
</a>
</div>
</header>

<main>
Expand Down
Binary file modified apps/demo/demo/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading