From 664eecf7796cd2fd4a30c9bd6abe7c077ed37e0c Mon Sep 17 00:00:00 2001 From: CodeDevMLH <145071728+CodeDevMLH@users.noreply.github.com> Date: Tue, 24 Mar 2026 00:38:04 +0100 Subject: [PATCH] Enhance video playback logic by introducing a play signal check for active slides --- Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js index cfdb830..24ade87 100644 --- a/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js +++ b/Jellyfin.Plugin.MediaBarEnhanced/Web/mediaBarEnhanced.js @@ -1879,11 +1879,11 @@ const SlideCreator = { event.target.setPlaybackQuality(quality); } - // Only play if this is the active slide + // Only play if this is the active slide and the play signal has been issued (delay finished) const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`); const isVideoPlayerOpen = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer'); - if (slide && slide.classList.contains('active') && !document.hidden && (!isVideoPlayerOpen || isVideoPlayerOpen.classList.contains('hide'))) { + if (slide && slide.classList.contains('active') && slide.dataset.playVideoSignal === "true" && !document.hidden && (!isVideoPlayerOpen || isVideoPlayerOpen.classList.contains('hide'))) { event.target.playVideo(); // Check if it actually started playing after a short delay (handling autoplay blocks) @@ -2481,6 +2481,7 @@ const SlideshowManager = { void currentSlide.offsetWidth; currentSlide.classList.add("active"); + currentSlide.dataset.playVideoSignal = "false"; // Manage Video Playback: Stop others, Play current // 1. Stop all other YouTube players and local video elements, release connections @@ -2581,6 +2582,8 @@ const SlideshowManager = { // play logic const playVideoLogic = () => { if (!currentSlide.classList.contains('active')) return; + + currentSlide.dataset.playVideoSignal = "true"; if (videoBackdrop.tagName === 'VIDEO') { videoBackdrop.play().catch(e => {