import { jsx as _jsx } from "react/jsx-runtime";
/**
 * Plays a video and loops between the end and the timestamp you set
 */
/**
 * This component displays a video that automatically restarts from a specific point when it reaches the end, creating a seamless loop effect.
 */
export default function LoopableVideo({ videoSrc, percentToBackTo, ...props }) {
    if (process.env.NODE_ENV === "development")
        if (percentToBackTo < 0 || percentToBackTo > 1)
            throw new Error(`percentToBackTo should be a value between 0-1`);
    return (_jsx("video", { autoPlay: true, muted: true, onEnded: ({ currentTarget }) => {
            const el = currentTarget;
            el.currentTime = el.duration * percentToBackTo;
            el.play();
        }, ...props, children: _jsx("source", { src: videoSrc }) }));
}
//# sourceMappingURL=LoopableVideo.js.map