Audio embed player

Our embed player is the best way to add narrations and other audio to your web pages.

Want help?

Quick start

To embed a TYPE III AUDIO narration, add the embed code with no custom parameters.

When your web page loads, the embed player will:

  1. Query the TYPE III AUDIO narration database for the current page URL.
  2. If a narration is found, load that narration.
  3. If a narration is not found, create a new narration.

It's that easy.

<script
  type="module"
  crossorigin
  src="https://embed.type3.audio/player.js"
></script>
<type-3-player></type-3-player>

Here's how the player looks by default:

Features

Optional behaviours you can switch on with attributes.

Listen to this page

Instead of showing the player by default, you can show a smaller "Listen to this page" button.

When the user clicks the button, playback will begin and the full player will show.

Once the audio duration is known, the button label automatically includes the listening time rounded to the nearest minute, for example Listen to this page (12 min).

<type-3-player
  listen-to-this-page="true"
>
</type-3-player>

Floating player

With sticky="true", the player floats at the bottom of the screen once playback starts and the inline player scrolls out of view. With sticky="always", the inline player is disabled and the floating player is always shown.

A web page with the TYPE III AUDIO floating player fixed to the bottom of the browser window.

While the floating player is visible, .t3a-sticky-player-visible is added to the <body> element.

Header play buttons

With header-play-buttons="true", the player adds a "Play" button to the left of any heading whose text exactly matches a chapter title from your audio.

A page heading with a circular play button to its left.

You'll need to style the button yourself:

/*
  Styles for the TYPE III AUDIO player "heading play button" feature.
*/

/* Heading play button should not be shown on small screens */
.t3a-heading-play-button {
  display: none;
}

/* Set minimum width at which heading play button should be shown */
@media screen and (min-width: 850px) {
  .t3a-heading-play-button {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    margin-left: -34px;
    margin-right: 10px;
    border-radius: 9999px;
    border: none;
    width: 1.5rem;
    height: 1.5rem;
    outline: none;
    cursor: pointer;
    transform: translate(0, 0);
    z-index: 10;

    /* Colour of the play button */
    background-color: #ddd;
    /* Colour of the play button icon. */
    color: #fff;
  }

  .t3a-heading-play-button:hover {
    /* Colour of the play on hover */
    background-color: #333;
  }

  .t3a-heading-play-button:focus {
    outline: none;
  }

  .t3a-heading-play-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 2px;  
  }

  /* Refine this to match the dimensions of your heading typeface */
  h1 .t3a-heading-play-button { margin-top: 9px } 
  h2 .t3a-heading-play-button { margin-top: 9px } 
  h3 .t3a-heading-play-button { margin-top: 3px }
}

To show the buttons only after playback has started:

.t3a-heading-play-button {
  display: none;
}

.t3a-playback-started .t3a-heading-play-button {
  display: block;
}

If link-to-timestamp="true", the player scans the page for strings like [HH:MM:SS], [H:MM:SS], and [MM:SS] and turns them into links that seek the player to that timestamp and start playback.

To restrict the search, set link-to-timestamp-selector to any valid CSS selector.

If a page has multiple <type-3-player> elements, set link-to-timestamp="false" on the ones you don't want to seek.

Embed an MP3

To embed a specific MP3 with your own metadata — for example, audio that isn't in the TYPE III AUDIO narration database — set mp3-url and the related attributes directly.

<script
  type="module"
  crossorigin
  src="https://embed.type3.audio/player.js"
></script>

<type-3-player
  mp3-url="https://dl.type3.audio/episodes/radio-bostrom/11335090-base-camp-for-mount-ethics-2022.mp3"
  author="Nick Bostrom"
  title="Base Camp for Mount Ethics"
>
</type-3-player>

Styling

You can style the player via native attributes, or target its stable CSS class hooks for finer control.

Colours

<script
  type="module"
  crossorigin
  src="https://embed.type3.audio/player.js"
></script>
<type-3-player
  background-color="#f1f1f1"
  primary-color="#333"
  accent-color="#2ebdd1"
></type-3-player>

Borders and hover

<type-3-player
  border-color="#e5e5e5"
  border-color-dark="#333"
  border-width="1px"
  hover-transition="0.15s ease"
  play-button-color-hover="#2ebdd1"
></type-3-player>

-dark variants for prefers-color-scheme: dark are listed in the colours and hover animation reference tables.

Typography

Use primary-font-family and secondary-font-family to set the typefaces used inside the player. The primary font applies to the selected chapter heading in the chapters modal. The secondary font applies to the chapter list and the "Listen to this page" label.

<type-3-player
  primary-font-family="Inter, system-ui, sans-serif"
  primary-font-weight="600"
  secondary-font-family="Inter, system-ui, sans-serif"
  secondary-font-weight="400"
></type-3-player>

Custom CSS hooks

