Skip to content

Commit 0af17d4

Browse files
authored
Merge pull request #93 from missing-elements/feat/play-from-link
feat(play): a video from the chat plays from its link at once, and is fetched whole only for Download (#92)
2 parents 6acef1c + ae1a864 commit 0af17d4

6 files changed

Lines changed: 264 additions & 24 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 or a recording 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,8 @@ html[data-standalone] .play { padding: 1rem; }
10981098
.play-stage { display: grid; border: 1px solid var(--border); border-radius: 12px; overflow: clip; background: var(--surface); }
10991099
.play-stage > * { grid-area: 1 / 1; min-width: 0; }
11001100
.play:not([data-state="ready"]) .play-stage { aspect-ratio: 16 / 9; }
1101+
/* The activity's own frame keeps its square corners: the stage rounds only what the page draws in it. */
1102+
.play[data-state="ready"] .play-stage { border-radius: 0; }
11011103
.play .player-box { margin: 0; border: 0; border-radius: 0; }
11021104
.play:not([data-state="ready"]) .player-box { visibility: hidden; }
11031105
.play-panel { z-index: 1; display: grid; place-items: center; padding: 1.5rem 1rem; background: var(--surface); text-align: center; }
@@ -1133,18 +1135,28 @@ html[data-standalone] .play { padding: 1rem; }
11331135
.play-meta:empty { width: 6rem; height: 0.7rem; margin: 0.2rem 0; }
11341136
.play-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
11351137
.play-actions [hidden] { display: none; }
1138+
/* Download of a preview: the file's bytes coming, under the bar, while the activity plays on. */
1139+
.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); }
1140+
.play-keep[hidden], .play-keep [hidden] { display: none; }
1141+
.play-keep-text { display: grid; flex: 1 1 14rem; gap: 0.4rem; min-width: 0; }
1142+
.play-keep-label { margin: 0; font-size: 0.875rem; line-height: 1.4; overflow-wrap: anywhere; }
1143+
.play-keep .play-progress { width: 100%; }
1144+
.play-progress[data-indeterminate] span { width: 30%; opacity: 0.85; }
1145+
#download[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
11361146
.button-icon { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
11371147

11381148
@media (prefers-reduced-motion: no-preference) {
11391149
.play-spinner { animation: turn 0.8s linear infinite; }
11401150
.play-progress span { transition: width 0.3s ease-out; }
1151+
.play-progress[data-indeterminate] span { animation: slide 1.3s ease-in-out infinite; }
11411152
.play[data-state="building"] .play-panel, .play[data-state="fetching"] .play-panel {
11421153
background: linear-gradient(100deg, var(--surface) 40%, color-mix(in srgb, var(--raised) 70%, var(--surface)) 50%, var(--surface) 60%) 0 0 / 250% 100%;
11431154
animation: sheen 1.8s linear infinite;
11441155
}
11451156
.play-title:empty, .play-meta:empty { animation: breathe 1.4s ease-in-out infinite alternate; }
11461157
}
11471158
@keyframes sheen { from { background-position: 125% 0; } to { background-position: -125% 0; } }
1159+
@keyframes slide { from { translate: -100% 0; } to { translate: 340% 0; } }
11481160
@keyframes breathe { from { opacity: 1; } to { opacity: 0.45; } }
11491161

11501162
@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)