1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-07 23:03:36 +02:00

fix(web): not autoplay after moving playhead on paused video (#17038)

fix(web): prevent autoplay after moving playhead
This commit is contained in:
Yaros
2025-03-24 22:55:46 +01:00
committed by GitHub
parent 4a0045db44
commit 9757f70064

View File

@ -38,6 +38,7 @@
let isLoading = $state(true);
let assetFileUrl = $state('');
let forceMuted = $state(false);
let isScrubbing = $state(false);
onMount(() => {
if (videoPlayer) {
@ -55,8 +56,10 @@
const handleCanPlay = async (video: HTMLVideoElement) => {
try {
await video.play();
onVideoStarted();
if (!video.paused && !isScrubbing) {
await video.play();
onVideoStarted();
}
} catch (error) {
if (error instanceof DOMException && error.name === 'NotAllowedError' && !forceMuted) {
await tryForceMutedPlay(video);
@ -119,6 +122,8 @@
$videoViewerMuted = e.currentTarget.muted;
}
}}
onseeking={() => (isScrubbing = true)}
onseeked={() => (isScrubbing = false)}
onclose={() => onClose()}
muted={forceMuted || $videoViewerMuted}
bind:volume={$videoViewerVolume}