Repository navigation
fix(preview): hold last-good frame to hide black flash on seek/wra 8000 p - #17
Merged
Merged
Conversation
Scrubbing the playhead and looping back to the start both trigger a 1–3 frame window where `<video>.currentTime = newT` is set but the decoder hasn't produced a frame yet. drawImage(<video>) returned empty/transparent pixels and the unconditional black background-clear flashed through, breaking the instrument feel of the loop. PreviewRuntime now snapshots each ready video layer into a per-layerId ImageBitmap (throttled to 100ms/layer) and hands it to the backend as a fallback while the element is mid-seek and the cam is in-range. All three backends honour preferFallback in their source-to-texture path. Out-of-range layers stay black (correct empty state); cam removal evicts and closes cached bitmaps to prevent leaks. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
PreviewRuntime: hält das letzte erfolgreich gerenderte<video>-Frame alsImageBitmap, gedrosselt auf 100ms/Layer<video>mid-seek ist (seeking || readyState < 2) und der Cam in-range, reicht der Runtime das gehaltene Bitmap alsfallbackdurch — Backend zeichnet das Bitmap statt der leeren<video>, der schwarze Background-Clear schlägt nicht mehr durchWhy
Beim Scrub und Loop-Wrap setzt
VideoElementPool.syncSlotvideo.currentTime = sourceT. Der Decoder braucht 1–3 Frames bisseekedfeuert; in der Lücke liefertdrawImage(<video>)empty/transparent pixel und der unconditional Background-fillStyle="#000"(canvas2d) bzw.clearValue: { r:0,g:0,b:0,a:1 }(webgpu) flasht durch. Das brach das Instrument-Gefühl beim Loopen.Architektur
LayerSource.videoum optionalesfallback?: ImageBitmap+preferFallback?: booleanerweitertPreviewRuntime(geteilt für alle drei Backends — DRY, kein Backend-Lifecycle-Coupling)VideoElementPool.isInRange(clipId, masterT)damit der Runtime „Cam außerhalb [0, dur)" (→ Schwarz korrekt) von „Cam seekt" (→ Hold) unterscheidetcanvas2d,webgpu,webgl2honorieren alle dreipreferFallbackin ihren Source-to-Texture-PfadenTest plan
npm test(unit) — 667/667 grün, inkl. 5 neue Cache-Tests + 5 neueisInRange-Testsnpm run test:browser(render slice isoliert) — 70/70 grün, inkl. 2 neue pixel-level Canvas2D-Fallback-Tests🤖 Generated with Claude Code