Skip to content

Commit 7c1d72a

Browse files
sschabackerclaude
andcommitted
Stop auto-loading the first video from a folder/multi-select pick
Her real-world finding: after a hard reset, a folder pick that only populated the roster (without auto-loading anything) felt immediate, while the normal auto-load-the-first-one path had read as stuck. Likely cause - auto-loading fired a full video-load cascade (decode, frame render, metrics panels appearing) at the same moment OpenCV.js might still be mid-download, competing for attention and making an unrelated few-seconds wait look like the whole app hanging. Open folder/Select videos now just populate the roster and stop; the status line says how many were found and to click one. Better default regardless of the OpenCV theory - a batch pick is "here's what's here," not "open this one specifically." Also: "Select videos" already filters to video files (accept= "video/mp4,.mp4"), unlike "Open folder" which walks a whole directory tree by design and can't be filtered by type - a real browser limitation, not something this app can route around. Updated the button row's copy to say so directly, since pointing "Open folder" at a folder with mixed file types is exactly what triggers the browser's own scary "upload N files?" warning before any of our own filtering ever runs. Tested end to end: selecting two videos via Select videos populates the roster with both marked "Not opened yet," loads neither automatically, and clicking one loads it correctly. 75/75 tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 1845f7d commit 7c1d72a

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

‎app/index.html‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,16 @@
142142
#dropZone {
143143
border: 2px dashed var(--border);
144144
border-radius: 8px;
145-
padding: 1.25rem 1.5rem;
145+
padding: 0.85rem 1.25rem;
146146
text-align: center;
147-
margin: 1rem 0;
147+
margin: 0.75rem 0;
148148
}
149+
/* Every row in here was carrying the browser's default ~1em paragraph
150+
margin (plus, on two rows, an explicit margin-top on top of that) -
151+
the accumulated whitespace across 4 stacked rows was the real source
152+
of "still looks huge," not just the button/padding sizing fixed
153+
earlier. */
154+
#dropZone p { margin: 0.35rem 0; }
149155
#dropZone.drag-over {
150156
border-color: var(--accent);
151157
background: #eef4fb;
@@ -197,9 +203,9 @@
197203
font-size: 0.95rem;
198204
}
199205
#dropZone label:focus-within { outline: 3px solid #000; outline-offset: 2px; }
200-
#openProjectFileRow { margin-top: 1rem; font-size: 0.9rem; color: #555; }
206+
#openProjectFileRow { font-size: 0.9rem; color: #555; }
201207
#openProjectFileRow button { font-size: 0.9rem; padding: 0.3rem 0.7rem; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: white; }
202-
#openMultipleRow { margin-top: 0.5rem; font-size: 0.9rem; color: #555; }
208+
#openMultipleRow { font-size: 0.9rem; color: #555; }
203209
#openMultipleRow button { font-size: 0.9rem; padding: 0.3rem 0.7rem; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: white; }
204210
#pendingFolderFilesEl { margin-top: 0.5rem; font-size: 0.85rem; color: #555; }
205211
#projectFileSummary {
@@ -661,11 +667,7 @@
661667
<div class="app">
662668
<header class="topbar">
663669
<h1>Barnes Maze Pipeline</h1>
664-
<p class="subtitle">Load a video, then compute its median background image.</p>
665-
<details class="info-toggle">
666-
<summary>What does this mean?</summary>
667-
<p class="subtitle">Load a video, step through it frame-accurately, and compute its median background image.</p>
668-
</details>
670+
<p class="subtitle">Load a video, step through it frame-accurately, and compute its median background image.</p>
669671
</header>
670672
<div class="main">
671673
<aside class="roster" id="rosterColumn">
@@ -704,7 +706,7 @@ <h2>Videos</h2>
704706
<input type="file" id="fileInput" accept="video/mp4,.mp4">
705707
<p id="openProjectFileRow">Already tracked this one? <button type="button" id="openProjectFileBtn">Open project file</button></p>
706708
<input type="file" id="projectFileInput" accept="application/json,.json" hidden>
707-
<p id="openMultipleRow">Working through several trials? <button type="button" id="openFolderBtn">Open folder</button> <button type="button" id="selectVideosBtn">Select videos</button></p>
709+
<p id="openMultipleRow">Working through several trials? <button type="button" id="openFolderBtn">Open folder</button> (a folder with just your videos in it) or <button type="button" id="selectVideosBtn">Select videos</button> (pick specific files - filtered to videos only, so this is the one to use if your videos share a folder with other file types).</p>
708710
<input type="file" id="folderInput" webkitdirectory multiple hidden>
709711
<input type="file" id="multiVideoInput" accept="video/mp4,.mp4" multiple hidden>
710712
<p id="loadExampleRow">New here? <button type="button" id="loadExampleBtn">Load an example (test50)</button> - fetches a real sample clip and its saved analysis, no video of your own required.</p>

‎app/js/app.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,20 +1428,20 @@ function rosterEntryFor(file, opened = false) {
14281428
// The actual "load the first one, hold the rest" behavior - split out from
14291429
// handleMultipleFiles() so the roster-conflict banner's two buttons can
14301430
// resume it after her decision without duplicating this logic.
1431+
// Deliberately does NOT auto-load the first video - a batch pick (Open
1432+
// folder/Select videos) is "here's what's available," not "open this one
1433+
// specifically," and auto-loading used to fire a full video-load cascade
1434+
// (decode, frame render, metrics panels appearing) at the exact moment
1435+
// OpenCV.js might still be mid-download, which read as the whole app being
1436+
// stuck rather than one unrelated thing still loading. Populating the
1437+
// roster and waiting for a click is calmer either way, and matches how
1438+
// the roster already treats a video seen via a folder pick but not yet
1439+
// opened - this just stops making an exception for the first one.
14311440
async function proceedWithFolderFiles(videoFiles, skippedCount) {
14321441
videoFiles.forEach((f) => knownFiles.set(videoKeyFor(f), f));
1433-
1434-
// Awaited, and the summary status set AFTER, on purpose: loadVideo()
1435-
// sets its own "Loaded X: N frames" status partway through this same
1436-
// call - setting the "found N videos" message BEFORE that meant it
1437-
// got silently overwritten within the same action and was never
1438-
// actually seen. This message is deliberately the LAST word on what
1439-
// just happened, not the first.
1440-
await loadVideoOrSwitch(videoFiles[0]);
1441-
const remaining = videoFiles.length - 1;
1442+
await renderRosterList();
14421443
setStatus(
1443-
`Loaded ${videoFiles[0].name} (1 of ${videoFiles.length}).` +
1444-
(remaining > 0 ? ` ${remaining} more in the Videos list on the left.` : '') +
1444+
`Found ${videoFiles.length} video${videoFiles.length === 1 ? '' : 's'} - click one in the Videos list on the left to open it.` +
14451445
(skippedCount > 0 ? ` (${skippedCount} other file${skippedCount === 1 ? '' : 's'} in that selection skipped - not .mp4.)` : ''),
14461446
'success'
14471447
);

0 commit comments

Comments
 (0)