chatty-voice-player khai báo 3 attribute, 1 property không có attribute, 3 event, 1 slot, 6 part và 4 CSS custom property.
Import 1 module @avada/chatty-ui/elements/voice-player.js là define chatty-voice-player; chunk chỉ import element nó dùng. Prototype chuẩn: trong guide.
Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.
On this page
Overview
Voice message player: play/pause, seek track, time, playback speed and an optional download link. Arrow Left/Right on the track seek 5 seconds; Space or Enter toggles playback. Class ChattyVoicePlayer.
Attributes
Name
Property
Type
Default
Description
src
src
string
''
Validated audio URL; empty disables the controls.
duration
duration
number
0
Placeholder length in seconds until the audio reports its own.
download
download
string
''
File name; when set and src is present, a download link is shown.
Properties
Attributes also expose the properties listed in the Property column above.
Name
Type
Default
Description
strings
Partial<typeof STRINGS>
{}
translated labels; English by default.
Events
Name
Detail type
Description
play
Event
Playback started.
pause
Event
Playback paused or ended.
click
MouseEvent
Native activation of a control.
Slots
Name
Description
download-icon
Icon of the download link.
Parts
Name
Description
base
Player row.
play
Play/pause button.
track
Seek track wrapper.
time
Elapsed / duration text.
speed
Playback speed button.
download
Download link.
CSS custom properties
Name
Default
Description
--chatty-voice-player-background
–
Background.
--chatty-voice-player-color
–
Icon and text colour.
--chatty-voice-player-border-color
–
Border colour.
--chatty-voice-player-track
–
Unplayed track colour; keep 3:1 against the background.