Skip to content

feat: enhance-ffmpeg: Improve UI response and updates when extension downloads multiple files, open / close ffmpeg isntance on demand#30

Merged
jvillegasd merged 3 commits intomainfrom
feat/enhance-ffmpeg
Feb 28, 2026
Merged

feat: enhance-ffmpeg: Improve UI response and updates when extension downloads multiple files, open / close ffmpeg isntance on demand#30
jvillegasd merged 3 commits intomainfrom
feat/enhance-ffmpeg

Conversation

@jvillegasd
Copy link
Owner

This pull request refactors how video formats are represented and handled throughout the codebase by replacing string literals with a strongly-typed VideoFormat enum. This improves type safety, maintainability, and consistency across all modules that work with video formats. Additionally, the changes include some minor formatting and code style improvements, as well as a small feature to pre-warm FFmpeg in the offscreen worker.

Video format handling improvements:

  • Introduced a VideoFormat enum in src/core/types.ts to replace all string literal usages of video format identifiers (e.g., "direct", "hls", "m3u8", "unknown") throughout the codebase. All format comparisons and assignments now use VideoFormat enum members for better type safety and clarity.
  • Updated all relevant modules—including detection handlers, download manager, popup scripts, and utility functions—to use the new VideoFormat enum instead of string literals when checking or assigning video formats. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22]

Offscreen worker and code style improvements:

  • Refactored several functions in src/offscreen/offscreen.ts for improved readability and consistency, including multi-line argument formatting, better logging, and clearer function signatures. [1] [2] [3] [4] [5] [6] [7] [8]
  • Added support for a new message type (MessageType.WARMUP_FFMPEG) to pre-warm FFmpeg in the offscreen worker, improving performance for subsequent video processing tasks.

jvillegasd and others added 3 commits February 28, 2026 00:42
Replace `type VideoFormat = "direct" | "hls" | "m3u8" | "unknown"` with
a string enum following the existing DownloadStage/MessageType pattern.
Updates all 40+ comparison sites across 13 files to use enum values
(VideoFormat.DIRECT, .HLS, .M3U8, .UNKNOWN) instead of magic strings.
Lowercase string values preserve backward compatibility with IndexedDB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove redundant IndexedDB read from the onProgress hot path — the
in-memory AbortController signal check already covers cancellation.
With concurrent HLS downloads firing progress callbacks many times per
second, each getDownload() call was blocking the event loop and causing
button clicks (start, stop, cancel) to queue up and feel unresponsive.

Also parallelize cleanupStaleChunks() at startup so orphaned chunk
deletion no longer blocks the service worker sequentially.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jvillegasd jvillegasd self-assigned this Feb 28, 2026
@github-actions github-actions bot changed the title feat/enhance-ffmpeg: Improve UI response and updates when extension downloads multiple files, open / close ffmpeg isntance on demand feat: enhance-ffmpeg: Improve UI response and updates when extension downloads multiple files, open / close ffmpeg isntance on demand Feb 28, 2026
@jvillegasd jvillegasd merged commit 9f2a21e into main Feb 28, 2026
1 check passed
@jvillegasd jvillegasd deleted the feat/enhance-ffmpeg branch February 28, 2026 08:51
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