Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

2

Manav Rathi5b7c112c9ab4
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 7cd0da86b8..8fcc0cc5cf 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -438,10 +438,12 @@ export class FileViewerPhotoSwipe {
};
livePhotoPlayInitialEndedEvent = { video, listener };
video.addEventListener("ended", listener, { once: true });
+ livePhotoPlay = true;
} else {
button?.classList.add("pswp-ente-off");
video.pause();
video.style.display = "none";
+ livePhotoPlay = false;
}
};
@@ -456,13 +458,6 @@ export class FileViewerPhotoSwipe {
if (button) showIf(button, true);
if (livePhotoPlay) {
- // Add the loop attribute.
- video.setAttribute("loop", "");
-
- button?.classList.remove("pswp-ente-off");
- void abortablePlayVideo(video);
- video.style.display = "initial";
- } else {
// Remove the loop attributes to clean up after ourselves (not
// necessarily needed because we remove it on slide change too).
video.removeAttribute("loop");
@@ -481,6 +476,15 @@ export class FileViewerPhotoSwipe {
button?.classList.add("pswp-ente-off");
video.pause();
video.style.display = "none";
+ livePhotoPlay = false;
+ } else {
+ // Add the loop attribute.
+ video.setAttribute("loop", "");
+
+ button?.classList.remove("pswp-ente-off");
+ void abortablePlayVideo(video);
+ video.style.display = "initial";
+ livePhotoPlay = true;
}
};
@@ -535,7 +539,6 @@ export class FileViewerPhotoSwipe {
const video = livePhotoVideoOnSlide(pswp.currSlide);
if (!buttonElement || !video) return;
- livePhotoPlay = !livePhotoPlay;
livePhotoUpdatePlayToggle(video);
};