perf: smoother video player — rAF-driven scrub bar, less cold-start stutter
scrub fill/time were driven off timeupdate, which browsers fire irregularly (a handful of times a second) — visible as the bar stepping instead of gliding. now driven by requestAnimationFrame while playing (display refresh rate), with a direct sync on pause/seeked so it still tracks immediately when not running.\n\npreload=none meant zero data was fetched until the play button was pressed, causing a visible stall right at playback start. preload=metadata lets the browser prime the connection and read the moov atom ahead of time without fetching the full video for visitors who never press play.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
<figure class="tui__preview">
|
||||
{{ if $video }}
|
||||
<div class="player">
|
||||
<video preload="none" playsinline{{ with .Params.thumbnail }} poster="{{ . }}"{{ end }}>
|
||||
<video preload="metadata" playsinline{{ with .Params.thumbnail }} poster="{{ . }}"{{ end }}>
|
||||
<source src="{{ $video }}" type="video/mp4">
|
||||
</video>
|
||||
<button class="player__big" type="button" aria-label="play">▶</button>
|
||||
|
||||
Reference in New Issue
Block a user