No.300 · Media· New
Transcript Player
Audio with its transcript as the main control. The spoken word is lit as it plays, any word is a seek point, search hits show as ticks on the scrubber, and copying a passage carries its timestamp. Chapters, speaker turns, playback speed and a full keyboard map.
The prompt
Written for the variant you picked above: Light
Build an audio player whose transcript is the interface. Props: src (any audio URL), words [{ text, start, end, speaker }], chapters [{ title, start }], speakers map. Playback uses a real <audio> element (hidden). Layout: a warm 14px-radius panel. Header: a 46px round play/pause button, the title in Newsreader, 'Chapter · 0:12 / 1:03' and a speed button (1×, 1.25×, 1.5×, 2×). Under it a 4px scrubber rail with an accent fill, chapter notches and search-hit ticks (taller, blue, the current hit in accent), over an invisible native range for input. Chapter pills. A search field with a match count and ↑/↓. Then a 21rem scroll area in Newsreader 18px/1.7: turns (one per speaker change) with the speaker name and a dotted-underline timestamp button on the left (stacked above on narrow screens) and the words on the right. Words: the one being spoken has a warm highlight; earlier words fade to muted; search hits are tinted. Binary-search the word list for the current word; read audio.currentTime in rAF but only re-render each tenth of a second, and memoise each turn so only the active paragraph re-renders. Auto-scroll keeps the current word in view; a wheel or touch scroll pauses that and shows 'Back to 0:34 ↓'. Selected variant — Light (light): Palette for this theme (Light): --tplay-accent #c4452d; --tplay-bg #f8f5ef; --tplay-card #ffffff; --tplay-focus #c4452d; --tplay-hit #d9ecff; --tplay-hit-on #8fc2f5; --tplay-ink #201d19; --tplay-line rgb(32 29 25 / 0.1); --tplay-muted #77716a; --tplay-now #fde4b8; --tplay-rail #ddd6ca. Treat these as the root colour tokens, one value per role, and name them to suit your code. Select it with the theme option set to "light". Keep every dimension, spacing value, state and motion from the brief unchanged, and keep text at 4.5:1 contrast or better on these surfaces. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click a word to play from it. Space plays or pauses; ←/→ seek 5 s; J/K go to the previous or next sentence (J first restarts the current sentence); / focuses search, Enter and Shift+Enter step through matches (and seek), Escape clears. Selecting text and copying puts “quote” (title, 0:34) on the clipboard and says so. Motion: Words fade to muted as they are spoken; the current-word highlight follows playback. The only other motion is smooth auto-scroll. Accessibility: A real audio element with native range input for seeking (with spoken time values). Words are in reading order text in a focusable region; timestamps are labelled buttons; match counts are announced politely; shortcuts do not fire while typing in the search field. Responsive behavior: Below 560px speaker and timestamp stack above the words and the shortcut line hides. Touch: Tap any word to jump; scrolling by touch pauses auto-follow until 'Back to' is tapped. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Click a word to play from it. Space plays or pauses; ←/→ seek 5 s; J/K go to the previous or next sentence (J first restarts the current sentence); / focuses search, Enter and Shift+Enter step through matches (and seek), Escape clears. Selecting text and copying puts “quote” (title, 0:34) on the clipboard and says so.
- Motion
- Words fade to muted as they are spoken; the current-word highlight follows playback. The only other motion is smooth auto-scroll.
- Accessibility
- A real audio element with native range input for seeking (with spoken time values). Words are in reading order text in a focusable region; timestamps are labelled buttons; match counts are announced politely; shortcuts do not fire while typing in the search field.
- Responsive
- Below 560px speaker and timestamp stack above the words and the shortcut line hides.
- On touch
- Tap any word to jump; scrolling by touch pauses auto-follow until 'Back to' is tapped.