Skip to main content

Function: projectPosition()

function projectPosition(state: PlayerState, now: number): number;

Defined in: packages/player/src/state.ts:565

Project the current playback position from state's anchor.

position = anchor.position + (advancing ? (now - anchor.timestamp) / 1000 * anchor.rate : 0), clamped to [0, duration].

Parameters

ParameterTypeDescription
statePlayerStateThe snapshot to project from.
nownumberDate.now()-style millisecond timestamp to project to.

Returns

number

The position in seconds.