Native audio playback for remote files and generated speech, with composable controls, bounded skip seeking, volume, and recoverable errors.
Preview
Two tones
Eight seconds: a low tone followed by a higher tone. No speech.
In action
Compose audio playback
Generated audio playback
Eight seconds: a low tone followed by a higher tone. No speech.
This example plays a local eight-second tone file through the same base64 and mediaType adapter used for generated speech. Supply a transcript for spoken content. Replace the controls through useAudioPlayer when the surrounding interface needs a different composition.
When to use
Use it for
Supply src for a file or data with base64 and an audio mediaType for generated speech.
The default controls support play, pause, skip backward and forward, seeking, mute, and volume.
Replace children with AudioPlayerControls or application controls using useAudioPlayer inside the player.
Supply a readable transcript for spoken content. Provider generation and authorization remain application-owned.
The forwarded ref reaches the native audio element; onTimeChange can synchronize Transcription.
Source changes stop the old element and discard stale playback results. CSS-only markup uses native audio controls.
Avoid
Autoplaying generated speech without user activation.
Treating this component as a speech generation API.
Install
React package
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { AudioPlayer, AudioPlayerControls, type GeneratedSpeechAudio } from "@noorddev/vlak-react";
Per-component imports are available at @noorddev/vlak-react/components/audio-player.
Copy the source
npx @noorddev/vlak-cli add audio-player
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.