Repository navigation
fix(convert): pre-convert data URIs to Blob URLs to reduce HTML flicker - #678
aniruddhaadak80 wants to merge 3 commits into
Conversation
In standalone one-file mode, videos are embedded as base64 data URIs in data-background-video attributes. On slide transitions, the browser must re-decode the massive base64 string, causing a visible blank frame. Add a preCreateBlobUrls() function that runs at RevealJS ready time and converts all data-URI video sources to Blob URLs via fetch()+createObjectURL. Subsequent transitions use the cached Blob objects instead of re-decoding. Fixes jeertmans#426 Signed-off-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
for more information, see https://pre-commit.ci
Up to standards ✅🟢 Issues
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
=======================================
Coverage 79.10% 79.10%
=======================================
Files 23 23
Lines 2178 2178
=======================================
Hits 1723 1723
Misses 455 455 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Diagnosis of the two red checks on this head (0fc66d4), neither is caused by this diff (which only touches revealjs/firebase templates): - markdown-link-check: 2 archive.org links in paper/paper.md returned 503 at check time (run 33259629185). External/archive-side flake, file untouched by this PR - safe to rerun/ignore. - pre-commit.ci ty hook: failed downloading networkx from files.pythonhosted.org (DNS temporary failure in name resolution). Transient infra, ruff/codespell/all else passed. Retriggering the checks should clear it. |
|
#693 has little to do with HTML conversion, since it's about the Qt presenter, so I don't see why it's related. |
|
You are right, and I owe you a correction: #693 touches manim_slides/present/player.py (the Qt presenter) while my PR touched the revealjs/firebase HTML templates - zero file overlap, so my superseded claim was wrong. I misread a same-symptom fix (visual flicker) as a same-layer fix. Sorry for the noise. The template-side data-URI to Blob pre-conversion may still be a valid improvement on its own - would you like me to reopen this for proper review, or prefer I leave it closed? |
What Problem This Solves
In standalone one-file HTML mode (
--one-file), slide transitions flicker with a brief blank frame. This happens because videos are embedded as base64 data URIs indata-background-videoattributes, and the browser must re-decode the massive base64 string on each transition.Root Cause
The existing
fixBase64VideoBackgroundfunction recombines split base64 sources but does not prevent the decode delay. Each time RevealJS creates a new<video>element for a slide, the browser parses and decodes the inline base64 data, which takes hundreds of milliseconds for large videos.What Changed
preCreateBlobUrls()function that runs at RevealJSreadytimeBlobURLs viafetch()+URL.createObjectURL()How Tested
Behavior Trade-offs
one_filemode with data URIsFixes #426