Skip to content

feat(play): one press saves a package too big for the chat, in a tab that fetches the video itself (#102) - #103

Merged
alekswebnet merged 2 commits into
mainfrom
feat/play-save-in-tab
Nov 24, 2026
Merged

alekswebnet merged 2 commits into
mainfrom
feat/play-save-in-tab

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

After #100 a package with a big video is saved in a chat by a right-click on Download. The owner: "right-click can be replaced by button click, I need one click to download." ChatGPT's own save refused a 128 MB test file, and a package built in the card cannot be passed to a tab. But the chat's file storage answers any site, so a tab of this page can fetch the video itself and build the package again.

What a person sees now

  • In a chat, a video too big for the chat's save: one press on Download. The row says "This .h5p is about 235 MB, more than the chat saves. A new tab gets your video and saves it there." The tab opens, shows the video coming ("Getting your video for the download… 96 MB of 230 MB"), builds the package and saves it. Then: "Your .h5p is saved to your downloads, 235 MB. You can close this tab. If nothing was saved, press Download."
  • The address ran out, or the store refuses: the tab says so and offers "Choose it from your computer instead".
  • A small package in a chat, and the page outside a chat: as before.
  • The right-click hint of play: inside a chat, a package too big for the chat's save cannot be downloaded without leaving it, and links open nothing on a press #100 stays for what is left: a package whose size was not known before it was built, and a save the chat refused.

How

  • A play link may carry &links= (the files' addresses by name, JSON in base64url) and &save=1 beside #source=. The page plays from the addresses; with save it acts as if Download was pressed once the activity is ready. Both are taken out of the address bar as soon as they are read, so an address of a person's file is not left in the history.
  • With no framing page to ask, Download of an activity that plays from an address fetches the file from that address itself, counted as it comes.
  • Framed by a page that said saves and opens, where every file of the activity plays from an address and the package will weigh more than max (the preview's own package plus the sizes given for the files): Download sends { type: 'open', href } with such a link at once, while the press still lets a tab open, and fetches nothing in the frame.
  • sizes beside links is read again (play: inside a chat, a package too big for the chat's save cannot be downloaded without leaving it, and links open nothing on a press #100 took it out).
  • Download of an activity that plays from an address is a link to the same saving tab, for the browser's own menu.

To weigh

  • A link with save=1 makes the page save a file with no press. It is the package the same link would build for a press on Download, and a browser lets a page save one file unasked before it asks the person. Addresses are taken as before: http(s) only, for a video or a recording, fetched without credentials.

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 (sandboxed like a chat's: saves nothing, opens no tab), with a store on a third origin that answers any site.

Case Result
A video above max, size given, saves and opens (light at 720 px, dark at 360 px) one open with /h5p/play/#source=…&links=…&save=1, the row above, no needs-bytes; the link opened in a tab: the package saved with no press, the saved row, the address bar left with #source= only
The same tab with a slow store (light at 1000 px, dark at 390 px) "Getting your video for the download… 975 kB of 2.1 MB" with its bar and "Choose it from your computer instead", then built and saved
The same tab, the address answers 403 "Your video could not be fetched from the chat (the chat answered 403): its address may have run out. Choose it from your computer instead.", Download reads "Try again"
A video above max, no opens fetched and built in the frame, the right-click row of #100
A 2.1 MB video under max (4 MB), the package (6.3 MB) over it the tab is asked for, as above
A video at an address and a picture given as a file, above max no open: fetched and built in the frame with both, the right-click row
A video above max, opens, no size given the same: fetched and built in the frame, the right-click row
A video under max saved by the card, as in #98
A quiz: saved, refused, above max, no saves; the link cases of #100 unchanged

Not verified

  • Not in ChatGPT: whether its way to open a link keeps a fragment this long (about 1.5 kB beside the source), and whether its storage serves the whole 230 MB to a tab as it did to the card. That the storage answers any site was read from its headers for a request from this site's origin.
  • An address that has run out by the time Download is pressed: the page hands over the one it plays from, and does not ask for a fresh one.
  • A save with no press in Firefox and Safari: Chromium only here. The saved row's "press Download" is the way on where a browser saves nothing.

Summary by cubic

One press on Download now saves a package too big for the chat's own save: a new tab opens, fetches the video itself from the chat's storage, rebuilds the package, and saves it without further interaction. The tab is opened only when every file in the package plays from a network address and the package's total weight exceeds the parent's limit, not just the video's size.

  • Play links may carry &links= (file addresses by name, JSON in base64url) and &save=1; with save=1 the page saves the package with no press once the activity is ready.
  • Both parameters are removed from the address bar as soon as they are read, so a person's file addresses are not left in history.
  • In a frame that saves and opens links, Download of an over-limit package sends an open message with such a link and fetches nothing in the frame.
  • When the address has run out or the store refuses, the tab says so and offers "Choose it from your computer instead".

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

View guided diff Turn on auto-fix

… and Download of a video the chat cannot save opens such a tab with one press (#102)

@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 3 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
…dress, by the package's weight and not the video's (#102)
@alekswebnet
alekswebnet merged commit b740a1c into main Nov 24, 2026
4 checks passed
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: one press to download a package too big for the chat's save, in a tab that fetches the video itself

1 participant