From 2e9c093cdc13f6f17fcad2fbc4e12d8648e28a6d Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Thu, 8 Jan 2026 16:25:04 +0100 Subject: [PATCH] Add resumeActivePlayback method to resume video playback when slideshow is active --- .../Web/mediaBarEnhanced.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js index 50a0d2e..1c15492 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js +++ b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js @@ -1259,6 +1259,7 @@ const VisibilityObserver = { if (isVisible) { if (STATE.slideshow.slideInterval && !STATE.slideshow.isPaused) { STATE.slideshow.slideInterval.start(); + SlideshowManager.resumeActivePlayback(); } } else { if (STATE.slideshow.slideInterval) { @@ -2349,6 +2350,34 @@ const SlideshowManager = { } }, + /** + * Resumes playback for the active slide if not globally paused + */ + resumeActivePlayback() { + if (STATE.slideshow.isPaused) return; + + const currentItemId = STATE.slideshow.itemIds[STATE.slideshow.currentSlideIndex]; + if (!currentItemId) return; + + const currentSlide = document.querySelector(`.slide[data-item-id="${currentItemId}"]`); + if (!currentSlide) return; + + // 1. Try YouTube Player + const ytPlayer = STATE.slideshow.videoPlayers[currentItemId]; + if (ytPlayer && typeof ytPlayer.playVideo === 'function') { + ytPlayer.playVideo(); + } + + // 2. Try HTML5 Video + const html5Video = currentSlide.querySelector('video'); + if (html5Video) { + if (STATE.slideshow.isMuted) { + html5Video.muted = true; + } + html5Video.play().catch(e => console.warn("Error resuming HTML5 video:", e)); + } + }, + /** * Initializes touch events for swiping */