Skip to content
FrameworkStyle

Time

Playback position and duration state for the player store

Tracks playback position and duration.

API Reference

State

PropertyTypeDetails
currentTimenumber
durationnumber
seekingboolean

Actions

ActionTypeDetails
seek(time: number) => Promise<number>

Selector

Pass selectTime to usePlayer to subscribe to time state. Returns undefined if the time feature is not configured.

import { selectTime, usePlayer } from '@videojs/react';

function TimeDisplay() {
  const time = usePlayer(selectTime);
  if (!time) return null;

  return (
    <span>
      {Math.floor(time.currentTime)} / {Math.floor(time.duration)}
    </span>
  );
}