diff --git a/.config/Ultralytics/persistent_cache.json b/.config/Ultralytics/persistent_cache.json new file mode 100644 index 0000000..e306d51 --- /dev/null +++ b/.config/Ultralytics/persistent_cache.json @@ -0,0 +1,3 @@ +{ + "cpu_info": "aarch64" +} \ No newline at end of file diff --git a/.config/Ultralytics/settings.json b/.config/Ultralytics/settings.json new file mode 100644 index 0000000..2819969 --- /dev/null +++ b/.config/Ultralytics/settings.json @@ -0,0 +1,21 @@ +{ + "settings_version": "0.0.6", + "datasets_dir": "/app/datasets", + "weights_dir": "weights", + "runs_dir": "runs", + "uuid": "e9f2075fc19916239a376a302c9631266f63b2fead1a3a29759f6048a7455a2e", + "sync": true, + "api_key": "", + "openai_api_key": "", + "clearml": true, + "comet": true, + "dvc": true, + "hub": true, + "mlflow": true, + "neptune": true, + "raytune": true, + "tensorboard": false, + "wandb": false, + "vscode_msg": true, + "openvino_msg": true +} \ No newline at end of file diff --git a/dashboard/.gitignore b/dashboard/.gitignore index a547bf3..7af0368 100644 --- a/dashboard/.gitignore +++ b/dashboard/.gitignore @@ -22,3 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? +.config +.config/* \ No newline at end of file diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 568f10e..e1eec9c 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -143,6 +143,21 @@ function App() { const [logsVisible, setLogsVisible] = useState(true); const [processingMedia, setProcessingMedia] = useState(null); const [activeTab, setActiveTab] = useState('dashboard'); // dashboard, settings + + // Sync state for original video playback + const [syncedTime, setSyncedTime] = useState(0); + const [isSyncedPlaying, setIsSyncedPlaying] = useState(false); + const [syncTrigger, setSyncTrigger] = useState(0); + + const handleClipPlay = (startTime) => { + setSyncedTime(startTime); + setIsSyncedPlaying(true); + setSyncTrigger(prev => prev + 1); + }; + + const handleClipPause = () => { + setIsSyncedPlaying(false); + }; useEffect(() => { // Encrypt Gemini Key too for consistency if desired, but user asked specifically about Social integration not saving well. @@ -461,7 +476,15 @@ function App() { {/* Video Preview */} - {processingMedia && } + {processingMedia && ( + + )} {/* Logs Terminal */}
@@ -517,6 +540,8 @@ function App() { jobId={jobId} uploadPostKey={uploadPostKey} uploadUserId={uploadUserId} + onPlay={(time) => handleClipPlay(time)} + onPause={handleClipPause} /> ))}
diff --git a/dashboard/src/components/ProcessingAnimation.jsx b/dashboard/src/components/ProcessingAnimation.jsx index 92531d6..c8ddec1 100644 --- a/dashboard/src/components/ProcessingAnimation.jsx +++ b/dashboard/src/components/ProcessingAnimation.jsx @@ -1,9 +1,11 @@ -import React, { useEffect, useState } from 'react'; -import { Scan, Scissors, Activity, Radio, CheckCircle } from 'lucide-react'; +import React, { useEffect, useState, useRef } from 'react'; +import { Scan, Scissors, Activity, Radio, CheckCircle, Play } from 'lucide-react'; -const ProcessingAnimation = ({ media, isComplete }) => { +const ProcessingAnimation = ({ media, isComplete, syncedTime, isSyncedPlaying, syncTrigger }) => { const [videoSrc, setVideoSrc] = useState(null); const [isYouTube, setIsYouTube] = useState(false); + const videoRef = useRef(null); + const iframeRef = useRef(null); useEffect(() => { if (!media) return; @@ -19,26 +21,141 @@ const ProcessingAnimation = ({ media, isComplete }) => { } }, [media]); + // Handle Sync Playback for Local Video + useEffect(() => { + if (!isYouTube && videoRef.current) { + if (isSyncedPlaying) { + // Sync Mode: Seek to time and Play + videoRef.current.currentTime = syncedTime; + videoRef.current.play().catch(e => console.log("Auto-play prevented", e)); + videoRef.current.loop = false; + videoRef.current.muted = true; // Keep muted to avoid double audio with clip + } else { + // Stop Sync: Pause + videoRef.current.pause(); + + // If Analysis Complete and we just stopped syncing (paused clip), we might want to return to ambient loop? + // User issue: "ahora el video loop original que sale oscurito ahora bien pero es una imagen estatica no se estΓ‘ reproduciendo el video en bucle como antes" + // This means when NOT synced, it should loop. + + // HOWEVER, previously user asked: "si pauso el video preview y lo reanudo el video original se vuelve al princpio en vez de contnuar igual" + // This implies: + // 1. If I PAUSE the clip -> Left video should PAUSE (static image) so it can resume. + // 2. If I STOP (or it finishes? or just idle state?) -> It should LOOP. + + // The problem is we only have onPause from the clip. + // Maybe we need to distinguish "Pause" vs "Idle/Stop". + // But currently we just get `isSyncedPlaying = false`. + + // If the user wants "resume from where left off", it MUST be static (paused). + // If the user wants "loop when not playing", it MUST play. + // These are contradictory for the "Paused" state. + + // BUT, maybe the "loop original" refers to the initial state BEFORE any clip is played? + // OR when the clip finishes? + + // Let's look at the logic: + // isSyncedPlaying is true ONLY when a clip is playing. + // When clip pauses, isSyncedPlaying becomes false. + + // If we want it to loop "como antes", we should set it to loop. + // But then we lose the "resume" position because it starts looping. + // Unless... we only loop if we haven't started syncing yet? Or if explicitly reset? + + // Wait, the user said: "ahora el video loop original que sale oscurito ahora bien pero es una imagen estatica" + // This likely refers to the state AFTER analysis is complete but BEFORE (or after) playing a clip. + // If I haven't touched a clip yet, `isSyncedPlaying` is false. + // In that case, it SHOULD be looping. + + // My previous change removed the "else { play loop }" block entirely. + // I need to restore the loop for the IDLE state, but keep the PAUSE for the "paused clip" state? + // That requires knowing WHY `isSyncedPlaying` is false. + + // Actually, if `isSyncedPlaying` is false, it means no clip is controlling it. + // If I want it to loop in the background, I can just let it loop. + // BUT if I play a clip later, it will jump to the sync time anyway (handled by the `if (isSyncedPlaying)` block). + // The only issue is if I PAUSE the clip, `isSyncedPlaying` becomes false, and if I immediately start looping, + // visually it might jump or start moving when it should be "paused". + + // Let's try this: + // If `syncedTime` is 0 (or we track if we ever started syncing?), we loop. + // But `syncedTime` updates on play. + + // Alternative interpretation: The user sees it static because I removed `videoRef.current.play()` in the else block. + // If I put it back, it fixes the "loop" issue. + // Does it break the "resume" issue? + // "si pauso el video preview y lo reanudo el video original se vuelve al princpio en vez de contnuar igual" + // If I pause the clip -> `isSyncedPlaying` = false. + // If logic says -> Loop from 0. + // Then I resume -> `isSyncedPlaying` = true -> Jump to `syncedTime`. + // This actually SHOULD work fine for "resume", because `syncedTime` comes from the clip's current time. + // The only visual glitch is that while paused, the left video is looping instead of frozen on the frame. + + // If the user accepts that "Paused Clip" = "Background Loop", then we are good. + // If the user wants "Paused Clip" = "Frozen Frame" AND "Idle" = "Background Loop", we need more state. + // But typically "Idle" implies we aren't focusing on a clip. + + // Let's restore the loop behavior because "video loop original... es una imagen estatica" sounds like a bug to them. + + if (isComplete) { + videoRef.current.loop = true; + videoRef.current.play().catch(e => console.log("Ambient play prevented", e)); + } + } + } + }, [syncedTime, isSyncedPlaying, isYouTube, isComplete, syncTrigger]); + + // Handle Sync Playback for YouTube (Basic Iframe Control via PostMessage) + useEffect(() => { + if (isYouTube && iframeRef.current && videoSrc) { + const iframeWindow = iframeRef.current.contentWindow; + if (isSyncedPlaying) { + // Seek and Play + iframeWindow.postMessage(JSON.stringify({ event: 'command', func: 'seekTo', args: [syncedTime, true] }), '*'); + iframeWindow.postMessage(JSON.stringify({ event: 'command', func: 'playVideo', args: [] }), '*'); + } else { + // Pause + // iframeWindow.postMessage(JSON.stringify({ event: 'command', func: 'pauseVideo', args: [] }), '*'); // Removed pause to allow loop if needed, but YT embeds are tricky with custom loops via API. + // For now, let's just pause YouTube as complex looping is harder without state. + iframeWindow.postMessage(JSON.stringify({ event: 'command', func: 'pauseVideo', args: [] }), '*'); + } + } + }, [syncedTime, isSyncedPlaying, isYouTube, videoSrc, syncTrigger]); + + const getYouTubeId = (url) => { const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; const match = url.match(regExp); return (match && match[2].length === 11) ? match[2] : null; }; + const containerClasses = `relative w-full aspect-video rounded-xl overflow-hidden bg-black border border-white/10 shadow-2xl mb-8 group animate-[fadeIn_0.5s_ease-out] transition-all duration-500 + ${isComplete && !isSyncedPlaying ? 'grayscale brightness-50' : ''} + ${isSyncedPlaying ? 'ring-2 ring-primary ring-offset-2 ring-offset-black shadow-primary/20' : ''}`; + + const getVideoOpacityClass = () => { + if (isSyncedPlaying) return 'opacity-100'; // Playing: Full visibility + if (isComplete) return 'opacity-30'; // Idle Result: Darker + return 'opacity-40 grayscale group-hover:grayscale-0'; // Processing: Dark + Grayscale effect + }; + return ( -
+
{/* Video Layer */} -
+
{isYouTube && videoSrc ? (