The player exposes a stable set of t3a-* class names on its meaningful elements. Target them from custom-css or your host page's stylesheet when the attributes above don't cover what you need.

Player root and state

ClassElement
.t3a-playerevery player root (inline, sticky, listen-to-this-page)
.t3a-player--inlineinline player root
.t3a-player--stickyfloating / sticky player root
.t3a-player--listen-to-this-page"Listen to this page" button root
.t3a-player--playingadded to the player root while audio is playing
.t3a-player--pausedadded to the player root while audio is paused

Body classes

The player adds the following classes to the host page's <body> element:

ClassAdded when
.t3a-sticky-player-visiblethe floating / sticky player is visible
.t3a-playback-startedplayback has started at least once on the current page
.t3a--ai-narrationthe loaded narration is an AI narration
.t3a--human-narrationthe loaded narration is a human narration or upload
.t3a--hardcoded-mp3-urlmp3-url was set on the player (rather than resolved from a narration)

Track info, transport, and slider

ClassElement
.t3a-titletrack title (uses primary font)
.t3a-authorauthor name (uses secondary font)
.t3a-listen-to-this-page-text"Listen to this page" label (uses secondary font)
.t3a-transportrow containing skip-back, play/pause, skip-forward
.t3a-button--playplay / pause button
.t3a-button--play-stateplay / pause button while it will start playback when clicked
.t3a-button--pause-stateplay / pause button while it will pause playback when clicked
.t3a-button--pausedplay / pause button while the player is paused
.t3a-button--playingplay / pause button while the player is playing
.t3a-button--skip-backskip-back button
.t3a-button--skip-forwardskip-forward button
.t3a-skip-increment"15" / "30" label inside a skip button
.t3a-skip-increment--backlabel inside the skip-back button
.t3a-skip-increment--forwardlabel inside the skip-forward button
.t3a-sliderseek-bar wrapper
.t3a-slider-trackseek-bar input element
.t3a-slider-fillfilled portion of the seek bar
.t3a-durationelapsed / total duration counter

Action buttons

ClassElement
.t3a-actionsrow of action buttons
.t3a-action-buttonevery action button
.t3a-action-button--chapters"Chapters" button
.t3a-action-button--speed"Speed" button
.t3a-action-button--subscribe"Subscribe" button
.t3a-action-button--feedback"Feedback" button
.t3a-action-button--close"Close" button
.t3a-action-button--add-to-feed"Add to feed" button

Modals

ClassElement
.t3a-modalevery modal root
.t3a-modal-bodyinner modal content area
.t3a-modal-closemodal close button
.t3a-modal--chapterschapters modal
.t3a-modal--speedspeed modal
.t3a-modal--subscribesubscribe modal
.t3a-modal--errorerror modal
.t3a-chapter-heading"Chapter N of N" label
.t3a-chapter-heading-titlecurrently-selected chapter title (uses primary font)
.t3a-chapter-listscrollable list of chapters
.t3a-chapter-itema single chapter row
.t3a-chapter-item--activethe active chapter row
.t3a-chapter-timetimestamp inside a chapter row
.t3a-chapter-titlechapter title inside a chapter row (uses secondary font)
.t3a-speed-sliderspeed slider input
.t3a-speed-boundmin / max bound label on the speed slider
.t3a-speed-bound--minmin bound label
.t3a-speed-bound--maxmax bound label
.t3a-speed-stepperrow of −, value, + speed controls
.t3a-speed-stepper-buttona − or + speed button
.t3a-speed-stepper-button--minus− speed button
.t3a-speed-stepper-button--plus+ speed button
.t3a-speed-valuenumeric speed value
.t3a-subscribe-gridgrid of subscribe-platform tiles
.t3a-subscribe-itema single subscribe-platform tile
.t3a-subscribe-item-iconicon inside a subscribe-platform tile
.t3a-subscribe-item-labellabel below a subscribe-platform tile
.t3a-error-messageerror modal body

Integrations

Analytics events

Use the analytics attribute to send events to your preferred analytics service (defaults to google):

  • google: window.gtag("event", event.type, event)
  • segment: window.analytics.track(event.type, event)
  • custom: window.t3aAnalytics(event.type, event)
  • none: no events sent

Events are only sent if the relevant window.x function is defined — if a visitor's privacy settings block your analytics service, no events fire.

Event typeEvent attributesFired
playcurrentPlaybackPosition, playbackSpeedwhen player starts playing
continued-listeningcurrentPlaybackPosition, playbackSpeedwhen player plays without interruption for 30 sec
completed-episodecurrentPlaybackPosition, playbackSpeedwhen player progress reaches <95% for the first time and its playing
reached-minuteminute, playbackSpeedwhen player reaches minute 5, 10, 15 (etc) of the audio
reached-percentagepercentage, playbackSpeedwhen player reaches 25, 50 and 75% of the audio
subscribeplatformwhen subscribe button is clicked
player-loadedmp3Urlwhen player successfully loads an MP3
errorerrorMessage, userMessage, mp3Url, networkStatewhen an error occurs

