TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

HTMLVideoElement missing requestVideoFrameCallback

Open jameshfisher opened this issue 5 years ago • 2 comments

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;
}

jameshfisher avatar Oct 03 '20 17:10 jameshfisher

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?

PindaPixel avatar Oct 23 '20 08:10 PindaPixel

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

jameshfisher avatar Oct 23 '20 10:10 jameshfisher