@wethegit/react-autoplay-video
Version:
Viewport-aware auto-playing video component for use in React projects.
41 lines (37 loc) • 1.35 kB
TypeScript
import { JSX as JSX_2 } from 'react/jsx-runtime';
/**
* AutoplayVideo
* Renders an inline video. Pauses itself when out of view. Includes an optional fallback for when the user prefers redued motion.
*/
export declare function AutoplayVideo({ className, description, paused, posterImg, prefersReducedMotion, renderReducedMotionFallback, src, loop, ...props }: AutoplayVideoProps): JSX_2.Element;
export declare interface AutoplayVideoProps extends React.ComponentPropsWithRef<"div"> {
/**
* Visually-hidden description of the video.
*/
description?: string;
/**
* Whether the video should loop once playback is finished.
*/
loop?: boolean;
/**
* Whether the video should render in a paused state.
*/
paused?: boolean;
/**
* Image path to use as the video element's poster attribute.
*/
posterImg?: string;
/**
* Whether the user prefers reduced motion. Enables return value of renderReducedMotionFallback() to render.
*/
prefersReducedMotion?: boolean;
/**
* Render prop. Renders its return value when prefersReducedMotion is true.
*/
renderReducedMotionFallback?: () => React.ReactNode;
/**
* Video path to use as the video element's src attribute.
*/
src: string;
}
export { }