Compare commits

..

2 Commits

Author SHA1 Message Date
CodeDevMLH
c998266dd7 Bump version to 1.7.0.6
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 53s
2026-03-06 01:24:11 +01:00
CodeDevMLH
9b941e5a77 test again 2026-03-06 01:23:49 +01:00
3 changed files with 38 additions and 8 deletions

View File

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

View File

@@ -1782,15 +1782,44 @@ const SlideCreator = {
} catch(e) { /* cross-origin access may fail on some iOS versions */ }
};
// Listen for YouTube state changes (e.g. video ended → advance slide)
// YouTube won't send onStateChange events unless we explicitly subscribe.
// The IFrame API does this automatically; we must do it manually for plain iframes.
const subscribeToYtEvents = () => {
try {
// Step 1: Announce we're listening
ytIframe.contentWindow?.postMessage(
JSON.stringify({ event: 'listening' }),
'https://www.youtube-nocookie.com'
);
// Step 2: Subscribe to state change events
ytIframe.contentWindow?.postMessage(
JSON.stringify({ event: 'command', func: 'addEventListener', args: ['onStateChange'] }),
'https://www.youtube-nocookie.com'
);
} catch(e) {}
};
// Subscribe when iframe has finished loading
ytIframe.addEventListener('load', subscribeToYtEvents);
// Listen for YouTube state changes (video ended → advance slide)
const handleYtMessage = (event) => {
if (!event.origin.includes('youtube')) return;
try {
const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
if (data.event === 'onStateChange' && data.info === 0) { // 0 = YT.PlayerState.ENDED
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
if (slide && slide.classList.contains('active')) {
SlideshowManager.nextSlide();
// Player is ready — re-subscribe in case the first attempt was too early
if (data.event === 'onReady') {
subscribeToYtEvents();
}
if (data.event === 'onStateChange') {
console.log(`🍎 Safari YT state: ${data.info} for ${itemId}`);
if (data.info === 0) { // 0 = ENDED
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
if (slide && slide.classList.contains('active')) {
SlideshowManager.nextSlide();
}
}
}
} catch(e) {}
@@ -2620,9 +2649,10 @@ const SlideshowManager = {
}
// Check if playback successfully started, otherwise fallback to muted
// (Only for real YT.Player instances — Safari stub's getPlayerState() always returns 1)
setTimeout(() => {
if (!currentSlide.classList.contains('active')) return;
if (player.getPlayerState &&
if (player.getPlayerState && typeof YT !== 'undefined' &&
player.getPlayerState() !== YT.PlayerState.PLAYING &&
player.getPlayerState() !== YT.PlayerState.BUFFERING) {
console.log("YouTube loadVideoById didn't start playback, retrying muted...");

View File

@@ -9,7 +9,7 @@
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
"versions": [
{
"version": "1.7.0.5",
"version": "1.7.0.6",
"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.5/Jellyfin.Plugin.MediaBarEnhanced.zip",