Compare commits

..

6 Commits

Author SHA1 Message Date
CodeDevMLH
bf620e447f Bump version to 1.7.0.1
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 53s
2026-03-05 22:42:58 +01:00
CodeDevMLH
3117d627dd Enhance video playback handling: enable autoplay, adjust mute settings for Safari compatibility, and improve navigation checks during autoplay. 2026-03-05 22:42:40 +01:00
CodeDevMLH
71402f7e86 Update manifest.json for release v1.7.0.0 [skip ci] 2026-03-05 01:05:37 +00:00
CodeDevMLH
cce202b88d Bump version to 1.7.0.0
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 55s
2026-03-05 02:04:43 +01:00
CodeDevMLH
1d334e4d95 Add YouTube no-cookie host and referrer policy for iframe security 2026-03-05 02:00:54 +01:00
CodeDevMLH
142063ce63 Update configPage.html to add warning about autoplay failure when disabling start muted option 2026-03-05 02:00:19 +01:00
4 changed files with 61 additions and 34 deletions

View File

@@ -241,7 +241,7 @@
<span>Start Muted</span>
</label>
<div class="fieldDescription">Start trailer video playback muted. (Known issue: In the
Android/IOS app, backdrop trailers are always muted.)</div>
Android/IOS app, backdrop trailers are always muted.)<br><b style="color:#ffcc00">Warning:</b> Disabling this may cause autoplay to fail on certain browsers due to strict autoplay policies.</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>

View File

@@ -12,7 +12,7 @@
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
<Title>Jellyfin Media Bar Enhanced Plugin</Title>
<Authors>CodeDevMLH</Authors>
<Version>1.6.6.4</Version>
<Version>1.7.0.1</Version>
<RepositoryUrl>https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced</RepositoryUrl>
</PropertyGroup>

View File

@@ -744,6 +744,7 @@ const SlideUtils = {
height: '100%',
width: '100%',
videoId: videoId,
host: 'https://www.youtube-nocookie.com',
playerVars: {
autoplay: 1,
controls: 1,
@@ -751,8 +752,15 @@ const SlideUtils = {
rel: 0,
playsinline: 1,
origin: window.location.origin,
widget_referrer: window.location.href,
enablejsapi: 1
},
events: {
'onReady': (event) => {
const iframe = event.target.getIframe();
if (iframe) {
iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
}
}
}
});
});
@@ -1741,8 +1749,8 @@ const SlideCreator = {
// Fetch SponsorBlock data
ApiUtils.fetchSponsorBlockData(videoId).then(segments => {
const playerVars = {
autoplay: 0,
mute: STATE.slideshow.isMuted ? 1 : 0,
autoplay: 1,
mute: 1, // need to be muted for Safari, because apple makes life difficult...
controls: 0,
disablekb: 1,
fs: 0,
@@ -1751,7 +1759,6 @@ const SlideCreator = {
loop: 0,
playsinline: 1,
origin: window.location.origin,
widget_referrer: window.location.href,
enablejsapi: 1
};
@@ -1784,9 +1791,15 @@ const SlideCreator = {
height: '100%',
width: '100%',
videoId: videoId,
host: 'https://www.youtube-nocookie.com',
playerVars: playerVars,
events: {
'onReady': (event) => {
const iframe = event.target.getIframe();
if (iframe) {
iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
}
// Store start/end time and videoId for later use
event.target._startTime = playerVars.start || 0;
event.target._endTime = playerVars.end || undefined;
@@ -1795,9 +1808,8 @@ const SlideCreator = {
// Store reference to wrapper for fading
event.target._wrapperDiv = videoBackdrop;
if (STATE.slideshow.isMuted) {
event.target.mute();
} else {
// Unmute now if user wants sound.
if (!STATE.slideshow.isMuted) {
event.target.unMute();
event.target.setVolume(40);
}
@@ -1806,28 +1818,34 @@ const SlideCreator = {
event.target.setPlaybackQuality(quality);
}
// Only play if this is the active slide
// Stop playback if slide was navigated away from
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'))) {
event.target.playVideo();
// Check if it actually started playing after a short delay (handling autoplay blocks)
if (!slide || !slide.classList.contains('active') || document.hidden || (isVideoPlayerOpen && !isVideoPlayerOpen.classList.contains('hide'))) {
event.target.stopVideo();
} else {
// Pause slideshow timer when video starts if configured
if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) {
STATE.slideshow.slideInterval.stop();
}
// Safety check after 1s: handle navigation-away during the window,
// and fallback to muted play if autoplay failed for any reason.
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;
console.log(`Navigation detected during autoplay check for ${itemId}, stopping video.`);
try {
event.target.stopVideo();
} catch (e) { console.warn("Error stopping video:", e); }
return;
}
if (event.target.getPlayerState() !== YT.PlayerState.PLAYING &&
event.target.getPlayerState() !== YT.PlayerState.BUFFERING) {
console.warn(`Autoplay blocked for ${itemId}, attempting muted fallback`);
// If somehow not playing/buffering yet, force muted fallback
const state = event.target.getPlayerState();
if (state !== YT.PlayerState.PLAYING && state !== YT.PlayerState.BUFFERING) {
console.warn(`Autoplay stalled for ${itemId}, attempting muted fallback`);
event.target.mute();
event.target.playVideo();
}
@@ -1835,11 +1853,6 @@ const SlideCreator = {
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();
}
}
},
'onStateChange': (event) => {
@@ -1883,6 +1896,7 @@ const SlideCreator = {
};
videoAttributes.muted = "";
videoAttributes.playsinline = ""; // again Safari needs extra treatment...
videoBackdrop = SlideUtils.createElement("video", videoAttributes);
videoBackdrop.volume = 0.4;
@@ -2455,6 +2469,7 @@ const SlideshowManager = {
const lazySrc = videoBackdrop.getAttribute('data-src');
if (lazySrc && !videoBackdrop.src) {
videoBackdrop.src = lazySrc;
videoBackdrop.load();
}
videoBackdrop.currentTime = 0;
@@ -2478,17 +2493,21 @@ const SlideshowManager = {
const player = STATE.slideshow.videoPlayers[currentItemId];
if (player && typeof player.loadVideoById === 'function' && player._videoId) {
// Use loadVideoById to enforce start and end times
// load always starts muted first, then unmute if needed
player.loadVideoById({
videoId: player._videoId,
startSeconds: player._startTime || 0,
endSeconds: player._endTime
});
if (STATE.slideshow.isMuted) {
player.mute();
} else {
player.unMute();
player.setVolume(40);
player.mute();
if (!STATE.slideshow.isMuted) {
setTimeout(() => {
// Only unmute if still on the same slide
if (currentSlide.classList.contains('active')) {
player.unMute();
player.setVolume(40);
}
}, 600);
}
// Check if playback successfully started, otherwise fallback to muted

View File

@@ -8,6 +8,14 @@
"category": "General",
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
"versions": [
{
"version": "1.7.0.1",
"changelog": "- Add YouTube no-cookie host and referrer policy for iframe security to fix playback issues on iOS/MacOS",
"targetAbi": "10.11.0.0",
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.7.0.0/Jellyfin.Plugin.MediaBarEnhanced.zip",
"checksum": "d126fd4b76c49bdcca257919fd3db8a5",
"timestamp": "2026-03-05T01:05:37Z"
},
{
"version": "1.6.6.4",
"changelog": "- feat: add static backdrop also for video backdrops\n- fix: renaming issue of settings (avoiding conflict with other plugins)",