fix(core): parent-frame proxy bypass, data-preload-eager opt-out, configurable threshold

- Player: _adoptIframeMedia now skips media with preload="metadata" or
  "none", preventing parent-frame proxies from bypassing the preloader.
  MutationObserver extended to watch preload attribute changes so proxies
  are created just-in-time when the preloader promotes a clip.

- init.ts: lazy-mode demotion loop skips elements with data-preload-eager,
  letting power users keep specific clips eagerly buffered.

- mediaPreloader: reads window.__HF_LAZY_PRELOAD_THRESHOLD as an override,
  falling back to the default 6.
This commit is contained in:
Miguel Ángel
2026-05-11 19:37:06 -07:00
parent a96d99680f
commit 35eab94e69
5 changed files with 82 additions and 4 deletions
+4
View File
@@ -1263,6 +1263,10 @@ export function initSandboxRuntimeModular(): void {
// timed clips and would never promote them back.
for (const mediaEl of mediaEls) {
if (!mediaEl.hasAttribute("data-start")) continue;
// Power-user opt-out: data-preload-eager keeps a clip eagerly buffered
// even under lazy mode, useful when a specific clip must be instantly
// available regardless of playhead proximity.
if (mediaEl.hasAttribute("data-preload-eager")) continue;
if (mediaEl.preload === "auto" || mediaEl.preload === "") {
mediaEl.preload = "metadata";
// Kick off the metadata fetch explicitly — some browsers (Chrome Lite