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

This commit is contained in:
Snowknight26 authored and GitHub committed 2026-03-05 15:41:27 +00:00
1 parent c259fee309
commit 09fabb36b6
1 file changed
+6 -1
@@ -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}