Skip to main content

Function: useProgress()

function useProgress(player: Player | undefined, intervalMs?: number): Progress;

Defined in: packages/player/src/hooks/useProgress.ts:82

A ticking view of the playback position.

The position is projected locally from the player's anchor — nothing is polled across the bridge, and no native call happens per tick. The interval exists purely to re-render this component, and is pause-aware: it runs only while playback is actually advancing, and is torn down on pause, on buffering, while seeking, and on unmount.

On subscribe (and whenever the player changes) a single precise resync runs — one synchronous time-pos read — so a component that mounts mid-playback starts from the truth rather than from a stale anchor.

Parameters

ParameterTypeDefault valueDescription
playerPlayer | undefinedundefinedThe player, or undefined before it has been created.
intervalMsnumberDEFAULT_PROGRESS_INTERVAL_MSRe-render period in milliseconds. Defaults to 250. Pass 0 to disable the ticker and update only on state changes.

Returns

Progress