{"record":{"id":"ac5234ac426d631e","repo":"remotion-dev/remotion","slug":"absolutetimecontext-is-not-available-this-hook-mu","errorCode":null,"errorMessage":"AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.","messagePattern":"AbsoluteTimeContext is not available\\. This hook must be used inside a <Player> or the Remotion Studio\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/timeline-position-state.ts","lineNumber":106,"sourceCode":"\tconst state = useContext(PlaybackRateContext);\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t'PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.',\n\t\t);\n\t}\n\n\treturn state;\n};\n\nexport const useTimelinePosition = (): number => {\n\tconst state = useTimelineContext();\n\treturn useTimelinePositionFromContext(state);\n};\n\nexport const useAbsoluteTimelinePosition = (): number => {\n\tconst state = useContext(AbsoluteTimeContext);\n\tif (state === null) {\n\t\tthrow new Error(\n\t\t\t'AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.',\n\t\t);\n\t}\n\n\treturn useTimelinePositionFromContext(state);\n};\n\nexport const useTimelineSetFrame = (): ((\n\tu: React.SetStateAction<Record<string, number>>,\n) => void) => {\n\tconst {setFrame} = useContext(SetTimelineContext);\n\treturn setFrame;\n};\n\ntype PlayingReturnType = readonly [\n\tboolean,\n\t(u: React.SetStateAction<boolean>) => void,\n\tRefObject<boolean>,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/timeline-position-state.ts#L88-L124","documentation":"useAbsoluteTimelinePosition() reads Remotion's AbsoluteTimeContext, which is provided by <Player> or the Remotion Studio. Unlike the regular timeline position, this one returns a frame not adjusted by Sequence offsets. The hook throws when the context is null because there is no absolute timeline outside a Remotion render.","triggerScenarios":"Calling useAbsoluteTimelinePosition() from a component rendered outside <Player>/Studio, or from a component reused in non-Remotion contexts such as a design system preview.","commonSituations":"Extracting a subcomponent that uses this hook and mounting it in isolation; version mismatch where the AbsoluteTimeContext provider is absent; SSR rendering of a component that depends on the absolute frame.","solutions":["Render the calling component only inside <Player> or a registered <Composition>.","Pass the frame down as a prop instead of reading the context if the component must work in multiple contexts.","Run `npx remotion versions` to confirm context providers and consumers share a version."],"exampleFix":"// before\nfunction Overlay() {\n  const frame = useAbsoluteTimelinePosition();\n  return <Badge frame={frame} />;\n}\nrender(<Overlay />);\n\n// after\nrender(\n  <Player component={Overlay} durationInFrames={30} fps={30} width={640} height={360} />\n);","handlingStrategy":"validation","validationCode":"// Prefer: only mount this component inside <Player> or a <Composition>.\n// If you need the frame outside Remotion, pass it as a prop instead.\ntype OverlayProps = {frame: number};\nfunction Overlay({frame}: OverlayProps) {\n  return <Badge frame={frame} />;\n}","typeGuard":null,"tryCatchPattern":"try {\n  return useAbsoluteTimelinePosition();\n} catch (e) {\n  if (/AbsoluteTimeContext/.test((e as Error).message)) return 0;\n  throw e;\n}","preventionTips":["Use absolute-position hooks only inside <Player>/Composition trees.","Pass frames as props when reusing components outside Remotion.","Align @remotion/* versions across the monorepo."],"tags":["react","context","hook","player","timeline"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}