Skip to content

fix(convert/html): fix flickering on slide change with --one-file - #663

Open
mmustafasenoglu wants to merge 3 commits into
jeertmans:mainfrom
mmustafasenoglu:fix/html-flickering-one-file
Open

mmustafasenoglu wants to merge 3 commits into
jeertmans:mainfrom
mmustafasenoglu:fix/html-flickering-one-file

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Closes #426

When using --one-file mode, base64-encoded video data URIs are split into multiple <source> elements by RevealJS. The existing fixBase64VideoBackground only ran on the ready event, so dynamically created video elements (when navigating to slides outside the initial viewDistance) were never fixed, causing a visible blank frame flicker on slide transitions.

This adds a slidechanged handler that re-runs the fix on every slide transition. A WeakSet tracks already-processed backgrounds to avoid duplicate MutationObserver setup.

When using --one-file mode, base64-encoded video data URIs are split
into multiple <source> elements by RevealJS. The existing fix only ran
on the 'ready' event, so dynamically created video elements (when
navigating to slides outside the initial viewDistance) were never fixed.

This adds a 'slidechanged' handler that re-runs the fix on slide
transitions, using a WeakSet to avoid duplicate processing of
already-fixed backgrounds.

Closes jeertmans#426
Copilot AI lite review requested due to automatic review settings August 7, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added waiting review Waiting review (or response) by a maintainer waiting triage This issue or PR needs to be labeled accordingly. labels Aug 7, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jeertmans jeertmans left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mmustafasenoglu, thanks for your contribution! I'll properly review this later, but can you make sure to address my small request change, and also sync the changes to docs/source/_static/template.html and docs/source/_static/firebase_sync_demo.html. Thanks!

Comment thread manim_slides/templates/firebase_sync.html Outdated
@jeertmans jeertmans added html-convert Related to converting to HTML slides and removed waiting triage This issue or PR needs to be labeled accordingly. labels Aug 7, 2026
- firebase_sync.html: same WeakSet + slidechanged handler
- docs/source/_static/template.html: sync with main template
- docs/source/_static/firebase_sync_demo.html: sync with firebase template
- revealjs.html: var -> const (review feedback)
@mmustafasenoglu

Copy link
Copy Markdown
Author

Done! Changes applied:

  • manim_slides/templates/firebase_sync.html: same WeakSet + slidechanged fix
  • manim_slides/templates/revealjs.html: var → const per your suggestion
  • docs/source/_static/template.html: synced with main template
  • docs/source/_static/firebase_sync_demo.html: synced with firebase template

@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.09%. Comparing base (722c2ae) to head (d2820ee).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #663      +/-   ##
==========================================
- Coverage   79.23%   79.09%   -0.14%     
==========================================
  Files          23       23              
  Lines        2177     2177              
==========================================
- Hits         1725     1722       -3     
- Misses        452      455       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeertmans

Copy link
Copy Markdown
Owner

Hi @mmustafasenoglu, my apologies for the delay. I have reviewed your changes and tested locally, and I cannot observe any repeatable, visual change. I rendered the ConvertExample slides from example.py in 4K and converted to HTML with --one-file, and I cannot see any difference. I.e., the slides transitions are usually smooth, but flickering can occur in some cases, both using the reference Manim Slides version and yours.

Do you have a set of example slides on which I could validate your contribution?

@jeertmans jeertmans added waiting author Waiting author response and removed waiting review Waiting review (or response) by a maintainer labels Aug 13, 2026
@aniruddhaadak80

Copy link
Copy Markdown
Contributor

Hi @mmustafasenoglu, nice fix! I have PR #678 open that also addresses #426 from a different angle — it pre-converts data URIs to Blob URLs at load time so the browser doesn't re-decode massive base64 strings on every transition.

Your approach (listening to slidechanged + WeakSet tracking) handles the root cause for dynamically created slides, while the Blob URL pre-conversion is a complementary performance optimization. Both can coexist without conflicts since they modify non-overlapping sections of the templates.

FYI @jeertmans — these two PRs are complementary and can be merged together.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

html-convert Related to converting to HTML slides waiting author Waiting author response

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Flickering at slide change for stand alone html

4 participants