feat(play): the play page asks for the files a source names

Merged
AL
2d ago
+132-17

Closes #88.

An activity that uses a file of the person's own, such as an Interactive Video made from a video they attached in the chat, now plays on the play page. Until now the page sent it to the build page.

  • The page asks. It names the files the activity uses and shows Choose the file. The files are read in the browser and go nowhere. The picker is limited to the kinds of file the source names.
  • A card can hand them over. When framed, the page posts needs-files to its parent with the names, and takes { source: 'h5p-play-host', type: 'files', files } from it.
  • One file for one name. Files are matched by name, as on the build page. When the source names one file and one of the same kind is given, it's taken whatever it's called.
  • The player's box stays hidden until there is something to play, so the page shows no empty box while it asks or builds.

Why: in ChatGPT on 2026-11-20 the app got a piece of text in place of the attached video, three runs out of three (openai/openai-apps-sdk-examples#237, comment of 2026-10-22). So the card can't rely on the chat app for the file.

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, with a 1 MB video and an Interactive Video source:
    • chosen in the page's own field under the source's name: ready in 1.1 s;
    • chosen under another name: ready in 0.8 s;
    • fetched by the card and handed over by message: ready in 0.9 s.
  • No page errors in any run. The sources without files from #87 still build and play.

Summary by cubic

Closes #88.

The play page now plays activities that use files of the person's own, like an Interactive Video made from a video they attached in a chat; until now it sent them to the build page.

  • The page asks for them itself: it names the files, shows Choose the file, and reads the files in the browser, where they stay. The picker accepts only the kinds of files the source names.
  • Or the frame's parent hands them over: when framed, the page posts needs-files to its parent and takes { source: 'h5p-play-host', type: 'files', files } from it.
  • Matched by name, as on the build page. When the source names one file and one of the same kind is given, it's taken whatever it's called.
  • The missing names are told once per set: a parent that answers each time with the same files, some of them, is not asked again without end.
  • The player box stays hidden until there is something to play, so no empty box shows while the page asks or builds.

Why: in ChatGPT, the app received a piece of text in the place of an attached video, three times out of three, so the card can't rely on the chat app for the file.