Media widget (Pro)
ProIncluded in $99A talk, recording or podcast in the chat with chapters an assistant wrote, cut into the scrubber and listed below.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { MediaWidget } from "@/components/ui/chatcn/pro/media-widget"
<MediaWidget
title="How we cut checkout latency"
meta={["Engineering all hands", "18:42"]}
src="/talks/checkout.mp4"
poster="/talks/checkout.webp"
chapters={[
{ at: 0, title: "Why checkout felt slow" },
{ at: 472, title: "The fix: reuse the session customer" },
]}
/>The scrubber is cut into the chapters with small gaps, so the shape of the recording is visible before you play it; hovering it shows the time and the chapter there. The current chapter is named over the controls and lit in the list below, with a thin bar filling as it plays; a chapter row jumps and plays. Speed, picture in picture (with a real video) and full screen sit in the control bar, which fades while video plays and returns on hover or focus. The keyboard works like a video site: Space or K to play, J and L to skip ten seconds, arrows for five, N and P for chapters. kind="audio" drops the picture for a compact bar. Without src it plays a clock over the poster, for demos.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
title, meta | The heading and its quiet line | |
kind | "video" | "audio" | Default video |
src, poster | string | The file and its still |
duration | number | Seconds; read from the file when there is one |
chapters | MediaChapter[] | { at, title }, in seconds |
rates | number[] | Speeds offered. Default 1, 1.25, 1.5 and 2 |
labels | Partial<MediaWidgetLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Space, K | Play or pause |
| J, L | Back or forward ten seconds |
| Arrow left, right | Back or forward five seconds |
| N, P | Next or previous chapter |
Accessibility
- The scrubber is a slider that reads the time, the length and the chapter.
- Chapter rows are buttons named with the title and the time; the current one is marked.
Motion
The controls fade in 200 ms while video plays. Chapter progress moves with transform.