Calm motion: animations on this site only fade, with no movement
AudioPlayer
Track list player
Playing a few tracks in the page: a soundtrack sampler, a voice sample, a podcast episode. It wraps the native <audio>, so the browser handles formats and the lock-screen controls.
Basic
- The play button keeps one name (
labels.play) and says whether it is playing by its pressed state. The bar is a native range (labels.seek): arrows seek, and it reads "1:23 of 3:45". v-model:timegives the time in the current track, in seconds. Write it to seek, for example from aBlessChapterListor aBlessTranscriptthat emitsseek.v-model:playingsays whether it plays. Writetrueto start it, for example when someone picks an episode in aBlessEpisodeList. A new source keeps on playing if the old one played.- With several tracks, the list picks one and playback moves on to the next when one ends.
Usage
ts
import { BlessAudioPlayer } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
tracks* | BlessTrack[] | — | |
color | "text" | "accent" | "danger" | "accent" | |
labels | Partial<{ play: string; seek: string; }> | — | |
modelValue | number | 0 | index of the current track |
playing | boolean | false | whether it plays; write it to start or stop, for example from an episode list |
time | number | 0 | the time in the current track, in seconds; write it to seek, for example from chapters |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: number] | |
play | [track: BlessTrack] | |
update:playing | [value: boolean] | |
update:time | [value: number] | |
pause | [track: BlessTrack] | |
ended | [track: BlessTrack] |