Skip to content

Faster paste-to-preview: instant quality boxes + parallel downloads + cache#4

Open
arnabbagxd wants to merge 1 commit into
mainfrom
feat/faster-preview
Open

Faster paste-to-preview: instant quality boxes + parallel downloads + cache#4
arnabbagxd wants to merge 1 commit into
mainfrom
feat/faster-preview

Conversation

@arnabbagxd

Copy link
Copy Markdown
Owner

The problem

Pasting a link showed a spinner while the app did a slow yt-dlp metadata lookup before revealing the quality boxes — typically a few seconds, and measured at ~22s on a throttled test. That wait reads as "buffering" and hurts the experience.

The fix (perceived + real speed)

  • Instant quality boxes — boxes appear immediately on paste (Best/1080p/720p/480p). You can tap and start downloading right away; the real lookup runs in the background and refines the boxes to the video's actual resolutions, with a subtle "Checking exact qualities…" indicator. Image posts switch to the image flow when detected.
  • Lookup cache — re-pasting the same link (or reopening it) is instant, no lookup at all.
  • Faster downloads--concurrent-fragments 4 fetches the video in parallel pieces (throughput boost on YouTube/HLS/DASH).
  • Snappier paste — debounce trimmed 300ms → 150ms.

Net effect: the app feels instant even when the network/site is slow, without losing the "show the video's real resolutions" behavior.

Verified

  • swift build clean; app launches.
  • Real 360p download with the new --concurrent-fragments arg produced a valid MP4 (pipeline intact).

Notes

  • Tradeoff: boxes may subtly update once the real resolutions arrive (e.g. a 4K video adds a 4K box) — a gentle refine, far better than a multi-second spinner.
  • Off main; swift test needs full Xcode (not run here).

🤖 Generated with Claude Code

Pasting a link used to block on a slow yt-dlp metadata lookup (seconds, sometimes
20s+) behind a spinner. Now:

- Quality boxes appear instantly with a common set (Best/1080p/720p/480p); the real
  lookup runs in the background and refines the boxes to the video's actual
  resolutions (with a subtle 'Checking exact qualities…' indicator). Image posts
  switch to the image flow when detected.
- Lookups are cached per URL, so re-pasting the same link is instant.
- Downloads use --concurrent-fragments 4 for parallel fragment fetching.
- Paste debounce trimmed 300ms -> 150ms.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant