Audio player
On this page
Importing
Add rh-audio-player to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-audio-player/rh-audio-player.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Lightdom CSS
This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.
Note
Replace /path/to/
with path to the CSS file, whether local or CDN.
<link rel="stylesheet" href="/path/to/rh-audio-player/rh-audio-player-lightdom.css">
Usage
rh-audio-player
An audio player plays audio clips in the browser and includes other features.
Slot Name | Summary | Description |
---|---|---|
media |
||
series |
optional, name of podcast series |
|
title |
optional, title of episode |
|
about |
optional |
|
subscribe |
optional |
|
transcript |
optional |
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
mediaseries |
mediaseries |
Audio's series name, e.g. Podcast series. |
|
|
mediatitle |
mediatitle |
Audio's title, e.g. Podcast episode title. |
|
|
layout |
layout |
Layout:
|
|
|
poster |
poster |
URL to audio's artwork |
|
|
volume |
volume |
Playback volume |
|
|
playbackrate |
playbackRate |
Playback rate |
|
|
expanded |
expanded |
|
|
|
lang |
lang |
|
|
|
color-palette |
colorPalette |
Element's color palette |
|
|
Method Name | Description |
---|---|
firstUpdated() |
|
mute() |
Mutes media volume |
unmute() |
Unmutes media volume |
pause() |
Pauses playback |
play() |
Starts or resumes playback |
seek(seconds: number) |
Seeks media to a given point in seconds |
seekFromCurrentTime() |
Seeks media a given number of secons from current elapsed time |
rewind() |
Rewinds media by 15 seconds (default) |
forward() |
Advances media by 15 seconds (default) |
Part Name | Summary | Description |
---|---|---|
toolbar |
main controls |
|
panel |
expandable panel |
|
about |
about the episode panel |
|
subscribe |
subscribe panel |
|
transcript |
transcript panel |
CSS Property | Description | Default |
---|---|---|
--rh-audio-player-text-color |
var(--rh-color-text-primary)
|
|
--rh-audio-player-range-thumb-color |
color of time and volume range slider thumb |
var(--_accent-color)
|
--rh-audio-player-range-progress-color |
var(--_accent-color)
|
|
--box-fill |
—
|
|
--rh-audio-player-secondary-text-color |
player secondary text color - |
var(--rh-color-text-primary)
|
--rh-audio-player-secondary-opacity |
player secondary opacity used for partially faded elements - |
0.75
|
--rh-icon-size |
—
|
|
--rh-audio-player-background-color |
color of player background - |
var(--_static-surface-color)
|
Token | Copy |
---|---|
--rh-size-icon-03
|
|
--rh-font-size-code-md
|
|
--rh-box-shadow-md
|
|
--rh-length-lg
|
|
--rh-length-xs
|
|
--rh-color-text-secondary
|
|
--rh-color-gray-30
|
|
--rh-color-gray-50
|
|
--rh-color-border-interactive
|
|
--rh-color-accent-brand
|
|
--rh-border-width-md
|
|
--rh-color-border-subtle
|
|
--rh-color-surface-dark
|
|
--rh-color-interactive-primary-hover
|
|
--rh-color-surface-light
|
|
--rh-font-size-body-text-xs
|
|
--rh-font-size-body-text-xl
|
|
--rh-line-height-heading
|
|
--rh-font-family-heading
|
|
--rh-font-size-heading-xs
|
|
--rh-font-weight-heading-medium
|
|
--rh-font-size-body-text-sm
|
|
--rh-font-weight-body-text-regular
|
|
--rh-letter-spacing-body-text
|
|
--rh-font-family-code
|
|
--rh-font-size-code-xs
|
|
--rh-line-height-code
|
|
--rh-size-icon-01
|
|
--rh-space-lg
|
|
--rh-font-size-body-text-md
|
|
--rh-line-height-body-text
|
|
--rh-font-family-body-text
|
|
--rh-color-text-primary
|
|
--rh-color-surface-lightest
|
|
--rh-color-surface-darkest
|
|
--rh-border-radius-default
|
|
--rh-space-md
|
|
--rh-size-icon-02
|
|
--rh-length-md
|
|
--rh-space-xl
|
|
rh-audio-player-about
Audio Player About Panel
Slot Name | Summary | Description |
---|---|---|
heading |
custom heading for panel |
|
|
panel content |
|
profile |
|
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
label |
label |
Default label content |
|
|
series |
mediaseries |
Series this track belongs to, if applicable |
|
|
mediatitle |
mediatitle |
Title of audio track |
|
|
Method Name | Description |
---|---|
scrollText() |
Part Name | Summary | Description |
---|---|---|
heading |
panel heading |
|
body |
panel body |
|
profile |
panel profile / avatar |
CSS Property | Description | Default |
---|---|---|
--rh-avatar-size |
var(--rh-size-icon-05, 48px)
|
Token | Copy |
---|---|
--rh-size-icon-05
|
|
--rh-letter-spacing-body-text
|
|
--rh-font-size-body-text-xs
|
|
--rh-line-height-body-text
|
|
--rh-font-family-body-text
|
|
--rh-font-weight-body-text-medium
|
|
--rh-font-size-heading-xs
|
|
--rh-font-family-heading
|
|
--rh-font-weight-heading-medium
|
|
--rh-line-height-heading
|
|
--rh-space-md
|
|
--rh-space-lg
|
|
rh-audio-player-rate-stepper
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
playback-rate |
playbackRate |
Playback rate |
|
|
disabled |
disabled |
Playback rate |
|
|
label |
label |
Playback rate |
|
|
Token | Copy |
---|---|
--rh-font-size-code-md
|
|
--rh-font-family-code
|
|
rh-audio-player-scrolling-text-overflow
Audio Player Scrolling Text Overflow
Slot Name | Summary | Description |
---|---|---|
|
inline text to scroll if wider than host |
Method Name | Description |
---|---|
firstUpdated() |
|
stopScrolling() |
|
startScrolling() |
CSS Property | Description | Default |
---|---|---|
--rh-audio-player-scrolling-text-overflow-background-color |
var(--rh-color-surface-darkest, #151515)
|
Token | Copy |
---|---|
--rh-color-surface-lightest
|
|
--rh-color-surface-darkest
|
|
rh-audio-player-subscribe
Audio Player Subscribe Panel
Slot Name | Summary | Description |
---|---|---|
heading |
custom heading for panel |
|
|
panel content |
|
link |
link to subscribe to podcast |
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
heading |
heading |
|
|
|
label |
label |
|
|
Method Name | Description |
---|---|
scrollText() |
Part Name | Summary | Description |
---|---|---|
heading |
scrolling text overflow |
|
body |
panel content |
|
links |
subscribe links |
Token | Copy |
---|---|
--rh-font-family-heading
|
|
--rh-font-size-heading-xs
|
|
--rh-line-height-heading
|
|
--rh-space-lg
|
|
--rh-letter-spacing-body-text
|
|
--rh-font-size-body-text-xs
|
|
--rh-font-weight-heading-medium
|
|
--rh-space-md
|
|
rh-cue
Media Transcript Cue
Slot Name | Summary | Description |
---|---|---|
|
text of cue |
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
start |
start |
Start time, in mm:ss.ms |
|
|
end |
end |
End time, in mm:ss.ms |
|
|
text |
text |
Text of this cue. Overridden by |
|
|
voice |
voice |
Name of voice speaking this text. Overridden by |
|
|
active |
active |
Whether this cue is active right now |
|
|
Event Name | Description |
---|---|
cueseek |
when user clicks a time cue |
Token | Copy |
---|---|
--rh-font-size-body-text-md
|
|
--rh-font-family-heading
|
|
--rh-font-family-code
|
|
rh-transcript
Audio Player Transcript Panel
Slot Name | Summary | Description |
---|---|---|
heading |
custom heading for panel |
|
|
|
Attribute | DOM Property | Description | Type | Default |
---|---|---|---|---|
heading |
heading |
|
|
|
label |
label |
|
|
|
lang |
lang |
|
|
|
menulabel |
menuLabel |
|
|
|
downloadlabel |
downloadLabel |
|
|
|
autoscrolllabel |
autoscrollLabel |
|
|
Method Name | Description |
---|---|
setActiveCues() |
|
setDuration(mediaDuration: number) |
|
scrollText() |
Part Name | Summary | Description |
---|---|---|
heading |
scrolling text overflow |
|
toolbar |
toolbar area above cues list |
CSS Property | Description | Default |
---|---|---|
--rh-icon-size |
—
|
Token | Copy |
---|---|
--rh-size-icon-03
|
|
--rh-border-width-md
|
|
--rh-color-border-interactive
|
|
--rh-font-family-heading
|
|
--rh-space-md
|
|
--rh-font-size-heading-xs
|
|
--rh-line-height-heading
|
|
--rh-space-lg
|
|
--rh-letter-spacing-body-text
|
|
--rh-font-size-body-text-xs
|
|
--rh-font-weight-heading-medium
|
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.