SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

EpisodePlayer

An episode player for a podcast or a read-aloud letter.

The pressure at the top of the hill

Episode 63 · 14:20

Read the transcript

Tove This is Undercurrent. I'm Tove Adler.

Rafi Pressure is height you borrow from a tank.

View code
tsx
<EpisodePlayer
	src="/demos/newsletter/episode-63.mp3"
	type="audio/mpeg"
	captions={{ src: "/demos/newsletter/episode-63.vtt", srclang: "en", label: "English" }}
	title="The pressure at the top of the hill"
	meta="Episode 63 · 14:20"
	chaptersLabel="Chapters"
	transcriptLabel="Read the transcript"
	fallback={<a href="/demos/newsletter/episode-63.mp3">Download the episode</a>}
	chapters={[
		{ start: 0, title: "The shower on the ninth floor" },
		{ start: 112, title: "What pressure means at a tap" },
		{ start: 270, title: "The tower on Linden Hill" },
		{ start: 785, title: "Credits" },
	]}
	transcript={[
		{ start: 0, speaker: "Tove", text: "This is Undercurrent. I'm Tove Adler." },
		{ start: 112, speaker: "Rafi", text: "Pressure is height you borrow from a tank." },
	]}
/>

Demo landings

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { EpisodePlayer } from "@sdxc/ui/landing";

The audio, chapter links and a closed transcript; with no script a time link opens the file at its moment. Map EpisodeSync (@sdxc/ui/landing/episode-player) in the browser entry to seek in place and mark what plays. --ui-landing-hairline colours the chapter rules.

Examples

tsx
<EpisodePlayer src="/audio/63.mp3" type="audio/mpeg" captions={{ src: "/audio/63.vtt", srclang: "en", label: "English" }} title="No. 63" meta="Episode 63 · 14:20" chaptersLabel="Chapters" transcriptLabel="Read the transcript" fallback={<a href="/audio/63.mp3">Download</a>} chapters={[{ start: 0, title: "Opening" }, { start: 112, title: "Pressure" }]} transcript={[{ start: 0, speaker: "Tove", text: "This is Undercurrent." }]} />

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
srcstringYesAddress of the audio file; every time link appends #t=<whole seconds> to it.
typestringNoMedia type of the file, such as audio/mpeg, so a browser skips a format it cannot play.
titleRemixNodeYesThe episode's title, rendered as a heading at the surrounding level.
metaRemixNodeNoA line under the title, such as the number, date and running time.
chaptersreadonly Chapter[]NoChapters in playing order; the list is left out when empty.
transcriptreadonly Cue[]NoTranscript passages in playing order; the disclosure is left out when empty.
chaptersLabelstringYesAccessible name of the chapter list, such as "Chapters".
transcriptLabelstringYesVisible label of the transcript disclosure, such as "Read the transcript".
captions{ src: string; srclang: string; label: string }YesThe WebVTT captions file for the audio, which assistive technology can read out.
fallbackRemixNodeYesRendered inside <audio> for a browser without audio support, such as a download link.
noteRemixNodeNoA line under the player, such as a credit or a download link.

Also accepts everything in Omit<TagProps<"div">, "title">.

Other components this module publishes.

  • formatEpisodeTime
@sdxc/ui

Can’t find it? Contact us