import type { MouseEvent, ReactNode, RefObject } from "react"; interface VideoPlayerProps { src: string | null; videoRef: RefObject; playing: boolean; currentFrame: number; totalFrames: number; onTogglePlay: () => void; onPlay: () => void; onPause: () => void; onEnded: () => void; onLoadError?: () => void | Promise; onStageClick?: (position: { x: number; y: number }) => void; children?: ReactNode; } function VideoPlayer({ src, videoRef, currentFrame, totalFrames, onEnded, onLoadError, onPause, onPlay, onTogglePlay, onStageClick, children, }: VideoPlayerProps) { const handleStageClick = (event: MouseEvent) => { if (!onStageClick) return; const rect = event.currentTarget.getBoundingClientRect(); const x = ((event.clientX - rect.left) / rect.width) * 100; const y = ((event.clientY - rect.top) / rect.height) * 100; onStageClick({ x: Math.max(0, Math.min(100, x)), y: Math.max(0, Math.min(100, y)) }); }; return (
{src ? (
); } export default VideoPlayer;