Audio player
Installation
Learn more about how to install on our getting started docs.
<script type="module">
  import '@rhds/elements/rh-audio-player/rh-audio-player.js';
</script>Import Map Example
<script type="importmap">
  {
    "imports": {
      "@rhds/elements/": "https://www.redhatstatic.com/dx/v1-alpha/@rhds/elements@2.0.1/elements/",
    }
  }
</script>npm install @rhds/elements<script type="module">
  import '@rhds/elements/rh-audio-player/rh-audio-player.js';
</script><script type="module">
  import '@rhds/elements/rh-audio-player/rh-audio-player.js';
</script>Import Map Example
<script type="importmap">
{
  "imports": {
    "@rhds/elements/rh-audio-player/rh-audio-player.js": "./elements/rh-audio-player/rh-audio-player.js"
  },
  "scopes": {
    "./": {
      "@patternfly/pfe-core/": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/",
      "@patternfly/pfe-core/ssr-shims.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/core.js",
      "@rhds/elements/lib/": "./lib/",
      "@rhds/elements/": "./elements/",
      "@rhds/icons": "https://ga.jspm.io/npm:@rhds/icons@1.1.2/icons.js",
      "@rhds/tokens/css/": "https://ga.jspm.io/npm:@rhds/tokens@2.1.0-next.15/css/",
      "@rhds/tokens/media.js": "https://ga.jspm.io/npm:@rhds/tokens@2.1.0-next.15/js/media.js",
      "lit": "https://ga.jspm.io/npm:lit@3.2.0/index.js",
      "lit-html/directives/": "https://ga.jspm.io/npm:lit-html@3.2.0/development/directives/",
      "lit/": "https://ga.jspm.io/npm:lit@3.2.0/",
      "tslib": "https://ga.jspm.io/npm:tslib@2.7.0/tslib.es6.mjs"
    },
    "https://ga.jspm.io/": {
      "@floating-ui/core": "https://ga.jspm.io/npm:@floating-ui/core@1.6.8/dist/floating-ui.core.mjs",
      "@floating-ui/dom": "https://ga.jspm.io/npm:@floating-ui/dom@1.6.11/dist/floating-ui.dom.mjs",
      "@floating-ui/utils": "https://ga.jspm.io/npm:@floating-ui/utils@0.2.8/dist/floating-ui.utils.mjs",
      "@floating-ui/utils/dom": "https://ga.jspm.io/npm:@floating-ui/utils@0.2.8/dist/floating-ui.utils.dom.mjs",
      "@lit/reactive-element": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.4/development/reactive-element.js",
      "@lit/reactive-element/decorators/": "https://ga.jspm.io/npm:@lit/reactive-element@2.0.4/development/decorators/",
      "@patternfly/pfe-core/controllers/property-observer-controller.js": "https://ga.jspm.io/npm:@patternfly/pfe-core@4.0.2/controllers/property-observer-controller.js",
      "lit": "https://ga.jspm.io/npm:lit@3.2.0/index.js",
      "lit-element/lit-element.js": "https://ga.jspm.io/npm:lit-element@4.1.0/development/lit-element.js",
      "lit-html": "https://ga.jspm.io/npm:lit-html@3.2.0/development/lit-html.js",
      "lit-html/": "https://ga.jspm.io/npm:lit-html@3.2.0/development/",
      "tslib": "https://ga.jspm.io/npm:tslib@2.7.0/tslib.es6.mjs"
    }
  }
}
</script>Lightdom CSS
This element requires you to load "Lightdom CSS" stylesheets for styling deeply slotted elements.
<link rel="stylesheet" href="/path/to/rh-audio-player/rh-audio-player-lightdom.css">Note
Replace /path/to/ with path to the CSS file, whether local or CDN.
Usage
rh-audio-player
| Slot Name | Description | 
|---|---|
| series | optional, name of podcast series | 
| title | optional, title of episode | 
| media | html  | 
| 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 | 
|---|---|
| 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(seconds: unknown) | Seeks media a given number of secons from current elapsed time | 
| rewind(by: unknown) | Rewinds media by 15 seconds (default) | 
| forward(by: unknown) | Advances media by 15 seconds (default) | 
None
| Part Name | Description | 
|---|---|
| panel | expandable panel | 
| toolbar | main controls | 
| about | about the episode panel | 
| subscribe | subscribe panel | 
| transcript | transcript panel | 
| CSS Property | Description | Default | 
|---|---|---|
| --rh-audio-player-background-color | color of player background - | var(--rh-color-surface-lightest, #ffffff) | 
| --rh-audio-player-icon-background-color | var(--rh-audio-player-background-color) | |
| --rh-audio-player-border-color | color of player border - | var(--rh-color-border-subtle-on-light, #d2d2d2) | 
| --rh-audio-player-secondary-text-color | player secondary text color - | var(--rh-color-text-secondary-on-light, #6a6e73) | 
| --rh-audio-player-secondary-opacity | player secondary opacity used for partially faded elements - | 0.75 | 
| --rh-audio-player-range-thumb-color | color of time and volume range slider thumb - | var(--rh-color-accent-brand-on-light, #ee0000) | 
| --rh-tooltip-content-padding-block-start | padding top on tooltips - | var(--rh-space-md, 8px) | 
| --rh-tooltip-content-padding-block-end | padding bottom on tooltips - | var(--rh-space-md, 8px) | 
| --rh-tooltip-content-padding-inline-start | padding left on tooltips - | var(--rh-space-md, 8px) | 
| --rh-tooltip-content-padding-inline-end | padding right on tooltips - | var(--rh-space-md, 8px) | 
| Token | Copy | 
|---|---|
| --rh-border-radius-default |  | 
| --rh-box-shadow-md |  | 
| --rh-color-border-subtle |  | 
| --rh-color-interactive-primary-hover |  | 
| --rh-color-surface-dark |  | 
| --rh-color-surface-darkest |  | 
| --rh-color-surface-light |  | 
| --rh-color-surface-lightest |  | 
| --rh-color-text-primary |  | 
| --rh-color-text-secondary |  | 
| --rh-font-family-body-text |  | 
| --rh-font-family-code |  | 
| --rh-font-family-heading |  | 
| --rh-font-size-body-text-md |  | 
| --rh-font-size-body-text-sm |  | 
| --rh-font-size-body-text-xl |  | 
| --rh-font-size-body-text-xs |  | 
| --rh-font-size-code-md |  | 
| --rh-font-size-code-xs |  | 
| --rh-font-size-heading-xs |  | 
| --rh-font-weight-body-text-regular |  | 
| --rh-font-weight-heading-bold |  | 
| --rh-font-weight-heading-medium |  | 
| --rh-length-lg |  | 
| --rh-length-md |  | 
| --rh-letter-spacing-body-text |  | 
| --rh-line-height-body-text |  | 
| --rh-line-height-code |  | 
| --rh-line-height-heading |  | 
| --rh-size-icon-02 |  | 
| --rh-space-lg |  | 
| --rh-space-md |  | 
| --rh-space-xl |  | 
rh-audio-player-about
Audio Player About Panel
| Slot Name | 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() | 
None
| Part Name | Description | 
|---|---|
| heading | panel heading | 
| body | panel body | 
| profile | panel profile / avatar | 
None
| Token | Copy | 
|---|---|
| --rh-font-family-body-text |  | 
| --rh-font-family-heading |  | 
| --rh-font-size-body-text-xs |  | 
| --rh-font-size-heading-xs |  | 
| --rh-font-weight-body-text-medium |  | 
| --rh-font-weight-heading-medium |  | 
| --rh-letter-spacing-body-text |  | 
| --rh-line-height-body-text |  | 
| --rh-line-height-heading |  | 
| --rh-size-icon-05 |  | 
| --rh-space-lg |  | 
| --rh-space-md |  | 
rh-audio-player-subscribe
Audio Player Subscribe Panel
| Slot Name | 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() | 
None
| Part Name | Description | 
|---|---|
| heading | scrolling text overflow | 
| body | body content slot | 
| links | subscribe links | 
None
None
rh-transcript
Audio Player Transcript Panel
| Slot Name | Description | 
|---|---|
| heading | custom heading for panel | 
|  | 
 | 
| Attribute | DOM Property | Description | Type | Default | 
|---|---|---|---|---|
| heading | heading |  |  | |
| label | label |  |  | |
| lang | lang |  |  | 
| Method Name | Description | 
|---|---|
| setActiveCues(currentTime: unknown) | |
| setDuration(mediaDuration: number) | |
| scrollText() | 
| Event Name | Description | 
|---|---|
| transcriptdownload | 
| Part Name | Description | 
|---|---|
| heading | scrolling text overflow | 
| toolbar | toolbar area above cues list | 
None
| Token | Copy | 
|---|---|
| --rh-space-md |  | 
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.