2.7 KiB
<BasicPlayer>
(no submodules)
Purpose
<BasicPlayer> is the minimal media-player surface for an
AudioPlayerPlugin. It is implemented as a thin composition over
<AudioPlayer> with the loop toggle and playback-rate input disabled,
leaving only the essential controls: play / pause / stop / seek /
volume. Use this when you want a clean, distraction-free player and
don't need the advanced playback adjustments the full player exposes.
Because it is a strict composition, every behavioural guarantee of
<AudioPlayer> — cancel-on-unmount, error surfacing, state polling —
applies here unchanged.
Features
- Forwards every relevant prop to
<AudioPlayer>. - Hides the loop toggle and playback rate input.
- Adds the
.rax-basic-playerclass (or merges it with the suppliedclassName) so theming targets are stable across the two surfaces.
Usage: Basic Example
import { AudioPlayerPlugin } from "@suaveplan/audio-fx-plugin-audio-player";
import { AudioProvider, BasicPlayer } from "@suaveplan/react-audio";
const plugin = new AudioPlayerPlugin({});
export function Card() {
return (
<AudioProvider>
<BasicPlayer plugin={plugin} src="https://cdn/short.wav" />
</AudioProvider>
);
}
Usage: Advanced Example
import { AudioPlayerPlugin } from "@suaveplan/audio-fx-plugin-audio-player";
import { AudioProvider, BasicPlayer } from "@suaveplan/react-audio";
const plugin = new AudioPlayerPlugin({});
export function MutedCard() {
return (
<AudioProvider>
<BasicPlayer plugin={plugin} className="muted-row" />
</AudioProvider>
);
}
API Reference
| Prop | Type | Default | Notes |
|---|---|---|---|
plugin |
AudioPlayerPlugin |
— | Required. |
src |
string | undef |
— | Auto-load this URL on mount. |
className |
string | undef |
— | Forwarded; merged with rax-basic-player. |
Implementation Notes
The showLoop / showPlaybackRate props on the underlying
<AudioPlayer> are fixed at false, which makes the BasicPlayer's
prop signature smaller than the full player's. There is no separate
state, no separate effect — every behavioural guarantee of the full
player applies. Pass-through is deliberately verbose (one prop at a
time) so future additions to <AudioPlayer> do not silently widen
<BasicPlayer>'s surface; new props must be added explicitly.