Autoplay page narration after a three-second delay
This commit is contained in:
+4
-1
@@ -337,6 +337,7 @@ Board key formats (`<key>`):
|
||||
|
||||
### Audio flow
|
||||
|
||||
- `Narrator.scheduleAutoplay(id, speed)` owns one 3-second timer. `_scheduleAutoplay()` in the notebook calls it on initial entry, page changes and unfolding a note. Only story/briefing/reveal screens with a bundled track qualify; folded notes and puzzles are silent. Manual play/pause/stop, leaving the page, backgrounding and disposal cancel the timer. Returning from the background does not restart a paused/stopped reading. Sound settings cancel a pending start too.
|
||||
- `Narrator` wraps one `AudioPlayer` plus `audio_session` (speech configuration). `toggle(id, speed)` loads the track, seeks when finished, sets speed and plays; `pause`/`stop` are idempotent.
|
||||
- `label`, `status` and `passage` drive the `audio()` row; `passage` is highlighted inside the leaf text by `reading(text)` using cue timings.
|
||||
- Narration stops on route change and when the app backgrounds; the player is disposed with `Notebook`.
|
||||
@@ -345,7 +346,7 @@ Board key formats (`<key>`):
|
||||
### Environmental audio
|
||||
|
||||
- `Ambience` owns a separate looping player. `soundscapeFor(index)` maps cottage/home to cottage air, boat/anchor/bell to harbour water, bridge to flowing water and tower discoveries to wind. Home, contents, daily and practice screens are silent.
|
||||
- `_syncAtmosphere()` follows navigation, narration and app lifecycle. Story ambience defaults on and resumes on foregrounding; narration stays opt-in. Muting/backgrounding stops it; scene transitions and volume changes fade over 240 ms.
|
||||
- `_syncAtmosphere()` follows navigation, narration and app lifecycle. Story ambience defaults on and resumes on foregrounding; narration starts 3 seconds after opening a narrated page. Muting/backgrounding stops it; scene transitions and volume changes fade over 240 ms.
|
||||
- Environmental gain is `0.4 × saved volume`, reduced to one quarter while narration plays or loads. Both players share the speech audio session; the environmental player disables automatic session activation to avoid competing with narration. Audio interruptions/headphone removal use just_audio interruption handling.
|
||||
- A serial queue and revision guard discard stale requests while loading/fading. Missing soundscapes never block narration or puzzles. `AmbienceOutput` allows race, fade, failure and lifecycle tests without a device backend.
|
||||
- `scripts/render_ambience.py` deterministically renders four original 24-second PCM16/24 kHz loops offline. `assets/audio/ambience_manifest.json` records seeds/checksums. `scripts/check_soundscape_assets.py` checks bundling, PCM format, levels and loop boundaries.
|
||||
@@ -363,6 +364,8 @@ Board key formats (`<key>`):
|
||||
|
||||
| File | Covers |
|
||||
| --- | --- |
|
||||
| `test/narration_autoplay_test.dart` | Exact 3-second delay, one start per visit, cancellation/replacement, recorded-page eligibility, unfolding notes and backgrounding |
|
||||
| `integration_test/autoplay_test.dart` | Real-device delayed playback of bundled WAVs, cancellation when entering a puzzle and Stop preventing restart |
|
||||
| `test/ambience_test.dart` | Scene mapping, voice ducking, mute/background stop, stale loading requests, backend failure/recovery and disposal |
|
||||
| `integration_test/soundscape_test.dart` | Real-device decoding of all 24 new continuations, bridge/narration mixing, saved mute and automatic Mara-to-narrator handoff |
|
||||
| `test/puzzle_test.dart` | 40 Java reference boards (signed 64-bit seeds), 300 graded boards, solver counts vs. exhaustive search, campaign uniqueness/no-guess, streaks, fresh progress, read-ahead, daily awards and practice levels |
|
||||
|
||||
Reference in New Issue
Block a user