Add browser playtest and improve library, media and input

Bundle web bootstrap, icons, local font fallbacks and hosting instructions.
Add optimized WebP/MP3 packaging, asset checks and a browser narration
regression tool. Support browser audio handoff and ad-free explained hints.

Refresh the responsive bookshelf and reduce unnecessary app, narration and
paper repaint work. Preserve deliberate page swipes while tolerating small
mouse movements during cell and navigation clicks.

Validation: all 77 Flutter tests pass; shell, JavaScript and Python scripts
parse; locale and web manifests are valid JSON; git diff --check passes.
This commit is contained in:
Hadrian Burkhardt
2026-11-06 03:33:26 +01:00
parent 7855aafade
commit 7e6b203a02
34 changed files with 1370 additions and 269 deletions
+101
View File
@@ -0,0 +1,101 @@
# Lumen browser playtest
This is the same Flutter game and bundled story content as the mobile app:
Mara’s notebook, The paper boat (English/German), and The Midnight Invitation.
The browser version has no advertising. Explained hints are free.
Large desktop windows keep a centered game surface up to 1280 × 800 CSS pixels
to avoid expensive full-monitor canvas rendering. Smaller and portrait viewports
keep their responsive layout. Narration
starts three seconds after opening a narrated page; browsers that block audio
may require one tap on Play.
## Hosting the ZIP
Unzip `lumen-browser-playtest.zip` into a directory on your web server and send
friends its HTTPS URL. The directory must contain `index.html`, `main.dart.js`,
`flutter_bootstrap.js`, `canvaskit/`, and `assets/` together. Do not open
`index.html` directly from the filesystem. No application backend, database,
Node.js server or Apple account is needed.
The default build is for the root of a website, for example
`https://play.example.com/`. If you want a subdirectory such as
`https://example.com/lumen/`, rebuild with:
```sh
bash scripts/build_web.sh --base-href /lumen/
```
The leading and trailing slashes matter. The packaged `index.html` base href
can also be changed to `/lumen/` before hosting an existing ZIP there.
Serve `.wasm` as `application/wasm`, `.js` as `application/javascript`, `.json`
as `application/json`, and `.mp3` as `audio/mpeg`. Enable byte-range requests
for audio (standard static-file hosting in nginx/Apache provides this).
For background-thread rendering in supported browsers, serve the game with
`Cross-Origin-Opener-Policy: same-origin` and
`Cross-Origin-Embedder-Policy: require-corp`. It also works without isolation,
using a single rendering thread. Missing files should return 404, not an HTML
fallback page. Keep the directory
layout intact. Everything needed at runtime, including Flutter’s renderer,
fonts and recordings, is included; there is no dependency on a font/renderer CDN.
For updates, replace the whole build together. Serve `index.html`,
`flutter_bootstrap.js`, `flutter.js`, and `main.dart.js` with
`Cache-Control: no-cache`. Use revalidation for assets too unless you version
their URLs. This build does not install an offline service worker. Testers need
a connection to load new pages, pictures and recordings.
## Tell your testers
- Open the link in Safari on iPhone/iPad or Chrome on Android/computer.
- Choose a book from the shelf. Tap **Play this reading** on a narrated page to
hear the recorded voices if your browser blocks the automatic three-second
start. Pause, replay and speed controls remain available. Atmosphere depends on the browser permitting audio.
- Tap puzzle cells to cycle empty → light → crossed out. **Hint** offers a
confirmed, explained deduction without an advertisement.
- Bookmarks, puzzle marks, reading position and settings stay in that browser.
They do not sync between devices; private browsing or clearing site data can
remove them. Use a private window to start a fresh playtest.
- Report the book, page heading, device/browser and what happened when giving
feedback. Web testing covers stories, voices and gameplay; native ads and
store installation still need mobile builds.
## Build and verify
With the project’s supported Flutter SDK, Python Pillow and ffmpeg installed:
```sh
flutter pub get
bash scripts/build_web.sh
flutter test --no-pub
```
The helper builds WebAssembly with a JavaScript fallback, resolves dependencies,
emits web-only WebP artwork and MP3 audio,
verifies referenced assets,
and produces `artifacts/lumen-browser-playtest.zip`. Override `FLUTTER_BIN` to
use another SDK path. The unpacked output is `build/web/`.
For a local preview:
```sh
python3 -m http.server 8080 --directory build/web
```
Open `http://localhost:8080/`. Your production server should support HTTPS and
audio range requests, as described above. iPhone Safari testing on a real phone
is recommended before inviting a larger group.
### Narration handoff regression
With a dedicated Chrome instance exposing `--remote-debugging-port=9224`, run
this Node 22+ test against the built game preview:
```sh
node scripts/check_browser_narration.mjs http://localhost:8080/
```
For the Astro-hosted game, pass its `/lumen/play/` URL instead. Override
`CHROME_DEBUG_URL` if the debugger uses another port. The test creates its own
fresh browser context and checks the actual playing media URL after Next,
Previous and rapid page turns, without touching existing tabs or saved games.