HextaUI

Video player: Seek offsets and speeds

offset sets how far each seek button jumps, and rates sets the speeds in the menu.

0:00 / --:--
import {
  VideoPlayer,
  VideoPlayerContent,
  VideoPlayerControls,
  VideoPlayerPlaybackRate,
  VideoPlayerPlayButton,
  VideoPlayerSeekBar,
  VideoPlayerSeekButton,
  VideoPlayerSpacer,
  VideoPlayerTime,
} from "@/components/ui/video-player"

export function VideoPlayerSeekOffsets() {
  return (
    <VideoPlayer className="max-w-xl">
      <VideoPlayerContent
        src="https://media.w3.org/2010/05/sintel/trailer.mp4"
        poster="https://media.w3.org/2010/05/sintel/poster.png"
        aria-label="Sintel trailer"
      />
      <VideoPlayerControls>
        <VideoPlayerSeekBar />
        <VideoPlayerSeekButton offset={-15} />
        <VideoPlayerPlayButton />
        <VideoPlayerSeekButton offset={30} />
        <VideoPlayerTime />
        <VideoPlayerSpacer />
        <VideoPlayerPlaybackRate rates={[1, 1.5, 2, 3]} />
      </VideoPlayerControls>
    </VideoPlayer>
  )
}

This adds the example as components/examples/video-player/seek-offsets.tsx, together with the Video player component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/video-player-seek-offsets.json

To add only the component, follow the Video player installation.

Props in this example

The Video player props this example sets, from the API reference.

PropTypeDefault
offsetSeconds to jump. Negative values go back.
number10
PropTypeDefault
rates
number[][0.5, 0.75, 1, 1.25, 1.5, 2]

Every prop is in the Video player API reference.

See them all, with keyboard support and accessibility notes, on the Video player page.