fix(web): video stealing focus when it plays again when looping (#26704)

This commit is contained in:
Snowknight26 2026-03-05 09:41:27 -06:00 committed by GitHub
parent c259fee309
commit 09fabb36b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,7 @@
);
let isScrubbing = $state(false);
let showVideo = $state(false);
let hasFocused = $state(false);
onMount(() => {
// Show video after mount to ensure fading in.
@ -59,6 +60,7 @@
$effect(() => {
// reactive on `assetFileUrl` changes
if (assetFileUrl) {
hasFocused = false;
videoPlayer?.load();
}
});
@ -151,7 +153,10 @@
onseeking={() => (isScrubbing = true)}
onseeked={() => (isScrubbing = false)}
onplaying={(e) => {
e.currentTarget.focus();
if (!hasFocused) {
e.currentTarget.focus();
hasFocused = true;
}
}}
onclose={() => onClose()}
muted={$videoViewerMuted}