optimize video load

This commit is contained in:
2026-07-15 14:20:48 +02:00
parent 581d35c983
commit b6e92cd6f2
2 changed files with 41 additions and 0 deletions

View File

@@ -708,6 +708,14 @@ class v0ck {
}
}
// Upgrade preload from 'metadata' → 'auto' for video elements so the browser
// starts buffering data immediately during player setup. With just 'metadata',
// play() triggers a brand-new range request and the user sees the loader spinner
// until enough data arrives. 'auto' closes that gap for both autoplay and manual play.
if (video.tagName === 'VIDEO' && video.preload !== 'auto') {
video.preload = 'auto';
}
// Attempt autoplay and show overlay if blocked
const shouldAutoplay = !isBlurredDetail && window.f0ckSession?.disable_autoplay !== true;
if (shouldAutoplay) {