Skip to content
Back

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-player
Claude Sonnet 4.5

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.

Preparing Ava's voice
The code is part of Oxyn Pro

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.

Get Pro

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

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.

Terminal
oxyn add speech-player

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Reading

Reading with Ava, word by word.

Claude Sonnet 4.5

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.

Preparing Ava's voice
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Plain

Inside a chat column, full-contrast text (Oxyn extra).

Claude Sonnet 4.5

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.

Preparing Leo's voice
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Idle

The action row before Read aloud.

Claude Sonnet 4.5

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.

0:000:14
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Failed

Couldn't generate audio, with Retry.

Claude Sonnet 4.5

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.

Preparing Ava's voice
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

SpeechPlayer

PropTypeDefaultDescription
nowrequiredClockMs—Host clock.
autoplaybooltrueOpen the player and start reading on mount.
variantString"card"`card` (bordered) or `plain` (inside a chat column).
failboolDefault::default()The first prepare fails (Retry demo).
karaokebooltrueDim the words still to come (karaoke); off keeps the reply in full contrast.
voiceusizeDefault::default()Starting voice (0 Ava, 1 Leo, 2 Maya, 3 Noah).

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
TabRead aloud and actions, or play, the bar, speed, voice and Stop reading
EnterorSpaceRead aloud starts reading; play pauses and resumes
←or→On the bar, two seconds back or forward
Page upordown · HomeorEndTen seconds, or the ends
SpaceorKOn the bar, play or pause
↑or↓ · Enter · EscapeIn 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.

TransitionDurationEasing
Prepare640 ms (PREP_MS)—
Word highlightfollows playback positionstep
Row ↔ player swap160 ms crossfadeease-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 SpeechPlayer from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: AiKitView in oxyn_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.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI