Audio player

A player for spoken audio — episodes, talks, lessons, voice notes. Play, a seek bar with chapter marks, skip back and forward, playback speed, and a chapter list that seeks and follows playback, with optional transcript and download links. It also hooks into the OS media controls.

HTML audio element, Media Session API components/audio-player.tsxtheme · material · accent · density · font

Episode 12: Moving house

Small Rooms · 5 min 30 s
0:005:30

Installation

$ pnpm add @vamos-ui/react

The whole kit as one package — get updates by bumping the version. Add the styles to globals.css: @import "@vamos-ui/react/styles.css";

Usage

import { AudioPlayer } from "@vamos-ui/react";

<AudioPlayer
  src="/audio/episode-12.mp3"
  title="Episode 12: Moving house"
  duration={2710}
  chapters={[{ start: 0, title: "Welcome" }, { start: 312, title: "Packing" }]}
  transcriptHref="/episodes/12/transcript"
  download
/>

Keyboard anywhere in the player: Space / K play and pause, ← / → 5 s, J / L skip back / forward. The seek bar keeps its own arrow keys.

Times use the locale's digits; the seek bar reads "1:05 of 45:10".

Examples

Voice note

No title or speed button (rates={[1]}), shorter skips, no media session.

0:000:48

Translated labels

Pass labels, or put them under "audioPlayer" in your LocaleProvider messages.

Ders 3: Kesirler

0:003:20

API

AudioPlayer

PropTypeDefault
src
File URL or several sources.
string | { url, type? }[]—
title
Visible title; names the player and the media session.
string—
description
Line under the title.
ReactNode—
artwork
Cover image URL.
string—
chapters
Seconds from the start. Marks on the seek bar plus a list that seeks; the current one gets aria-current.
{ start: number; title: string }[]—
hideChapterList
Keep only the marks.
boolean—
duration
Known length (s) before metadata loads and on the server.
number—
skipBack / skipForward
Seconds for the skip buttons and J / L.
number15 / 30
rates
Speeds the speed button cycles. One value hides it.
number[][1, 1.25, 1.5, 2]
transcriptHref
Transcript link.
string—
download
Download link; true uses the source URL.
string | boolean—
mediaSession
Lock-screen / headset controls while playing; previous / next jump between chapters.
booleantrue
onTimeUpdate / onEnded / onChapterChange
Playback events; onChapterChange gets the chapter index.
callbacks—
audioRef
The audio element.
Ref<HTMLAudioElement>—
labels
Dictionary namespace "audioPlayer".
Partial<AudioPlayerLabels>—

chapterAt(chapters, time)

PropTypeDefault
returns
Index of the chapter at a time (-1 before the first).
number—