Skip to content

Commit 6b75f67

Browse files
committed
feat(play): a video from the chat plays from its link at once, and is 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.
1 parent 6acef1c commit 6b75f67

6 files changed

Lines changed: 216 additions & 23 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The site of the [missing-elements](https://github.com/missing-elements) web comp
99
| `/` | The project list, the tools (the build page first, with its how-to), and a footer of links | [src/index.njk](src/index.njk); the lists are in [src/_data/site.js](src/_data/site.js) |
1010
| `/pdfjs-viewer/` | The docs of `<pdfjs-viewer-element>`, with a live preview | [src/pdfjs-viewer/](src/pdfjs-viewer/) |
1111
| `/h5p/build/` | The build page, for people: what it makes, a sample that plays, and the build of a chat's source into a `.h5p`, in the visitor's browser | [src/h5p/build/](src/h5p/build/) |
12-
| `/h5p/play/` | The play page: the activity in a link's `#source=`, built in the visitor's browser as the build page builds it, with any file of their own it names chosen there, and played with nothing beside it but its download and a link to the build page, for a chat app to show in its reply (h5p-toolkit#210); no page links to it | [src/h5p/play/](src/h5p/play/) |
12+
| `/h5p/play/` | The play page: the activity in a link's `#source=`, built in the visitor's browser as the build page builds it, with any file of their own it names chosen there or given by the page that frames it (a video as its address, played from there at once and fetched whole only for the download), and played with nothing beside it but its download and a link to the build page, for a chat app to show in its reply (h5p-toolkit#210); no page links to it | [src/h5p/play/](src/h5p/play/) |
1313
| `/h5p/create-with-ai/` | The how-to, for people: installing the skill, asking a chat, the prompts to start from, the types, and what to do when something goes wrong | [src/h5p/create-with-ai/](src/h5p/create-with-ai/) |
1414
| `/h5p/skill/` | The skill as zips to install: `h5p-author.zip`, installed once in a chat's place for skills, or attached to the message in each new chat where it has none, and `h5p-author-chatgpt.zip`, the same skill laid out as a plugin; and a page that lists them and the bundles' addresses, each in full, which no page links to | [src/h5p/skill/](src/h5p/skill/); the zips written by [vite.config.ts](vite.config.ts) |
1515
| `/h5p/bundles/` | The skill's build tool and a library bundle per content type, for a chat that runs Node but cannot reach npm; and `h5p-author-build.tar.gz`, the tool and every library in one archive, for a person to attach to a chat whose code can download nothing | written by [vite.config.ts](vite.config.ts) |

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@codemirror/state": "6.7.6",
2929
"@codemirror/view": "6.43.15",
3030
"@lezer/highlight": "1.2.5",
31-
"@missing-elements/h5p-author": "0.15.0",
31+
"@missing-elements/h5p-author": "0.16.0",
3232
"@missing-elements/h5p-libraries": "1.1.1",
3333
"@missing-elements/h5p-offline-player": "1.7.0",
3434
"@missing-elements/h5p-runtime": "1.0.2",

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/assets/site.css‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,18 +1133,28 @@ html[data-standalone] .play { padding: 1rem; }
11331133
.play-meta:empty { width: 6rem; height: 0.7rem; margin: 0.2rem 0; }
11341134
.play-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
11351135
.play-actions [hidden] { display: none; }
1136+
/* Download of a preview: the file's bytes coming, under the bar, while the activity plays on. */
1137+
.play-keep { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.625rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
1138+
.play-keep[hidden], .play-keep [hidden] { display: none; }
1139+
.play-keep-text { display: grid; flex: 1 1 14rem; gap: 0.4rem; min-width: 0; }
1140+
.play-keep-label { margin: 0; font-size: 0.875rem; line-height: 1.4; overflow-wrap: anywhere; }
1141+
.play-keep .play-progress { width: 100%; }
1142+
.play-progress[data-indeterminate] span { width: 30%; opacity: 0.85; }
1143+
#download[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
11361144
.button-icon { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
11371145

11381146
@media (prefers-reduced-motion: no-preference) {
11391147
.play-spinner { animation: turn 0.8s linear infinite; }
11401148
.play-progress span { transition: width 0.3s ease-out; }
1149+
.play-progress[data-indeterminate] span { animation: slide 1.3s ease-in-out infinite; }
11411150
.play[data-state="building"] .play-panel, .play[data-state="fetching"] .play-panel {
11421151
background: linear-gradient(100deg, var(--surface) 40%, color-mix(in srgb, var(--raised) 70%, var(--surface)) 50%, var(--surface) 60%) 0 0 / 250% 100%;
11431152
animation: sheen 1.8s linear infinite;
11441153
}
11451154
.play-title:empty, .play-meta:empty { animation: breathe 1.4s ease-in-out infinite alternate; }
11461155
}
11471156
@keyframes sheen { from { background-position: 125% 0; } to { background-position: -125% 0; } }
1157+
@keyframes slide { from { translate: -100% 0; } to { translate: 340% 0; } }
11481158
@keyframes breathe { from { opacity: 1; } to { opacity: 0.45; } }
11491159

11501160
@media (forced-colors: active) {

‎src/h5p/play/index.njk‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ csp: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' da
5252
</div>
5353
<p class="play-actions">
5454
<a class="button" id="edit" target="_blank" rel="noopener">Open in the build page</a>
55-
<a class="button button-solid" id="download" download hidden><svg class="button-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v12M7 11l5 5 5-5M5 20h14"/></svg>Download .h5p</a>
55+
<a class="button button-solid" id="download" download hidden><svg class="button-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v12M7 11l5 5 5-5M5 20h14"/></svg><span id="download-label">Download .h5p</span></a>
5656
</p>
5757
</div>
58+
{#- Download of an activity whose video plays from the chat: its bytes come first, while it plays on. -#}
59+
<div class="play-keep" id="keep" hidden>
60+
<div class="play-keep-text">
61+
<p class="play-keep-label" id="keep-label"></p>
62+
<div class="play-progress" id="keep-progress" role="progressbar" aria-label="Getting the file for the download" aria-valuemin="0" aria-valuemax="100" data-indeterminate><span id="keep-bar"></span></div>
63+
</div>
64+
<button type="button" class="button" id="keep-instead">Choose it from your computer instead</button>
65+
</div>
5866
</main>
5967
<script type="module" src="/h5p/play/play-page.js"></script>

0 commit comments

Comments
 (0)