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 Feb 28, 2026
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how video formats are represented and handled throughout the codebase by replacing string literals with a strongly-typed
VideoFormatenum. 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:
VideoFormatenum insrc/core/types.tsto replace all string literal usages of video format identifiers (e.g.,"direct","hls","m3u8","unknown") throughout the codebase. All format comparisons and assignments now useVideoFormatenum members for better type safety and clarity.VideoFormatenum 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:
src/offscreen/offscreen.tsfor improved readability and consistency, including multi-line argument formatting, better logging, and clearer function signatures. [1] [2] [3] [4] [5] [6] [7] [8]MessageType.WARMUP_FFMPEG) to pre-warm FFmpeg in the offscreen worker, improving performance for subsequent video processing tasks.