Speech playerPro
Listen to an AI answer: the reply's action row becomes a small player (play, a seek bar, speed, voice) while the word being spoken is lit up in the text.
oxyn add speech-playerLisbon in early November is mild, around 19 degrees by day, with a few short showers. Pack a light rain jacket and shoes with grip for the hills.
Start in Alfama before the crowds, take tram 28 up to Graça for the view, then walk down to the river for lunch at the market.
The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Listen to an AI reply: Read aloud swaps the action row for a compact player in the same slot, and the text follows along word by word.
When not to use
- Replays a multi-agent run on one clock: use Agent timeline instead.
- One model at a glance: use Model card instead.
- A small automation on a single rail: use AI workflow instead.
Installation
Speech player is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add speech-playerUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Reading
Reading with Ava, word by word.
Lisbon in early November is mild, around 19 degrees by day, with a few short showers. Pack a light rain jacket and shoes with grip for the hills.
Start in Alfama before the crowds, take tram 28 up to Graça for the view, then walk down to the river for lunch at the market.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Plain
Inside a chat column, full-contrast text (Oxyn extra).
Lisbon in early November is mild, around 19 degrees by day, with a few short showers. Pack a light rain jacket and shoes with grip for the hills.
Start in Alfama before the crowds, take tram 28 up to Graça for the view, then walk down to the river for lunch at the market.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Idle
The action row before Read aloud.
Lisbon in early November is mild, around 19 degrees by day, with a few short showers. Pack a light rain jacket and shoes with grip for the hills.
Start in Alfama before the crowds, take tram 28 up to Graça for the view, then walk down to the river for lunch at the market.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Failed
Couldn't generate audio, with Retry.
Lisbon in early November is mild, around 19 degrees by day, with a few short showers. Pack a light rain jacket and shoes with grip for the hills.
Start in Alfama before the crowds, take tram 28 up to Graça for the view, then walk down to the river for lunch at the market.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
SpeechPlayer
| Prop | Type | Default | Description |
|---|---|---|---|
nowrequired | ClockMs | — | Host clock. |
autoplay | bool | true | Open the player and start reading on mount. |
variant | String | "card" | `card` (bordered) or `plain` (inside a chat column). |
fail | bool | Default::default() | The first prepare fails (Retry demo). |
karaoke | bool | true | Dim the words still to come (karaoke); off keeps the reply in full contrast. |
voice | usize | Default::default() | Starting voice (0 Ava, 1 Leo, 2 Maya, 3 Noah). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Read aloud and actions, or play, the bar, speed, voice and Stop reading |
| EnterorSpace | Read aloud starts reading; play pauses and resumes |
| ←or→ | On the bar, two seconds back or forward |
| Page upordown · HomeorEnd | Ten seconds, or the ends |
| SpaceorK | On the bar, play or pause |
| ↑or↓ · Enter · Escape | In the voice menu |
Accessibility
- The player is a labelled group; the play button's name follows its state (Play, Pause, Play again, Retry, Preparing audio).
- Seeking uses a range input that reads out time and length (0:04 of 0:22).
- The polite region says what changed and that the sample is simulated.
- Dimmed upcoming words keep enough contrast; the error pairs an icon with words.
- Whichever row is hidden (actions or player) cannot be reached by Tab.
From the spec
Play/Pause names change with state; the bar is a slider with time as value text; words are not each tabbable (one jump target via the slider). Every action returns the line the polite live region announces. The focus outline shows only for keyboard focus.
Motion & interaction
The spoken word is highlighted while upcoming words stay dimmed; clicking a word jumps there. Switching voice mid-sentence resumes from the same word. Speed chip cycles 1x / 1.5x / 2x.
Timing
Everything on screen is derived from the host clock now (no timers in the component), so playback, tests and the GPUI view agree.
| Transition | Duration | Easing |
|---|---|---|
| Prepare | 640 ms (PREP_MS) | — |
| Word highlight | follows playback position | step |
| Row ↔ player swap | 160 ms crossfade | ease-out |
Reduced motion: streamed text and moves appear at their end state; progress still advances, without travel animation.
Responsive behaviour
- Read aloud and the player share one 32 px slot, so the card never changes height.
- Below 440 px the total length is hidden to give the seek bar space.
- Touch screens get a taller 36 px row.
Edge cases (spec)
The player keeps the action row height so the message does not jump. The bar is scrubbable by pointer and arrow keys. Plain variant keeps full-contrast text for chat columns. Checked at 1440, 768 and 390 px in light and dark with no text overlap. Chrome is monochrome grey; colour is semantic only (success, warning, danger, info) plus the providers' coloured brand marks.
Notes for AI
- Import
SpeechPlayerfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
AiKitViewinoxyn_gpui. - Props to set first:
now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.