Skip to content

fix(engine): await dynamic CSS backgrounds before capture#2343

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/dynamic-css-background-readiness
Open

fix(engine): await dynamic CSS backgrounds before capture#2343
miguel-heygen wants to merge 1 commit into
mainfrom
fix/dynamic-css-background-readiness

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

  • wait for newly assigned inline CSS background images to decode after each deterministic seek
  • cache successfully decoded URLs per page so steady-state frames avoid repeated decode work
  • retry transient decode failures on later frames

Reproduction

Feedback source: https://heygen.slack.com/archives/C0BGC335AQY/p1783954331452369

A deterministic delayed-image fixture reproduced the race on published 0.7.56: the first two frames after every row switch captured transparent pixels. With this patch, all 90 frames used the expected row, including boundary frames 16, 31, 46, 61, and 76.

Tests

  • bun run typecheck in packages/engine
  • bunx vitest run src/services/frameCapture-*.test.ts (96 tests)
  • full repository build
  • pre-commit lint, format, fallow, tracked-artifact, and typecheck hooks
  • 90-frame delayed-response PNG-sequence before/after audit

};
const decoded = (root.__hf_css_background_decoded ??= new Set<string>());
const urls: string[] = [];
const urlPattern = /url\(\s*(?:"((?:\\.|[^"])*)"|'((?:\\.|[^'])*)'|([^)'"\s][^)]*?))\s*\)/g;
};
const decoded = (root.__hf_css_background_decoded ??= new Set<string>());
const urls: string[] = [];
const urlPattern = /url\(\s*(?:"((?:\\.|[^"])*)"|'((?:\\.|[^'])*)'|([^)'"\s][^)]*?))\s*\)/g;
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.

2 participants