coderef

requestVideoFrameCallback()Baseline · Newly available

The requestVideoFrameCallback() method for <video> schedules a function that runs with the next video frame. It is similar to requestAnimationFrame(), but for video.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Oct 29, 2024.

Browser support

DesktopChrome
1–81Not supported
83+Supportedsince May 19, 2020
Current: 155
Edge
12–81Not supported
83+Supportedsince May 21, 2020
Current: 154
Firefox
1–131Not supported
132+Supportedsince Oct 29, 2024
Current: 157
Safari
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27
MobileChrome Android
18–81Not supported
83+Supportedsince May 19, 2020
Current: 155
Firefox Android
4–131Not supported
132+Supportedsince Oct 29, 2024
Current: 157
Safari iOS
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Oct 29, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: cancelVideoFrameCallback.

Feature detection

JS · check before using
if ("HTMLVideoElement" in globalThis && "requestVideoFrameCallback" in HTMLVideoElement.prototype) {
  // HTMLVideoElement.requestVideoFrameCallback is available
}

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLVideoElement.cancelVideoFrameCallback838313215.48313215.4
HTMLVideoElement.requestVideoFrameCallback838313215.48313215.4