SeekButton
Accessible seek button for skipping forward or backward by a configurable number of seconds
Anatomy
<SeekButton />Behavior
Seeks media by a configurable number of seconds (default 30). Positive values seek forward, negative values seek backward. The seek is clamped to media bounds (0 to duration).
Accessibility
Renders a <button> with an automatic aria-label describing the action, e.g. “Seek forward 30 seconds” or “Seek backward 10 seconds”. Override with the label prop. Keyboard activation: Enter / Space.
Examples
Basic Usage
import { createPlayer, SeekButton } from '@videojs/react';
import { Video, videoFeatures } from '@videojs/react/video';
import './BasicUsage.css';
const Player = createPlayer({ features: videoFeatures });
export default function BasicUsage() {
return (
<Player.Provider>
<Player.Container className="react-seek-button-basic">
<Video
src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
autoPlay
muted
playsInline
loop
/>
<div className="react-seek-button-basic__buttons">
<SeekButton
seconds={-5}
className="react-seek-button-basic__button"
render={(props, state) => (
<button {...props}>
{state.direction === 'backward' ? '\u23EA' : '\u23E9'} {5}s
</button>
)}
/>
<SeekButton
seconds={10}
className="react-seek-button-basic__button"
render={(props, state) => (
<button {...props}>
{10}s {state.direction === 'forward' ? '\u23E9' : '\u23EA'}
</button>
)}
/>
</div>
</Player.Container>
</Player.Provider>
);
}
.react-seek-button-basic {
position: relative;
}
.react-seek-button-basic video {
width: 100%;
}
.react-seek-button-basic__buttons {
display: flex;
gap: 8px;
position: absolute;
bottom: 10px;
left: 10px;
}
.react-seek-button-basic__button {
padding-block: 8px;
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(10px);
color: black;
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 9999px;
padding-inline: 20px;
white-space: nowrap;
cursor: pointer;
}
API Reference
Props
| Prop | Type | Default | Details |
|---|---|---|---|
disabled | boolean | false | |
| |||
label | string | function | '' | |
| |||
seconds | number | 30 | |
| |||
State
State is accessible via the render, className, and style props.
| Property | Type | Details |
|---|---|---|
seeking | boolean | |
| ||
direction | 'forward' | 'backward' | |
| ||
label | string | |
Data attributes
| Attribute | Type | Details |
|---|---|---|
data-seeking | ||
| ||
data-direction | 'forward' | 'backward' | |
| ||