@molecule/app-audio-player-solid
v1.1.0
Published
HTML5 audio player chrome — play/pause, scrub, time, mute toggle, optional visualizer slot
Readme
@molecule/app-audio-player-solid
Solid HTML5 audio player chrome — play/pause, scrub bar, elapsed/total time,
and a mute toggle, over a hidden <audio> element. Use for podcasts,
voice notes, music previews, narrated lessons.
Exports <AudioPlayer> — the Solid counterpart of
@molecule/app-audio-player-react: the same props (React names) and the
same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { AudioPlayer } from '@molecule/app-audio-player-solid'
export function Player() {
return (
<AudioPlayer
src="/audio/episode-42.mp3"
title="Episode 42: Getting Started"
subtitle="The Molecule Podcast"
onPlay={() => console.log('playing')}
onEnded={() => console.log('finished')}
/>
)
}Type
feature
Installation
npm install @molecule/app-audio-player-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-jsAPI
Interfaces
AudioPlayerProps
Props accepted by the {@link AudioPlayer} component.
interface AudioPlayerProps {
/** Audio source URL (a file, a stream or a data URI). */
src: string
/** Optional title / track name. */
title?: JSX.Element
/** Optional artist / source label. */
subtitle?: JSX.Element
/** Optional waveform / visualizer slot rendered above the controls. */
visualizer?: JSX.Element
/**
* WebVTT captions file URL. When set, the player loads it on the media
* element's captions `<track>` and shows the current caption under the
* controls, in a polite live region that screen readers announce. Without
* it the track is empty and no caption line is shown.
*/
captions?: string
/** BCP 47 language of the captions (the track's `srclang`). */
captionsLang?: string
/**
* Human-readable name of the captions track. Defaults through i18n
* (`audio.captions`, English "Captions").
*/
captionsLabel?: string
/** Initial muted state. */
defaultMuted?: boolean
/** Autoplay (browser may block). Passed to the `<audio>` element. */
autoPlay?: boolean
/** Called when the media starts playing. */
onPlay?: () => void
/** Called when the media is paused. */
onPause?: () => void
/** Called when the media reaches its end. */
onEnded?: () => void
/** Extra classes on the outer wrapper. */
className?: string
}Functions
AudioPlayer(props)
HTML5 audio player chrome — play/pause, scrub, time, mute, optional visualizer slot. Use for podcasts, voice notes, music previews, narrated lessons.
function AudioPlayer(props: AudioPlayerProps): JSX.Elementprops— Component props (see {@link AudioPlayerProps}).
Returns: The rendered audio player.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-solid^3.5.0@molecule/app-ui^1.0.1@molecule/app-ui-solid^1.1.0solid-js^1.8.0
Runtime Dependencies
@molecule/app-solid@molecule/app-ui@molecule/app-ui-solidsolid-js
There is NO volume slider — only a mute toggle; and no playback-rate
or skip controls. The optional visualizer prop is a free-form node
slot rendered above the controls (bring your own waveform). autoPlay is
passed to the <audio> element and is routinely blocked by browsers until
user interaction — never rely on it. Duration renders 0:00 until
loadedmetadata fires (preload="metadata"). Translations come from the
companion @molecule/app-locales-audio-player locale bond.
Translations
Translation strings are provided by @molecule/app-locales-audio-player.
