UNPKG

use-video-interval

Version:

A React hook for executing a callback at customizable intervals during video playback.

31 lines (30 loc) 685 B
/** * FrameCallbacks * * A record of interval numbers as keys and callback functions as values. * * @type {Record<number, () => void>} */ export type FrameCallbacks = Record<number, () => void>; /** * Options for the useVideoFrame hook. */ export interface Options { /** * The threshold in seconds to check the current time against. * * @default 0.5 */ threshold?: number; /** * Whether to execute the callback only once. * * @default true */ triggerOnce?: boolean; } export type useVideoFrameProps = { videoRef: React.RefObject<HTMLVideoElement | null>; frameCallbacks: FrameCallbacks; options?: Options; };