fix(play): a framing page can say that a file did not come, and the page asks the person for it (#106)
Closes #106. Part of missing-elements/h5p-toolkit#210.
Where a card cannot bring a file the page asked it for, the page waited on with nothing said. The app server's card now says so (h5p-toolkit#271), and the page takes it.
What a person sees now
- Download, and the video does not come from the chat: the row under the stage says "Your video could not be fetched from the chat: its address may have run out. Choose it from your computer instead.", its bar goes, and Download reads "Try again". The activity plays on.
- A file the activity cannot be built without does not come: the page's own "Add your video", saying "Your video could not be fetched from the chat. Choose it from your computer; it stays in your browser."
For the page that frames this one
| Message | Way | What it does |
|---|---|---|
{ type: 'failed', name } | to the page | A file the page asked for did not come. Optional. At any other time than the two above it does nothing. |
The row's words are those the page already has for a file it fetches itself, in a tab of its own: one function says both now.
Checked
By hand, as this repository has no page tests: the built site served locally, framed by a page of another origin acting as a card, its frame sandboxed.
| Case | Result |
|---|---|
Download, the card sends progress and then failed (light at 720 px, dark at 360 px) | the row counts ("400 kB of 2.0 MB"), then the row above, "Try again"; the activity stays ready |
The file needed to build, the card sends progress and then failed (light at 720 px, dark at 360 px) | the loader with its count, then "Add your video" with the reason |
| The cases of #98, #100, #102 and #104, and the six card behaviours of #93 and #95 | unchanged |
- No page error in any run.
npm run buildpasses. Screenshots of both views looked at.
Not verified
- Not in ChatGPT: its file store has not refused a file in a run, so this was only made to happen in the stand-in.
- Chromium only.
Summary by cubic
Handles a failed message from a framing page so the play page no longer waits silently when a file it asked for did not come. For a download, the row under the stage explains and shows "Try again"; for a file needed to build the activity, the page asks the person to choose it from their computer, noting it stays in their browser. Both apply whether or not any of the file came first, and even when the question is shown already.