Skip to content

feat(play): a video from the chat plays from its link at once, and is fetched whole only for Download (#92) - #93

Merged
alekswebnet merged 5 commits into
mainfrom
feat/play-from-link
Nov 23, 2026
Merged

alekswebnet merged 5 commits into
mainfrom
feat/play-from-link

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #92. Part of missing-elements/h5p-toolkit#210.

A video or a recording attached in a chat now plays in the play page at once, from its link, instead of after the whole file has come. The whole file is fetched only when the person presses Download.

For the page that frames this one

All optional; a framing page that sends files as before is served as before.

Message Way What it does
{ type: 'links', links: { 'clip.mp4': 'https://…' } } to the page A video's or a recording's address instead of its bytes. The activity is built with it left there (h5p-author 0.16.0's linked) and plays at once. A picture, or an address that is not http(s), is left out.
{ type: 'needs-bytes', names } from the page Download was pressed on a preview: send the files' bytes, as files. progress messages meanwhile are drawn under the stage. Sent once, however often Download is pressed.
files, while a preview plays to the page Asked for or not, they make the package with the files in it, and the activity plays on. It is saved only where Download was pressed; sent unasked, they make Download a link to it.
files, once the package with its files in it plays to the page Change nothing: the activity is not started again.
built from the page Not sent for a preview, since its address expires. Sent once, when the package with the files in it is built.

What a person sees

  • The video plays at once. In a framed test, ready 1.1 s after the page opened. Under the stage: "Interactive Video · its video plays from the chat", not a size.
  • Download of a preview: the button says "Preparing…", and a row under the stage shows "Getting your video for the download… 1.0 MB of 2.1 MB" with a bar, while the activity keeps playing. The person can choose the file from their computer instead. Then the package is built with the file in it, saved, and given to the framing page; the row goes and the size shows.
  • Nothing is saved that was not pressed for, and one package is saved for one press.
  • No flash of "Add your video" when the framing page holds the file: framed, the question waits 1.2 s for its answer, an address or a count of a file on its way, with the loader showing. Where nothing comes, it appears as before.
  • The activity's own frame has square corners (owner's review): the stage rounded its corners in every state and cut the activity's. It now rounds only what the page draws there: the loader, the question for a file, a problem.
  • The author pin moves to 0.16.0.

Review

A review of the first commit found these, fixed in the second; the first two cubic found too.

  • Files sent unasked while a preview played saved a download nobody pressed for.
  • Files from the person and from the framing page at once built and saved two packages.
  • A file that came after the whole package was built started the activity again under the person.
  • "Try again" after a build that failed asked the framing page for bytes the page already held.
  • A count of a file on its way, sent while the question was held back, was dropped, and the question flashed up.
  • An address given while a build with every file was running started that build again.
  • The preview's Download linked to #download, a damaged link where opened in a new tab; it links to the page itself.

Testing

By hand, as this repository has no page tests: the built site served locally and framed by a page of another origin acting as the card, with a store on a third origin that answers for parts and sends no CORS header to a video element.

  • Light and dark at 720 px, light at 360 px: the activity reaches ready in 1.0–1.3 s. The player's only request to the store is bytes=0-, a request for part of the file; nothing is fetched whole before Download.
  • Download answered by the card: one needs-bytes; the count drawn; one package with the video saved, 6.3 MB, as construction-site-walkthrough.h5p; one built; the activity still ready, never started again.
  • Download pressed twice, then the file chosen from the computer while the card still brings its copy: one needs-bytes, one package saved, one built, and nothing happens when the card's copy comes.
  • A card that sends the file unasked after the address: nothing saved, no row, one built, Download a link to the 6.3 MB package, which a press then saves.
  • A card that sends no address, only the file with its count: fetching, then building, then ready; the question is never shown.
  • With no answer at all: "Add your video" after the wait, and a file given still builds and plays; the ready and problem states as in feat(play): a stage with a drawn loader, a file's progress and designed states (#90) #91.
  • No page error in any run. pnpm build and pnpm typecheck pass. Screenshots of each state looked at.

Not verified

  • Not in ChatGPT: the card has to send links and answer needs-bytes first, the next step of h5p-toolkit#210.
  • A build of the package to keep that fails, and its "Try again": nothing in the tests made that build fail.
  • A link that expires while the activity is open (under an hour on ChatGPT) is not handled here: the video would stop loading. To do with the card, which can ask ChatGPT for a fresh one.
  • Whether the browser saves the file from inside a chat's card frame; where it does not, the card has the file from built.
  • A framing page that never answers needs-bytes leaves "Preparing…" and the row, with the choice of the file from the computer.
  • Chromium only.

Summary by cubic

A video or a recording attached in a chat now plays in the play page immediately, from the address the framing page provides, instead of after the whole file has downloaded. The whole file is fetched only when the person presses Download.

For the framing page

  • A links message gives a video's or a recording's address instead of its bytes; the activity is built with it left in and plays at once. A picture, or an address that is not http(s), is left out.
  • Download sends needs-bytes for the preview's files, and the page draws progress under the stage while the activity plays on.
  • Files sent unasked only enable the Download link: nothing is saved or shown without Download pressed, one package is built at a time, and a file that arrives late does not restart the activity or take the place of one being built into a download.
  • built is not sent for a preview, since its address expires; it is sent once the package with the files in it is built.

What a person sees

  • The video starts in about a second; under the stage, "its video plays from the chat" replaces the size.
  • Download says "Preparing…" and a progress row shows how much of the file has come, or the person can choose the file from their computer instead.
  • If a build for Download fails, "Try again" builds from the files already brought, without asking for them again.
  • The "Add your video" question waits for the framing page to answer, so it does not flash up.
  • @missing-elements/h5p-author moves to 0.16.0.

Written for commit ae1a864. Summary will update on new commits.

View guided diff Turn on auto-fix

… fetched whole only for Download (#92)

The page that frames the play page can give a video's or a recording's address instead of its
bytes ({ type: 'links' }). The activity is built with it left there (h5p-author 0.16.0's linked)
and plays at once. Such a package is a preview, its address expiring, so Download asks the
framing page for the bytes ({ type: 'needs-bytes' }), shows them coming under the stage while the
activity plays on, builds the package with the file in it, saves it and sends it as built. While
a framing page may still answer, the question for the person's file waits a moment, so it does
not flash up. The author pin moves to 0.16.0.
@socket-security

socket-security Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​missing-elements/​h5p-author@​0.15.0 ⏵ 0.16.083 +4100100 +196 +180

View full report

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/h5p/play/play-page.ts Resolved
Comment thread src/h5p/play/play-page.ts Resolved
Comment thread README.md Resolved
… time, and a late file does not start the activity again (#92)

Found in a review of the change:

- Files the framing page sent while a preview played, unasked, saved a download nobody pressed for. They now make Download a link to the whole package, with nothing shown.
- Files from the person and from the framing page at once built and saved two packages. One is built at a time.
- A file that came after the package with its files in it was built, from a framing page still bringing what the person chose themselves meanwhile, started the activity again. It now changes nothing.
- 'Try again' after a build that failed asked the framing page for bytes the page already held.
- A count of a file on its way, sent in the moment the question for the file is held back, was dropped, so the question flashed up before the count.
- An address given while a build with every file was running started that build again.
- The preview's Download linked to '#download', a damaged link where opened in a new tab. It links to the page itself.
- A build that failed is told a screen reader, and its bar goes.
The stage rounded its corners in every state, and so cut the corners of the activity playing in it. It rounds only what the page itself draws there: the loader, the question for a file, a problem.
…not take the place of the one it is built from (#92)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

play: a video from the chat plays from its link at once, and is fetched whole only for Download

1 participant