Skip to content

HTMLVideoElement missing requestVideoFrameCallback #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jameshfisher opened this issue Oct 3, 2020 · 3 comments
Open

HTMLVideoElement missing requestVideoFrameCallback #927

jameshfisher opened this issue Oct 3, 2020 · 3 comments

Comments

@jameshfisher
Copy link

Possibly the spec is too early for inclusion. For others with the same issue, here are the types I came up with:

interface VideoFrameMetadata {
    presentationTime: DOMHighResTimeStamp;
    expectedDisplayTime: DOMHighResTimeStamp;
    width: number;
    height: number;
    mediaTime: number;
    presentedFrames: number;
    processingDuration?: number;
    captureTime?: DOMHighResTimeStamp;
    receiveTime?: DOMHighResTimeStamp;
    rtpTimestamp?: number;
};
type VideoFrameRequestCallbackId = number;
interface HTMLVideoElement extends HTMLMediaElement {
    requestVideoFrameCallback(callback: (now: DOMHighResTimeStamp, metadata: VideoFrameMetadata) => any): VideoFrameRequestCallbackId;
    cancelVideoFrameCallback(handle: VideoFrameRequestCallbackId): void;
}
@PindaPixel
Copy link

I'm kinda new to this, would there be a way for me to override the interface in my own type definition file for the time being?

@jameshfisher
Copy link
Author

@PindaPixel you should just be able to copy-paste the above definitions in your own file - possibly wrapping it all in declare global { ... }

@Bashamega
Copy link
Contributor

Bashamega commented Apr 22, 2025

Hello @jameshfisher :)
After 5 years of your issue being open, I’m happy to share that it is now officially supported in TypeScript as of 2024! It’s been added to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants