WIP read aloud keeps playing across chats
This commit is contained in:
+46
-6
@@ -16,17 +16,52 @@ they are saved on the device.
|
||||
- `flutter_tts_speech_engine.dart`: the `flutter_tts` implementation. The rate
|
||||
is a multiplier (1.0 = normal); Apple platforms get half of it on their 0..1
|
||||
scale. Linux reports unsupported, so the button and section are hidden.
|
||||
- `speech_controller.dart`: the app's single reader (`speechController`, a fake
|
||||
in tests via `debugSpeechController`). State changes notify the controller;
|
||||
the spoken word is the separate `word` notifier. Stops on `hidden`, `paused`
|
||||
or `detached` (not `inactive`, which is only a lost focus).
|
||||
- `speech_controller.dart`: the reader. State changes notify the controller;
|
||||
the spoken word is the separate `word` notifier and the reading's
|
||||
conversation (`SpeechReading`: chat id and name) the `reading` notifier.
|
||||
Stops on `hidden`, `paused` or `detached` (not `inactive`, which is only a
|
||||
lost focus): the phone app backgrounded keeps that behaviour.
|
||||
- `app_speech.dart`: the app's single reader (`speechController`, a fake in
|
||||
tests via `debugSpeechController`), `speechControllerIfCreated` for code that
|
||||
only stops or relabels, and `speechReading`, the app-level listenable the
|
||||
avatars and the global control follow.
|
||||
- `speech_document.dart`: Markdown to sentences, with each spoken character's
|
||||
part and source offset. Code blocks (``` and ~~~) are "Code block.", tables
|
||||
"Table." then cells; rules are skipped.
|
||||
- `chat_markdown_speech.dart`: highlight spans and the reveal scroll for
|
||||
`ChatMarkdownView`.
|
||||
- Reader ids are `<sessionId>/<row id>` so a chat that closes or is swapped
|
||||
for another stops only its own reply (`stopScope`).
|
||||
- Reader ids are `<sessionId>/<row id>`; `SpeechOrigin` (put by the thread
|
||||
view) gives Read aloud the chat id and name when a reading starts.
|
||||
|
||||
## Keeps reading across chats
|
||||
|
||||
The reader belongs to the app, not the thread view: switching chats or panes,
|
||||
opening the chat list or another destination keeps the reply reading, and
|
||||
reopening the chat shows its Pause/Stop again. A reading ends when it is
|
||||
stopped (the reply's Stop or the global one), finishes, another reply starts,
|
||||
its chat is closed (`/close`, the row's Close, or a refreshed row closed
|
||||
elsewhere) or deleted (gone from a successful list read, which includes its
|
||||
machine being removed), and when the app closes or is backgrounded.
|
||||
|
||||
- Indicator: `chatSessionActivityBadge(speaking:)` draws
|
||||
`ChatSpeakingGlyph` (three animated bars; a still speaker under reduced
|
||||
motion) in the avatar's bottom-right badge, ahead of the operator wait, the
|
||||
running spinner and the background-task count. `ChatSessionAvatar` (list,
|
||||
quick switch, phone chat stack, pane header) and `ChatCompactAvatar`
|
||||
(compact sidebar) follow `speechReading`.
|
||||
- Global stop: `ChatSpeakingControl`, "Speaking · <chat>" (or "Paused") with
|
||||
Stop speaking, sits above the composer of the active pane (`pasteTarget`)
|
||||
of any chat, so one copy shows whatever the layout. It uses the design's
|
||||
panel fill, frame and corner tokens.
|
||||
- Servers: federated chat ids carry their machine, so moving between machines
|
||||
in the combined list keeps reading. Switching the server profile (native)
|
||||
remounts `PipelinesApp`, whose dispose stops the reader; on the web a server
|
||||
switch loads another page, which ends speech.
|
||||
- Detached windows are separate processes (desktop) or browser windows (web),
|
||||
each with its own reader: speech belongs to the window that started it,
|
||||
shows only there, and stops when that window closes.
|
||||
- Web: the utterance is held by `WebSpeechEngine`, owned by the app reader,
|
||||
never by a widget.
|
||||
|
||||
## Platform notes
|
||||
|
||||
@@ -49,7 +84,12 @@ Tests (fake engine): `test/features/chat/speech/`,
|
||||
`test/features/chat/ui/transcript/chat_read_aloud_button_test.dart`,
|
||||
`chat_markdown_read_aloud_test.dart`,
|
||||
`test/features/chat/conversation/chat_thread_read_aloud_test.dart`,
|
||||
`test/features/chat/ui/sessions/chat_speaking_badge_test.dart`,
|
||||
`chat_sessions_speech_test.dart`,
|
||||
`test/features/settings/settings_read_aloud_section_test.dart`.
|
||||
|
||||
Captures (`speech=fake`, Terminal and Classic, wide and phone) show the badge
|
||||
on the reading chat after switching to another one, and the global control.
|
||||
|
||||
Not verified on a device: real speech output, word boundaries and voices on
|
||||
Android, macOS and browsers.
|
||||
|
||||
Reference in New Issue
Block a user