Skip to content
Sign upPro
Apps SDKMedia widgetMenu

Media widget (Pro)

ProIncluded in $99

A talk, recording or podcast in the chat with chapters an assistant wrote, cut into the scrubber and listed below.

ProA recorded talk with chapters the assistant wrote. Jump to a chapter, or press N for the next one.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/media-widget

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

tsx
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

ProAudio with chapters, and a short video with none.

Props

PropTypeNotes
title, metaThe heading and its quiet line
kind"video" | "audio"Default video
src, posterstringThe file and its still
durationnumberSeconds; read from the file when there is one
chaptersMediaChapter[]{ at, title }, in seconds
ratesnumber[]Speeds offered. Default 1, 1.25, 1.5 and 2
labelsPartial<MediaWidgetLabels>Every string, for translation

Keyboard

KeyAction
Space, KPlay or pause
J, LBack or forward ten seconds
Arrow left, rightBack or forward five seconds
N, PNext 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.