Skip to content
FrameworkStyle

media-time-slider

A slider component for seeking through media playback time

Anatomy

<media-time-slider></media-time-slider>

Behavior

Displays and controls the current playback position. Dragging the slider seeks the media. The fill level reflects currentTime / duration as a percentage, and the buffer level shows how much media has been buffered.

Value changes during drag are throttled via the changeThrottle prop (default 100ms) using a leading+trailing throttle to keep the UI responsive without overwhelming the media element.

Styling

Use CSS custom properties to style the fill, pointer, and buffer levels:

media-time-slider::before {
  width: var(--media-slider-fill);
}

Use data-seeking to style during active seek operations:

media-time-slider[data-seeking] {
  opacity: 0.8;
}

Accessibility

Renders with role="slider" and an automatic aria-label that resolves to “Seek” from the active locale. Override with the label prop. Keyboard controls:

  • Arrow Left / Arrow Right: step by step increment
  • Page Up / Page Down: step by largeStep increment
  • Home: seek to start
  • End: seek to end

Examples

Nest sub-components for full control over the slider’s DOM structure. This example includes a track, fill bar, buffer indicator, draggable thumb, and a tooltip that shows the pointed-at time.

<video-player class="video-player">
    <media-container>
        <video
            src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
            autoplay
            muted
            playsinline
            loop
        ></video>
        <media-time-slider class="media-time-slider">
            <media-slider-track class="media-slider-track">
                <media-slider-buffer class="media-slider-buffer"></media-slider-buffer>
                <media-slider-fill class="media-slider-fill"></media-slider-fill>
            </media-slider-track>
            <media-slider-thumb class="media-slider-thumb"></media-slider-thumb>
            <media-slider-value type="pointer" class="media-slider-value"></media-slider-value>
        </media-time-slider>
    </media-container>
</video-player>

API Reference

media-time-slider

Props

PropTypeDefaultDetails
changeThrottlenumber100
disabledboolean
labelText | string | Text) | function''
largeStepnumber
maxnumber
minnumber
orientation'horizontal' | 'vertical'
pauseOnDragbooleanfalse
stepnumber
thumbAlignment'center' | 'edge'
valuenumber

State

State is reflected as data attributes for CSS styling.

PropertyTypeDetails
bufferPercentnumber
valuenumber
fillPercentnumber
pointerPercentnumber
draggingboolean
pointingboolean
interactiveboolean
orientation'horizontal' | 'vertical'
disabledboolean
thumbAlignment'center' | 'edge'
currentTimenumber
seekingboolean
durationnumber

Data attributes

AttributeTypeDetails
data-seeking

CSS custom properties

VariableDetails
--media-slider-fill
--media-slider-pointer
--media-slider-buffer

media-slider-buffer

Displays the buffered range on the slider track.

media-slider-fill

Displays the filled portion from start to the current value.

media-slider-preview

Positioning container for preview content that tracks the pointer along the slider.

Props

PropTypeDefaultDetails
overflowSliderPreviewOverflow

Data attributes

AttributeTypeDetails
data-dragging
data-pointing
data-interactive
data-orientation'horizontal' | 'vertical'
data-disabled

media-slider-thumb

Draggable handle for setting the slider value. Receives focus and handles keyboard interaction.

Data attributes

AttributeTypeDetails
data-dragging
data-pointing
data-interactive
data-orientation'horizontal' | 'vertical'
data-disabled

media-slider-track

Contains the slider's visual track and interactive hit zone.

media-slider-value

Displays a formatted text representation of the slider value. Renders an <output> element.

Props

PropTypeDefaultDetails
format((value: number) => string)
type"current" | "pointer"

Data attributes

AttributeTypeDetails
data-dragging
data-pointing
data-interactive
data-orientation'horizontal' | 'vertical'
data-disabled