Lotus
Type to search documentation.

AudioPlayer

Present audio with metadata and accessible playback controls.

AudioPlayer builds a themed control surface around the native audio element.

Import

mdx
import { AudioPlayer } from '@prosefly/astro-components';

Basic Usage

mdx
<AudioPlayer
album="Prehistoric Sessions"
artist="NASA"
artwork="/images/cover.webp"
duration="11:06"
src="/audio/briefing.mp3"
title="STS-133 FD11 Mission Status Briefing"
/>

Pass a number of seconds to duration to let the component format it. A string is displayed as written until the browser discovers a finite duration from the audio metadata.

The enhanced controls include playback-speed cycling, 15-second replay, 30-second forward, mute, and Media Session integration where supported. Native audio controls remain available as the no-JavaScript fallback.

Multiple Sources

Use source children when an audio file is available in multiple formats.

mdx
<AudioPlayer artist="Artist" title="Song title">
<source src="/audio/song.mp3" type="audio/mpeg" />
<source src="/audio/song.ogg" type="audio/ogg" />
</AudioPlayer>

Props

The component also accepts native audio attributes such as src, autoplay, loop, muted, and crossorigin.

PropTypeNotes
titlestringVisible track or episode title.
artiststringArtist, speaker, or creator.
albumstringOptional collection or album.
artworkstring | ImageMetadataArtwork URL or imported Astro image.
durationstring | numberInitial label or duration in seconds.
preload'none' | 'metadata' | 'auto'Defaults to metadata.

Last updated Sep 10, 2026

Contributors