VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

The Gold Standard of Websites | Separating requestVideoFrameCallback() Media Time from requestAnimationFrame() Document Time

A 25-frame-per-second video plays in a document updating near 60 hertz. Animation callbacks arrive about every 16.7 milliseconds, while video callbacks report mediaTime values such as 12.000, 12.040 and 12.080 seconds. When presentedFrames jumps by two, the trace can flag a missed video callback without pretending that an animation timestamp is a media frame index.

This lesson continues The Gold Standard of Websites, the Gold Standard of Education and the How X Works hub. Every video duration, frame cadence, timestamp and callback log is an original synthetic fixture. The lesson does not claim frame-accurate editing, infer decoded content from timing alone, bypass media privacy limits or treat an incubation draft as a universal browser contract.

Record video source type, playback state and rate, currentTime, callback kind, callback now, mediaTime, presentationTime, expectedDisplayTime, presentedFrames, processingDuration, callback registration and cancellation, document visibility, display refresh estimate, browser build and unavailable metadata.

The WICG requestVideoFrameCallback Community Group draft defines callback timing and metadata such as mediaTime, expectedDisplayTime and presentedFrames. It is an incubation draft rather than a W3C standard. The WHATWG HTML animation-frame section defines requestAnimationFrame within document rendering. The lesson dates implementation evidence and avoids universal support claims.

THE GOLD STANDARD · WEBSITES

Media time identifies video content; document time locates a rendering opportunity

A requestVideoFrameCallback callback receives a rendering timestamp and metadata about a newly presented video frame, including mediaTime. requestAnimationFrame receives a document rendering timestamp but does not identify which decoded video frame became visible. The numbers can correlate during smooth playback, yet their units, lifetime and meaning remain different.

Fast route
Start with the decisive rule.
Start this route

Measurement route
Build the browser state and evidence ledger.
Start this route

Comparison route
Separate the nearest lookalikes.
Start this route

Transfer route
Change the context and retest.
Start this route

Reporting route
State limits and continue reading.
Start this route

Chapter contents

Open the full chapter index

1. Give the two-clock rule

Use mediaTime to identify the position of presented video content and the callback timestamp to place work on the document rendering timeline. Do not subtract them without an explicit shared basis.

Original worked example. A callback reports now=8450.3 milliseconds and mediaTime=12.040 seconds; both are valid but answer different questions. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Seek the video backward while document time continues forward. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Label unit, time origin and semantic owner for every timestamp. If this check fails, mark the claim unavailable and repair the method before continuing.

Keep browser configuration, object state and the final claim in separate fields so an attractive visual result cannot rewrite platform evidence.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Contents · Next chapter

2. Compare callback cadences

requestAnimationFrame can run at display cadence, while video callbacks are bounded by video presentation cadence and browser rendering opportunities. One animation tick does not equal one media frame.

Original worked example. At 60 hertz, roughly five animation ticks span two 25 fps video frames. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Change playback to a 50 fps video on the same display. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Count callbacks over a stated interval and preserve throttled periods. If this check fails, mark the claim unavailable and repair the method before continuing.

Use a positive case, a clean negative case and an unavailable case. Unavailable evidence means the required field could not be established.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

3. Treat callbacks as one-shot

Both APIs require another registration for a future callback. A loop exists because code re-registers, not because one request is a standing subscription.

Original worked example. The handler records a video frame, then calls requestVideoFrameCallback again. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Omit the re-registration after frame 20. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Record request ID, callback time and next registration. If this check fails, mark the claim unavailable and repair the method before continuing.

Change one consequential premise while keeping the rest fixed. Predict the new branch before inspecting it and preserve disagreement.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

4. Read mediaTime as media evidence

mediaTime corresponds to the media timeline for the presented frame. currentTime sampled later can differ because playback continues.

Original worked example. The callback records mediaTime=12.080; a later task reads currentTime=12.096. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Pause immediately after callback delivery. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Capture metadata inside the callback instead of reconstructing it later. If this check fails, mark the claim unavailable and repair the method before continuing.

Carry one plausible alternative through the event or state ledger, then choose the next observation that separates it from the leading account.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

5. Use presentedFrames to detect gaps

