From f54e55fe044d57884aa213db8e7aa8720eff3c5d Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Tue, 10 Feb 2026 00:33:19 +0100 Subject: [PATCH] Bump version to 1.5.0.23 and update changelog for recent changes --- .../Jellyfin.Plugin.MediaBarEnhanced.csproj | 2 +- .../Web/mediaBarEnhanced.js | 63 +++++++++++++++++-- manifest.json | 2 +- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Jellyfin.Plugin.MediaBarEnhanced.csproj b/Jellyfin.Plugin.MediaBarEnhanced/Jellyfin.Plugin.MediaBarEnhanced.csproj index ae2c598..5d60b73 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Jellyfin.Plugin.MediaBarEnhanced.csproj +++ b/Jellyfin.Plugin.MediaBarEnhanced/Jellyfin.Plugin.MediaBarEnhanced.csproj @@ -12,7 +12,7 @@ Jellyfin Media Bar Enhanced Plugin CodeDevMLH - 1.5.0.22 + 1.5.0.23 https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js index 799e9a0..1bf4d9b 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js +++ b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js @@ -85,6 +85,7 @@ const STATE = { isMuted: CONFIG.startMuted, customTrailerUrls: {}, ytPromise: null, + autoplayTimeouts: [], }, }; @@ -1416,6 +1417,24 @@ class SlideTimer { */ const VisibilityObserver = { updateVisibility() { + const videoPlayer = document.querySelector('.videoPlayerContainer'); + const trailerPlayer = document.querySelector('.youtubePlayerContainer'); + + // If a full screen video player is active, hide slideshow and stop playback + if ((videoPlayer && !videoPlayer.classList.contains('hide')) || (trailerPlayer && !trailerPlayer.classList.contains('hide'))) { + const container = document.getElementById("slides-container"); + if (container) { + container.style.display = "none"; + container.style.visibility = "hidden"; + container.style.pointerEvents = "none"; + } + if (STATE.slideshow.slideInterval) { + STATE.slideshow.slideInterval.stop(); + } + SlideshowManager.stopAllPlayback(); + return; + } + const activeTab = document.querySelector(".emby-tab-button-active"); const container = document.getElementById("slides-container"); @@ -1660,10 +1679,23 @@ const SlideCreator = { // Only play if this is the active slide const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`); - if (slide && slide.classList.contains('active')) { + const isVideoPlayerOpen = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer'); + + if (slide && slide.classList.contains('active') && !document.hidden && (!isVideoPlayerOpen || isVideoPlayerOpen.classList.contains('hide'))) { event.target.playVideo(); + // Check if it actually started playing after a short delay (handling autoplay blocks) - setTimeout(() => { + const timeoutId = setTimeout(() => { + // Re-check conditions before processing fallback + const isVideoPlayerOpenNow = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer'); + if (document.hidden || (isVideoPlayerOpenNow && !isVideoPlayerOpenNow.classList.contains('hide')) || !slide.classList.contains('active')) { + console.log(`Navigation detected during autoplay check for ${itemId}, stopping video.`); + try { + event.target.stopVideo(); + } catch (e) { console.warn("Error stopping video in timeout:", e); } + return; + } + if (event.target.getPlayerState() !== YT.PlayerState.PLAYING && event.target.getPlayerState() !== YT.PlayerState.BUFFERING) { console.warn(`Autoplay blocked for ${itemId}, attempting muted fallback`); @@ -1672,6 +1704,9 @@ const SlideCreator = { } }, 1000); + if (!STATE.slideshow.autoplayTimeouts) STATE.slideshow.autoplayTimeouts = []; + STATE.slideshow.autoplayTimeouts.push(timeoutId); + // Pause slideshow timer when video starts if configured if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) { STATE.slideshow.slideInterval.stop(); @@ -2547,15 +2582,26 @@ const SlideshowManager = { * Used when navigating away from the home screen */ stopAllPlayback() { - // 1. Pause all YouTube players + // Clear any pending autoplay timeouts + if (STATE.slideshow.autoplayTimeouts) { + STATE.slideshow.autoplayTimeouts.forEach(id => clearTimeout(id)); + STATE.slideshow.autoplayTimeouts = []; + } + + // 1. Stop all YouTube players if (STATE.slideshow.videoPlayers) { Object.values(STATE.slideshow.videoPlayers).forEach(player => { try { - if (player && typeof player.pauseVideo === 'function') { + if (player && typeof player.stopVideo === 'function') { + player.stopVideo(); + if (typeof player.clearVideo === 'function') { + player.clearVideo(); + } + } else if (player && typeof player.pauseVideo === 'function') { player.pauseVideo(); } } catch (e) { - console.warn("Error pausing YouTube player:", e); + console.warn("Error pausing/stopping YouTube player:", e); } }); } @@ -2668,6 +2714,13 @@ const SlideshowManager = { return; } + // Check if video player is open + const videoPlayer = document.querySelector('.videoPlayerContainer'); + const trailerPlayer = document.querySelector('.youtubePlayerContainer'); + if ((videoPlayer && !videoPlayer.classList.contains('hide')) || (trailerPlayer && !trailerPlayer.classList.contains('hide'))) { + return; + } + switch (e.key) { case "ArrowRight": if (isTvMode && !isSlideshowFocused) return; diff --git a/manifest.json b/manifest.json index cdf6d7c..813c399 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png", "versions": [ { - "version": "1.5.0.22", + "version": "1.5.0.23", "changelog": "- fix: Keyboard controls in TV mode\n- Add sorting options for content\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 4.0.1 from original repo", "targetAbi": "10.11.0.0", "sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.0.22/Jellyfin.Plugin.MediaBarEnhanced.zip",