// Use minimal react-konva core to avoid Node.js dependencies import 'konva/lib/Animation'; import 'konva/lib/shapes/Image'; import 'konva/lib/shapes/Text'; import { Image, Layer, Stage, Text } from 'react-konva/lib/ReactKonvaCore'; const VideoPreview = ({ // Dimensions dimensions, // Timeline state currentTime, totalDuration, isPlaying, status, // Export state isExporting, exportProgress, exportStatus, // Data timelineElements, activeElements, videoElements, loadedVideos, videoStates, ffmpegCommand, // Event handlers handlePlay, handlePause, handleReset, handleSeek, copyFFmpegCommand, exportVideo, // Refs layerRef, }) => { // Function to determine which image source to use for videos const getImageSource = (element) => { // Check if this video should be playing right now const isVideoActive = videoStates[element.id] && isPlaying; // Use video if it's ready and currently active, otherwise use poster if (isVideoActive && element.videoElement && element.isVideoReady) { return element.videoElement; } else if (element.posterImage && element.isVideoPoster) { return element.posterImage; } // Fallback - no image ready yet return null; }; return (