feat(play): a play page, the activity alone for a chat app's card

Merged
AL
2d ago
+110-3

Closes #86.

/h5p/play/#source=… is the activity on its own, for a chat app's card (missing-elements/h5p-toolkit#210). It builds the source in the browser just as the build page does, reusing build-source.ts and the same packages, and shows only the player, Download the .h5p, and Open in the build page.

Inside a frame, it posts two messages to its parent:

  • its height, which the card sizes itself to;
  • the built .h5p file, which the card can save its own way, since a host's sandbox may block a download from a frame.

A source with problems, or one that names files of the person's own, gets one sentence and the link to the build page, where those are handled.

Checked:

  • pnpm build passes.
  • In Chromium, an outer page stood in for ChatGPT and framed the probe's card, which framed this page from a local preview. The sample Course Presentation was ready 1.2 s after the frame was set, the card followed the page's height, the file reached the card, and the page threw no errors.
  • In ChatGPT itself it can't be tested before it's live: a free tunnel puts a caution page in front of browsers, and that page refuses to be framed. Once merged, the probe frames https://missing-elements.github.io/h5p/play/.

Summary by cubic

Adds /h5p/play/, a page that builds an H5P activity from the #source= in its link and plays it alone, for a chat app to embed in its reply as a frame. Closes #86.

New Features

  • Reuses the build page's browser-side building; beside the player it shows only Download the .h5p and Open in the build page.
  • When framed, posts its height and the built .h5p file to the parent, since a host's sandbox may block a frame download.
  • A source with problems, or one that names the person's own files, gets a short message and the link to the build page where those are handled.
  • No page links to it, and it is left out of the sitemap.