From b261f7286402d59872d46270eabf502a9d3d89c8 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 4 Apr 2025 17:33:49 +0530 Subject: [PATCH] Add another case --- web/packages/gallery/components/viewer/photoswipe.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts index 005349241c..50651a3714 100644 --- a/web/packages/gallery/components/viewer/photoswipe.ts +++ b/web/packages/gallery/components/viewer/photoswipe.ts @@ -378,18 +378,20 @@ export class FileViewerPhotoSwipe { /** * A wrapper over video.play that prevents Chrome from spamming the * console with errors about interrupted plays when scrolling through - * files fast by keeping arrow keys pressed. + * files fast by keeping arrow keys pressed, or when the slide is reloaded. */ const abortablePlayVideo = async (videoElement: HTMLVideoElement) => { try { await videoElement.play(); } catch (e) { + // Known message strings prefixes. + // - "The play() request was interrupted by a call to pause()." + // - "The play() request was interrupted because the media was removed from the document." + if ( e instanceof Error && e.name == "AbortError" && - e.message.startsWith( - "The play() request was interrupted by a call to pause().", - ) + e.message.startsWith("The play() request was interrupted") ) { // Ignore. } else {