useAudioPlayer

Audio
stable

Headless audio player composable. A typed wrapper around useMediaPlayer that exposes a typed `audioRef` (HTMLAudioElement) instead of the generic HTMLMediaElement, and reserves a stable extension point for future audio-specific features such as waveform analysis, Web Audio AnalyserNode wiring, and AudioWorklet pipes.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useAudioPlayer is a thin typed adapter — all runtime logic lives in useMediaPlayer. Use this composable when building a custom audio UI that needs a properly typed `HTMLAudioElement` ref; use useMediaPlayer directly when the element type is dynamic.

Interfaces consommées

IUseOrigamAudioPlayerOptions
IAudioPlayerState
IAudioPlayerMethods

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

options
IUseOrigamAudioPlayerOptions
{}
Optional configuration. Accepts `audioRef` (bring your own ref), `autoplay`, `muted`, `loop`, and `preload`. All fields are optional.

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

audioRef
Template ref to bind to the native `<audio>` element. If `options.audioRef` was provided it is returned as-is; otherwise a new ref is created.
state
Reactive playback state: playing, paused, currentTime, duration, buffered, volume, muted, ready, loading, error, playbackRate, remoteAvailable, remoteState.
methods
Imperative controls: play, pause, toggle, seek, setVolume, toggleMute, load, skipBackward, skipForward, setPlaybackRate, requestRemotePlayback, stopRemotePlayback.

Usage

Exemples

Extraits de code prêts à coller.

Minimal headless audio player

vue

Using OrigamAudio (recommended)

vue