mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix(web): not autoplay after moving playhead on paused video (#17038)
fix(web): prevent autoplay after moving playhead
This commit is contained in:
parent
4a0045db44
commit
9757f70064
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user