A jump in presentedFrames can reveal that frames were presented between observed callbacks or that callback work fell behind. It does not identify pixel content.

Original worked example. The count rises from 301 to 303 and the ledger marks a one-frame observation gap. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Drop one callback registration intentionally. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Compare consecutive counters and state the observation limit. If this check fails, mark the claim unavailable and repair the method before continuing.

Name the document, element, object, promise, event, timestamp or selector involved. Similar visible results can come from different platform paths.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

6. Separate presentationTime and expectedDisplayTime

presentationTime describes when the frame was submitted for composition, while expectedDisplayTime estimates when it should be visible. Their difference is scheduling evidence, not media duration.

Original worked example. A frame has presentationTime 8450.0 and expectedDisplayTime 8466.7 milliseconds. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Create main-thread pressure and compare the gap. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Record both timestamps and callback now in the same time origin. If this check fails, mark the claim unavailable and repair the method before continuing.

Archive source, fixture, options, events, timestamps, browser version and raw exceptions so another reader can reproduce the conclusion.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

7. Interpret callback lateness carefully

A callback may arrive near or after expected display. Lateness can indicate scheduling pressure, but one sample does not locate decoding, composition or display failure.

Original worked example. The callback now is only 0.4 milliseconds before expectedDisplayTime, so the frame is labelled late for this test threshold. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Repeat during an idle interval. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Define the lateness rule before looking at the result. If this check fails, mark the claim unavailable and repair the method before continuing.

Keep browser configuration, object state and the final claim in separate fields so an attractive visual result cannot rewrite platform evidence.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

8. Use processingDuration narrowly

processingDuration can describe time from packet submission to decoded-frame readiness for supported sources. It does not include every network, queue and display delay.

Original worked example. A frame reports 6 milliseconds processingDuration while total user-perceived delay is larger. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Switch to a source where the field is unavailable. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Treat missing optional metadata as unavailable, not zero. If this check fails, mark the claim unavailable and repair the method before continuing.

Use a positive case, a clean negative case and an unavailable case. Unavailable evidence means the required field could not be established.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

9. Keep source-specific metadata optional

Capture and WebRTC fields such as captureTime or receiveTime may appear only in applicable contexts. A normal file video cannot be forced into that evidence model.

Original worked example. A remote stream exposes receive timing while a local MP4 fixture does not. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Use the same rendering code with a local source. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Record source class before interpreting optional fields. If this check fails, mark the claim unavailable and repair the method before continuing.

Change one consequential premise while keeping the rest fixed. Predict the new branch before inspecting it and preserve disagreement.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

10. Separate rAF from frame identity

requestAnimationFrame is useful for document animation and sampling, but it does not promise a newly presented video frame on every callback.

Original worked example. Three animation callbacks read the same last-recorded mediaTime before the next video callback. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Pause video while CSS animation continues. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Track the last video frame separately from document ticks. If this check fails, mark the claim unavailable and repair the method before continuing.

Carry one plausible alternative through the event or state ledger, then choose the next observation that separates it from the leading account.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

11. Handle seeks and playback-rate changes

Seeking can move mediaTime discontinuously; playbackRate changes its slope relative to document time. Neither change resets the document time origin.

Original worked example. At 2x rate, mediaTime advances about 80 milliseconds over two 25 fps frame steps while wall time advances about 40 milliseconds. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Seek backward five seconds during playback. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Annotate seeks, rate changes and discontinuities before calculating deltas. If this check fails, mark the claim unavailable and repair the method before continuing.

Name the document, element, object, promise, event, timestamp or selector involved. Similar visible results can come from different platform paths.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

12. Account for visibility and throttling

Background documents, paused media and implementation policy can reduce or suspend callbacks. A quiet log is not proof that no frames exist.

Original worked example. The tab becomes hidden and callback delivery pauses while media state remains separately recorded. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Return the tab to visible and re-register if required. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Log visibility, readyState, paused and ended alongside callback counts. If this check fails, mark the claim unavailable and repair the method before continuing.

Archive source, fixture, options, events, timestamps, browser version and raw exceptions so another reader can reproduce the conclusion.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

13. Synchronize canvas work deliberately

