Actions

AudioPlayer

Native audio element with its own controls for play, pause, replay, seeking, and elapsed and total time.

import { AudioPlayer } from '@lostgradient/cinder';
mediaaudio
01

Overview

Reference usage

Native audio element with its own controls for play, pause, replay, seeking, and elapsed and total time.

The controls are one flat row: the filled play button, the seek slider, then the elapsed and total time (1:05 / 3:20, or 1:02:05 from an hour up) once the length is known. The arrow keys move the slider five seconds and Page Up and Page Down a tenth of the track; Home and End go to the start and the end.

Usage

svelte
<script lang="ts">
  import { AudioPlayer } from '@lostgradient/cinder';
</script>

<AudioPlayer src="https://example.com/media/briefing.mp3" label="Daily briefing" />

Guidance

Use When

  • Playing a single audio track from an https, http, or blob URL with accessible controls.

Avoid When

  • You need streaming protocols, caption authoring, or playlists — wire those separately.
Live preview

Basic audio player

02

When to use

Use when
  • Playing a single audio track from an https, http, or blob URL with accessible controls.
Avoid when
  • You need streaming protocols, caption authoring, or playlists — wire those separately.
03

Examples

Basic audio player

Play, pause, and seek from the media controls. Only https, http, and blob sources load.

Unavailable source

A source whose scheme is not https, http, or blob never loads and renders the unavailable controls.

04

Props

Props for audio-player
Name
Type
Default
Description
src required text Media source. Only https:, http:, and blob: URLs load; any other scheme renders the unavailable state.
label required text Accessible name for the player.