---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Audio player

A recording played in place, such as a meeting's audio on its notes, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `AudioPlayer`.

## When to use

- A recording played in place, such as a meeting's audio on its notes.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Audio player on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-audio-player.json --yes
```

```text
Add the Goop Audio player to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { useState } from 'react';
import { AudioPlayer } from '@/components/ui/goop/audio-player';

function VisitRecording() {
  const [playing, setPlaying] = useState(false);
  const [speed, setSpeed] = useState(1);
  return (
    <div className="flex flex-col gap-2">
      <AudioPlayer
        src="/recordings/visit.mp3"
        aria-label="Visit recording"
        duration={70}
        speed={speed}
        onSpeedChange={setSpeed}
        onPlayingChange={setPlaying}
      />
      <p className="text-sm text-muted-foreground">{playing ? 'Playing' : 'Paused'}</p>
    </div>
  );
}
```

- Fits: record, chat: body.
- In a record's property band: `<Properties variant="band"><PropertyRow label="Audio"><AudioPlayer src={url} aria-label="Recording" /></PropertyRow></Properties>`. Give `duration` when you already know the length (your server's), so it shows before the file answers.
- height, width, padding, gap, corner, text, motion: add no class for these.

## API reference

### AudioPlayer: every option

```tsx
import { AudioPlayer } from '@/components/ui/goop/audio-player';
```

### Options

- src?: string — The recording's address, given to the player's `audio` element; none, and every control is off.
- aria-label: string — The player's name for assistive technology.
- duration?: number — The length in seconds when you already know it, shown until the file says its own.
- disabled?: boolean = false — Off: every control faded and none answering.
- speeds?: readonly number[] — The speeds the menu offers, in order (default 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2).
- speed?: number — The playback speed, when you hold it; with `onSpeedChange`.
- defaultSpeed?: number = 1 — The playback speed at first, uncontrolled (default 1).
- onSpeedChange?: (speed: number) => void — Called with the speed chosen in the menu.
- onPlayingChange?: (playing: boolean) => void — Called when the recording starts (`true`) and when it stops: paused or played to its end (`false`).
- formatTime?: (seconds: number) => string — Seconds in words, for the two times and the scrubber's value (default `01:10`, `1:02:05`).
- formatSeekValue?: (time: string, duration: string) => string — What the scrubber says, from the two times in words (default `00:12 of 01:10`).
- playLabel?: string = 'Play' — The play button's name while stopped.
- pauseLabel?: string = 'Pause' — The play button's name while playing.
- muteLabel?: string = 'Mute' — The mute button's name; `aria-pressed` says whether it is on.
- seekLabel?: string = 'Seek' — The scrubber's name.
- speedLabel?: string = 'Playback speed' — The speed menu's heading, and the speed button's name before the speed.
- menuProps?: ComponentProps<typeof DropdownMenu> — The speed menu's root props: `open`, `defaultOpen`, `onOpenChange`, `modal`.
- menuContentProps?: ComponentProps<typeof DropdownMenuContent> — The speed menu's panel props: `container`, `side`, `align` and the rest.
- State: speed (speed / defaultSpeed / onSpeedChange)

## Keyboard

- Tab: reach play, the scrubber, mute and speed in that order
- Enter: on play: play or pause; on mute: mute or unmute; on speed: open its menu
- Space: on play: play or pause; on mute: mute or unmute; on speed: open its menu
- ArrowLeft / ArrowRight: on the scrubber: seek a second back or on
- PageUp / PageDown: on the scrubber: seek ten seconds
- Home / End: on the scrubber: to the start or the end
- ArrowUp / ArrowDown: in the speed menu: move the lit row
- Escape: in the speed menu: close, the focus back on the speed button

## Accessibility

- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Card list](/themes/meadow/components/card-list): A short list of rows inside an outline card, for what is recent, due or shared.
- [Citation](/themes/meadow/components/citation): A source's small numbered chip inside an AI answer's words, right after the claim it backs.
- [Color swatch](/themes/meadow/components/color-swatch): One colour pill, to pick a colour from a row of them or to show one on a menu's trigger.
- [Comment thread](/themes/meadow/components/comment-thread): A record's discussion: replies, reactions, resolve.