All analytics events also include the following attributes:

  • episodeType: the type of episode (ai_narration, human_narration or hardcoded_mp3_url)
  • episodeTitle: title of the episode, if known
  • episodeAuthor: author of the narrated article, if known
  • episodeId: episode ID (if episode was loaded from the TYPE III episode database)
  • url: the URL where the player was loaded, excluding query params and hash values
  • origin: the domain name where the player was loaded

WordPress plugin

Install our WordPress plugin to enable the [type_3_player] shortcode. Pass any of the attributes as shortcode arguments:

[type_3_player listen-to-this-page="true"]

How to add shortcodes in the Block Editor:

Attribute reference

Player features

AttributeType
analytics"none", "google", "segment", "custom"sends analytics events to selected provider (defaults to "google")
narration-urlstringif you want to load a narration for URL X, on a page with URL Y, set "narration-url" to URL X. (Legacy alias: episode-url.)
(soon) library-urlstringlink for the "View in library" button
listen-to-this-pagebooleanshow a "listen to this page" button instead of the full player
listen-to-this-page-textstringset the "listen to this page" button text. defaults to "Listen to this page". The listening time is added automatically when duration is known.
link-to-timestampbooleanis link to timestamp feature active.
link-to-timestamp-selectorcss selector stringlink to timestamp feature will look for links in the selected elements (default "body *")
mp3-urlstringurl to mp3 audio file
show-skip-buttonsbooleanshow the skip back and skip forward buttons. defaults to true; set to false to hide them. Legacy alias: skip-buttons.
play-icon-svgSVG stringcustom SVG markup for the play icon.
pause-icon-svgSVG stringcustom SVG markup for the pause icon.
sticky"true", "always", "false"true = enable floating player when inline player is not in viewport; always = disable inline player and always show the player in floating mode (defaults to "false")

Subscribe buttons

AttributeType
subscribe-url--applestringapple podcast url
subscribe-url--spotifystringspotify url
subscribe-url--youtubestringyoutube url
subscribe-url--podcast-addictstringpodcast addict podcast url
subscribe-url--rssstringrss feed url

Colours

AttributeType
background-colorcss color stringbackground color (default #FEFCE8)
primary-colorcss color stringtext color, fill slider color, controls icon color (default black)
background-color-darkcss color string(prefers-color-scheme: dark) background color
primary-color-darkcss color string(prefers-color-scheme: dark) text color, fill slider color, controls icon color
accent-color-darkcss color string(prefers-color-scheme: dark) the play button color
play-button-colorcss color stringplay / pause button background color
play-button-color-darkcss color string(prefers-color-scheme: dark) play / pause button background color
play-button-icon-colorcss color stringplay / pause icon color
play-button-icon-color-darkcss color string(prefers-color-scheme: dark) play / pause icon color
play-button-icon-color-hovercss color stringplay / pause icon color for button :hover state
play-button-icon-color-hover-darkcss color string(prefers-color-scheme: dark) play / pause icon color for button :hover state
play-button-color-hovercss color stringplay / pause button background color for :hover state (default: primary-color)
play-button-color-hover-darkcss color string(prefers-color-scheme: dark) play / pause button background color for :hover state
border-colorcss color stringborder colour around the player container
border-color-darkcss color string(prefers-color-scheme: dark) border colour around the player container
border-widthcss length stringborder width around the player container (e.g. "1px"). default: no border
modal-background-colorcss color stringbackground colour for the chapters / speed / subscribe modals (default: primary-color)
modal-background-color-darkcss color string(prefers-color-scheme: dark) modal background colour
modal-primary-colorcss color stringtext / accent colour on top of the modal background (default: background-color)
modal-primary-color-darkcss color string(prefers-color-scheme: dark) modal text / accent colour
data-skeleton-bg-colorcss color stringskeleton loader background color
data-skeleton-text-colorcss color stringskeleton loader text color

Hover animation

AttributeType
hover-transitioncss time + timing functionwhen set, play/pause and skip buttons fade between base and hover colours. Value is a CSS transition timing (e.g. "0.15s ease" or "150ms").

Typography and custom CSS

AttributeType
primary-font-familycss font-family stringfont for the track title and chapter heading title (default: bundled UntitledSans)
primary-font-weightcss font-weightweight for primary-font slots (default: "500")
secondary-font-familycss font-family stringfont for the author name, chapter list, and "Listen to this page" label
secondary-font-weightcss font-weightweight for secondary-font slots (default: "500")
custom-csscss stringany CSS you put here will be added within a <style> tag.

Privacy note

The player also sends the analytics events above to TYPE III AUDIO's internal analytics service. The mechanism is GDPR-compliant: no personally identifiable information is collected, and visitor consent or cookie notices are not required. We use the data to improve the player and report usage to clients.

To opt out, email us.

Get help