You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 60c02c1
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(web): video previews attach listeners on their element and share one visibility observer
Problem: MediaVideoPlayer stored its <video> element in state only so two
effects could bind to it. That cost every video an extra render on mount, gave
each video its own IntersectionObserver, and tracked "which element is
playing" to work around remounts.
Fix: the video's ref callback owns the visibility/fullscreen listeners and
pauses on detach (also resetting the playing flag, since a detached element's
pause event never fires). The preload trigger moves to the wrapper's ref
callback and uses the shared observeIntersection helper, so all video
previews share one observer. Playing state becomes a boolean.
Effects: MediaVideoPlayer 2 -> 0. Both were element lifetime work, which a
ref callback with cleanup models directly.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments