mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 16:29:27 +03:00
fix(web): video stealing focus when it plays again when looping (#26704)
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
);
|
);
|
||||||
let isScrubbing = $state(false);
|
let isScrubbing = $state(false);
|
||||||
let showVideo = $state(false);
|
let showVideo = $state(false);
|
||||||
|
let hasFocused = $state(false);
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Show video after mount to ensure fading in.
|
// Show video after mount to ensure fading in.
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
$effect(() => {
|
$effect(() => {
|
||||||
// reactive on `assetFileUrl` changes
|
// reactive on `assetFileUrl` changes
|
||||||
if (assetFileUrl) {
|
if (assetFileUrl) {
|
||||||
|
hasFocused = false;
|
||||||
videoPlayer?.load();
|
videoPlayer?.load();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -151,7 +153,10 @@
|
|||||||
onseeking={() => (isScrubbing = true)}
|
onseeking={() => (isScrubbing = true)}
|
||||||
onseeked={() => (isScrubbing = false)}
|
onseeked={() => (isScrubbing = false)}
|
||||||
onplaying={(e) => {
|
onplaying={(e) => {
|
||||||
|
if (!hasFocused) {
|
||||||
e.currentTarget.focus();
|
e.currentTarget.focus();
|
||||||
|
hasFocused = true;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onclose={() => onClose()}
|
onclose={() => onClose()}
|
||||||
muted={$videoViewerMuted}
|
muted={$videoViewerMuted}
|
||||||
|
|||||||
Reference in New Issue
Block a user