Includes: - Extended caption styling (font, shadow, dimmed color, bg toggle) - Media server, subtitle downloader, VTT parser, processing modal - Waveform tiers, thumbnail/timeline improvements, transport controls - Hybrid download model, dependency management, clip export enhancements - 21 chat summaries, 2 implementation plans, 2 design specs Co-authored-by: Cursor <cursoragent@cursor.com>
3.8 KiB
3.8 KiB
Hybrid Download Model + Auto-Defocus URL Input
Task Description
Two user-requested improvements:
- Hybrid download model: Download a low-resolution (≤360p H.264+AAC) version for immediate preview/scrubbing/waveform/thumbnail generation, while downloading the best available quality in the background for export. Clips are cut from the best-quality file.
- Auto-defocus URL input: After pasting a URL and triggering submit, blur the input field so keyboard shortcuts (I, O, etc.) don't accidentally modify the URL.
Changes Made
Session State Refactor (src/lib/stores/videoSession.svelte.ts)
- Replaced single
localFilePath/downloadProgress/downloadStatuswith dual-track state:previewFilePath/previewProgress/previewStatus— for the 360p previewexportFilePath/exportProgress/exportStatus— for the best-quality export
- Preview format:
bv*[vcodec^=avc1][height<=360]+ba[acodec^=mp4a]/b[ext=mp4][height<=360]/worst[ext=mp4]/worst - Export format:
bv*+ba/b(best available, any codec since ffmpeg handles export) beginDownload()now:- Checks cache for preview → downloads if needed → triggers post-processing (waveform, thumbnails, keyframes)
- Checks cache for export → downloads in background (fire-and-forget)
- Files stored in separate subdirectories:
video-clipper/preview/andvideo-clipper/export/
Rust Backend (src-tauri/src/commands/video.rs)
start_downloadnow acceptsformat_specandvariantparameterscheck_cached_downloadnow accepts avariantparameter to check the correct subdirectory- Helper
variant_dir()builds$TEMP/video-clipper/{variant}/paths - Diagnostic logging includes variant name for easier debugging
Download Manager (src-tauri/src/services/download_manager.rs)
start_downloadnow acceptsformat_spec: &strparameter instead of hardcoding format selection- Format string passed through from the frontend call
Frontend Bindings (src/lib/bindings/video.ts)
startDownloadnow takesformatSpecandvariantparameterscheckCachedDownloadnow takes avariantparameter
VideoPlayer (src/lib/components/VideoPlayer.svelte)
- Uses
previewFilePath/previewStatusinstead of old single-track fields - Download progress shows "Downloading preview…" label
ExportDialog (src/lib/components/ExportDialog.svelte)
- Uses
exportFilePath/exportStatus/exportProgressfor export readiness - Shows "Downloading best quality (X%)…" while export download is in progress
StatusBar (src/lib/components/StatusBar.svelte)
- Shows dual progress: preview download → export download → ready to export
- Contextual status messages for each download phase
UrlInput (src/lib/components/UrlInput.svelte)
- Added
bind:this={inputEl}reference to input element blurInput()called at the start ofhandleSubmit()— defocuses immediately on paste/enter- Keyboard shortcuts (I, O, etc.) now work immediately after submitting a URL
Lessons Learned
- Storing preview and export files in separate subdirectories (
preview/,export/) keeps cache management clean and avoids filename collisions between quality variants. - Fire-and-forget pattern for background export download (
.catch()at call site) keeps the preview flow responsive without blocking on the best-quality download. - The
variantparameter threading from frontend → Rust command → download manager keeps the API clean and extensible for future quality tiers.
Follow-Up Items
- Consider showing export download progress in the timeline/player area as a subtle indicator
- The export format
bv*+ba/bmay download VP9/WebM — this is fine for ffmpeg export but won't play in WKWebView. The preview file handles playback. - Old flat
video-clipper/cache was cleared; users with existing caches in the old location won't get cache hits (harmless — just re-downloads)