feat(video): support batch upload of multiple videos - #109
Conversation
Selecting or dropping more than one video now queues them and processes each sequentially through the existing single-file pipeline, auto- downloading every result. A batch queue UI shows per-file status (pending / processing / done / error). Single-video selection and image handoff keep their original behavior. Sequential processing is intentional: video decode/encode is CPU/GPU bound, so reusing the proven single-file pipeline one item at a time is correct rather than a compromise.
|
Thanks for the contribution. I tested this commit after merging the current Validation completed:
I found one reproducible queue-state issue. After the first two-file batch completed, selecting a second two-file batch appended the new items to the completed queue. The UI contained four rows and reported Please reset the completed queue when a new selection starts while The PR currently adds no tests. Please add focused coverage for a second batch after completion, returning to single-file mode, failure-then-continue behavior, and automatic download/resource cleanup. |
A finished queue was never cleared, so the next selection appended to it: the UI kept the old rows and the summary counted them, reporting 成功 1/4 for a second two-file batch instead of 成功 0/2. Returning to single-file mode also left the stale queue visible, because the clearing path only ran from the reset button and never from a file selection. Queue rules now live in src/video/videoBatchQueue.js, free of DOM access so they can be unit-tested. A new selection drops an idle queue, while appending is preserved while a batch is actively processing. The single-file path re-renders the emptied queue to hide stale batch UI. Adds tests/video/videoBatchQueue.test.js covering a second batch after completion, returning to single-file mode, failure-then-continue, automatic download emission, and queue release on reselection.
|
Thanks for the detailed validation — the queue-state issue reproduced exactly as you described, and both symptoms had the same root cause. Root cause: the queue was cleared in Fix:
Testability: the queue rules moved into Tests (
I checked the tests actually cover the regression rather than just passing: reverting the one-line reset makes 3 of them fail, and restoring it turns them green again. Verification: production build passes. Full suite here is 1358 passed / 29 skipped / 6 failed — the 6 are the extension-packaging and Happy to adjust naming or split the module differently if you'd prefer it shaped another way. |
GargantuaX
left a comment
There was a problem hiding this comment.
Thanks for the follow-up. I revalidated 081bcd0 after applying it cleanly to the current main (1368064), rather than relying on GitHub's stale synthetic merge ref.
The main path is in good shape:
- the 7 focused queue tests pass;
- the full current suite passes: 1662 passed, 33 skipped, 0 failed;
- the production build passes;
- a real Chromium run with two repository videos completed both queue items and emitted two download events with the expected filenames.
There is one blocking UI-wiring issue when a selection arrives during an active batch. startBatchSelection(batch) correctly preserves an active queue, but handleIncomingFiles() only enqueues when videoFiles.length > 1. Selecting or dropping exactly one video while the batch is running therefore falls through to the single-file path and calls setFile(file) against the shared page state.
Browser reproduction:
- Select
119-original.mp4and114-original.mp4together. - Wait until the first queue row is
processingand the second ispending. - Select one additional video,
20260615-current-export.mp4. - The queue still shows the first file processing and the second pending, but the main player/metadata/status switch to the new 1280×720 single video (
视频已载入 / 准备就绪). The new file is not present in the queue.
This can invalidate/cancel the active job through the shared state.file / jobId while the queue still reports the original item as processing. While batch.processing is true, any incoming video selection (including exactly one video) should either append to the active queue or be explicitly rejected; it must not call the single-file setFile() path.
Please add coverage at the handleIncomingFiles/UI-routing boundary for a one-video selection during an active batch. The current queue-module append test calls startBatchSelection() and enqueueBatchFiles() directly, so it does not exercise the failing integration branch.
What
Adds support for uploading and processing multiple videos in one go. Until now the video page handled a single file at a time.
How it works
multiple, and drag-and-drop accepts multiple files.setFile→runExport), auto-downloading every result.pending/processing/done/error.Why sequential (not parallel)
Video decode/encode is CPU/GPU-bound, so running one item at a time through the proven pipeline is the correct design rather than a compromise — parallel encodes would just contend for the same resources.
Scope of changes
public/video-preview.html—multipleon the file input + batch-queue markup and stylessrc/video-app.js— batch queue, sequential processing, auto-download, graceful fallback to single-file modeNo new dependencies. No changes to the watermark-removal algorithm or the single-file flow.