From 3395ccc44a7455a4b9de73e78ab655b38b7a827d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 26 Sep 2026 23:51:19 -0700 Subject: Video previews release their media off screen; a paused player kept buffering the whole clip. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01VhUKyXKtsJ67QAFfb7QR9D --- src/features/messages.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/features/messages.js b/src/features/messages.js index bc74ba9..2b0af4a 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -4703,9 +4703,19 @@ export function messagesFeature(ctx) { }); v.onvolumechange = () => btn.setSound(!v.muted); // the native control's own mute keeps the button honest box.append(btn); + // Off screen, a muted preview lets go of its media entirely (a paused + // player keeps buffering the whole file — a scroll past ten clips + // streamed seventy megabytes); back in view it reattaches and plays + // from the start. A clip the reader unmuted keeps its place instead. watchPlayer(v, - () => { if (v.paused) v.play().then(() => { box._skipMorph = true; }).catch(() => {}); }, - () => { if (!v.paused) v.pause(); }); + () => { + if (!v.getAttribute('src') && !v.getAttribute('data-lazy-src')) v.setAttribute('src', url); + if (v.paused) v.play().then(() => { box._skipMorph = true; }).catch(() => {}); + }, + () => { + if (!v.paused) v.pause(); + if (v.muted && box._skipMorph) { try { v.removeAttribute('src'); v.load(); } catch {} } + }); return box; } -- cgit v1.2.3