A video-frame callback can schedule canvas analysis near presentation, but callback delivery is not a guarantee that every display pixel or compositor result is readable.

Original worked example. The fixture draws the video in the callback and records the matching mediaTime for the analysis row. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Move the draw into requestAnimationFrame. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Associate each output with the API and metadata that triggered it. If this check fails, mark the claim unavailable and repair the method before continuing.

Keep browser configuration, object state and the final claim in separate fields so an attractive visual result cannot rewrite platform evidence.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

14. Build a changed-context matrix

Cross video cadence, display cadence, playback rate, seek, pause, visibility and main-thread pressure one at a time.

Original worked example. Fourteen rows include smooth 25 fps, 50 fps, a seek, 2x playback, hidden tab and delayed callback. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Keep the same video and change only document visibility. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Archive raw callback order and avoid smoothing away gaps. If this check fails, mark the claim unavailable and repair the method before continuing.

Use a positive case, a clean negative case and an unavailable case. Unavailable evidence means the required field could not be established.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

15. Repair common shortcuts

Animation time is not media time, callback count is not frame count, a presentedFrames jump is not decoded pixel proof, and lateness is not full latency.

Original worked example. A blinded timing table asks readers to repair four compressed claims. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Remove labels and infer only from units and metadata fields. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Require clock, cadence, counter and source context. If this check fails, mark the claim unavailable and repair the method before continuing.

Change one consequential premise while keeping the rest fixed. Predict the new branch before inspecting it and preserve disagreement.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

16. Answer practical questions

Use video callbacks for frame-linked overlays or analysis, animation callbacks for document animation, and a recorded bridge when the two timelines must meet.

Original worked example. Captions use mediaTime, while a surrounding panel animation uses document time. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Change playback rate and verify both remain aligned through the bridge. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Test seeking, pause, dropped observations and unsupported browsers. If this check fails, mark the claim unavailable and repair the method before continuing.

Carry one plausible alternative through the event or state ledger, then choose the next observation that separates it from the leading account.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

17. Create a reproducible timing ledger

A complete ledger stores request IDs, callback order, all available metadata, media state and document state with no invented frame labels.

Original worked example. The fixture exports a table for 200 callbacks and marks counter gaps before summary calculations. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. Repeat on a different refresh-rate display. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Version source, browser, display and measurement code. If this check fails, mark the claim unavailable and repair the method before continuing.

Name the document, element, object, promise, event, timestamp or selector involved. Similar visible results can come from different platform paths.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents · Next chapter

18. Use the draft and living standard carefully

requestVideoFrameCallback is documented in a WICG Community Group draft, while animation frames live in WHATWG HTML. Their status and implementations must be stated accurately.

Original worked example. The final note distinguishes draft text from dated browser behavior. The objects, values and observations are explicit so the reader can reconstruct the decision instead of trusting a label.

Changed-context transfer. When the draft or HTML steps change, rerun cadence, metadata and throttling cases. State what changed, predict the consequence and revise only the conclusion that depended on that condition.

Practical evidence check. Save exact source URLs, access dates and fixture version. If this check fails, mark the claim unavailable and repair the method before continuing.

Archive source, fixture, options, events, timestamps, browser version and raw exceptions so another reader can reproduce the conclusion.

Before closing, reconcile the original fixture against the chapter rule: identify the relevant objects, state, event order and missing evidence; change one condition and mark the first unsupported inference. Preserve the raw trace beside the revised result. End the chapter with three sentences: what the evidence establishes, what it does not establish and what observation would change the conclusion. This keeps the lesson useful when the browser, context or platform state changes. A strong record also names the datum, denominator, section or coordinate system that governed the decision, so a later reader can repeat the reasoning without importing an unstated shortcut.

Previous chapter · Contents

Sources and further study

WICG requestVideoFrameCallback Community Group draft. Used for the standard definitions, material mechanisms or method limits developed in this lesson.

WHATWG HTML, animation frames. Used for the standard definitions, material mechanisms or method limits developed in this lesson.

The worked examples and transfer checks are developed here and state their own assumptions. The linked sources support the underlying web-platform mechanisms, state and method limits.

Return to contents · Return to The Gold Standard of Websites