Compare commits

...

11 Commits

Author SHA1 Message Date
CodeDevMLH
fc2491a4ef Bump version to 1.7.0.11
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 52s
2026-03-06 03:18:26 +01:00
CodeDevMLH
03276d7722 Enhance YouTube player integration with fullscreen and picture-in-picture support 2026-03-06 03:18:13 +01:00
CodeDevMLH
8676160e7b Update manifest.json for release v1.7.0.10 [skip ci] 2026-03-06 02:02:52 +00:00
CodeDevMLH
c562560bc0 Bump version to 1.7.0.10
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 51s
2026-03-06 03:02:01 +01:00
CodeDevMLH
98474d4ff6 Refactor YouTube player integration to use iframe for improved performance and security 2026-03-06 03:01:34 +01:00
CodeDevMLH
14c0eb43ed Update manifest.json for release v1.7.0.9 [skip ci] 2026-03-06 01:24:40 +00:00
CodeDevMLH
c4cbeda2b8 Bump version to 1.7.0.9
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 51s
2026-03-06 02:23:50 +01:00
CodeDevMLH
53ad568be4 Fix active slide detection logic in SlideCreator for improved video playback handling 2026-03-06 02:23:13 +01:00
CodeDevMLH
fba64bd0f6 Update manifest.json for release v1.7.0.8 [skip ci] 2026-03-06 01:17:19 +00:00
CodeDevMLH
3da16c4c5c Bump version to 1.7.0.8
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 52s
2026-03-06 02:16:28 +01:00
CodeDevMLH
c7cd7be3ee Add low-power device detection and adjust video playback settings 2026-03-06 02:16:09 +01:00
3 changed files with 45 additions and 38 deletions

View File

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

View File

@@ -163,6 +163,14 @@ const isUserLoggedIn = () => {
} }
}; };
/**
* Detects if the current device is a low-power device (Smart TVs, etc.)
* @returns {boolean} True if running on a low-power device
*/
const isLowPowerDevice = () => {
return /webOS|LG Browser|SMART-TV|SmartTV|Tizen|Viera|NetCast|Roku|VIDAA/i.test(navigator.userAgent);
};
/** /**
* Initializes Jellyfin data from ApiClient * Initializes Jellyfin data from ApiClient
* @param {Function} callback - Function to call once data is initialized * @param {Function} callback - Function to call once data is initialized
@@ -734,17 +742,21 @@ const SlideUtils = {
} }
if (isYoutube && videoId) { if (isYoutube && videoId) {
const playerDiv = this.createElement('div', { id: 'modal-yt-player' }); const ytIframe = this.createElement('iframe', {
contentContainer.appendChild(playerDiv); id: 'modal-yt-player',
src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`,
allow: 'autoplay; encrypted-media; fullscreen; picture-in-picture',
style: 'width: 100%; height: 100%; border: none;',
referrerpolicy: 'strict-origin-when-cross-origin',
allowfullscreen: 'true'
});
contentContainer.appendChild(ytIframe);
overlay.append(closeButton, contentContainer); overlay.append(closeButton, contentContainer);
document.body.appendChild(overlay); document.body.appendChild(overlay);
this.loadYouTubeIframeAPI().then(() => { this.loadYouTubeIframeAPI().then(() => {
new YT.Player('modal-yt-player', { new YT.Player(ytIframe, {
height: '100%',
width: '100%',
videoId: videoId,
host: 'https://www.youtube-nocookie.com',
playerVars: { playerVars: {
autoplay: 1, autoplay: 1,
controls: 1, controls: 1,
@@ -753,14 +765,6 @@ const SlideUtils = {
playsinline: 1, playsinline: 1,
origin: window.location.origin, origin: window.location.origin,
enablejsapi: 1 enablejsapi: 1
},
events: {
'onReady': (event) => {
const iframe = event.target.getIframe();
if (iframe) {
iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
}
}
} }
}); });
}); });
@@ -1696,7 +1700,7 @@ const SlideCreator = {
console.log(`Using local trailer fallback for ${itemId}: ${trailerUrl}`); console.log(`Using local trailer fallback for ${itemId}: ${trailerUrl}`);
} }
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
// Client Setting Overrides // Client Setting Overrides
const enableVideo = MediaBarEnhancedSettingsManager.getSetting('videoBackdrops', CONFIG.enableVideoBackdrop); const enableVideo = MediaBarEnhancedSettingsManager.getSetting('videoBackdrops', CONFIG.enableVideoBackdrop);
@@ -1726,7 +1730,12 @@ const SlideCreator = {
console.warn("Invalid trailer URL:", trailerUrl); console.warn("Invalid trailer URL:", trailerUrl);
} }
if (isYoutube && videoId) { const isLowPower = isLowPowerDevice();
const itemIndex = STATE.slideshow.itemIds ? STATE.slideshow.itemIds.indexOf(itemId) : -1;
const isActiveSlide = itemIndex !== -1 && itemIndex === STATE.slideshow.currentSlideIndex;
const shouldCreateVideo = !isLowPower || isActiveSlide;
if (isYoutube && videoId && shouldCreateVideo) {
isVideo = true; isVideo = true;
// Create container for YouTube API // Create container for YouTube API
const videoClass = CONFIG.fullWidthVideo ? "video-backdrop-full" : "video-backdrop-default"; const videoClass = CONFIG.fullWidthVideo ? "video-backdrop-full" : "video-backdrop-default";
@@ -1737,12 +1746,17 @@ const SlideCreator = {
style: "opacity: 0; transition: opacity 1.2s ease-in-out;" // Start interrupted/transparent style: "opacity: 0; transition: opacity 1.2s ease-in-out;" // Start interrupted/transparent
}); });
const ytPlayerDiv = SlideUtils.createElement("div", { // Create an iframe upfront
const ytPlayerIframe = SlideUtils.createElement("iframe", {
id: `youtube-player-${itemId}`, id: `youtube-player-${itemId}`,
style: "width: 100%; height: 100%;" src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`,
style: "width: 100%; height: 100%; border: none;",
allow: "autoplay; encrypted-media; fullscreen; picture-in-picture",
referrerpolicy: "strict-origin-when-cross-origin",
allowfullscreen: "true"
}); });
videoBackdrop.appendChild(ytPlayerDiv); videoBackdrop.appendChild(ytPlayerIframe);
// Initialize YouTube Player // Initialize YouTube Player
SlideUtils.loadYouTubeIframeAPI().then(() => { SlideUtils.loadYouTubeIframeAPI().then(() => {
@@ -1787,19 +1801,10 @@ const SlideCreator = {
console.info(`SponsorBlock outro detected for video ${videoId}: ending at ${playerVars.end}s`); console.info(`SponsorBlock outro detected for video ${videoId}: ending at ${playerVars.end}s`);
} }
STATE.slideshow.videoPlayers[itemId] = new YT.Player(`youtube-player-${itemId}`, { STATE.slideshow.videoPlayers[itemId] = new YT.Player(ytPlayerIframe, {
height: '100%',
width: '100%',
videoId: videoId,
host: 'https://www.youtube-nocookie.com',
playerVars: playerVars, playerVars: playerVars,
events: { events: {
'onReady': (event) => { '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 // Store start/end time and videoId for later use
event.target._startTime = playerVars.start || 0; event.target._startTime = playerVars.start || 0;
event.target._endTime = playerVars.end || undefined; event.target._endTime = playerVars.end || undefined;
@@ -1883,7 +1888,7 @@ const SlideCreator = {
}); });
// 2. Check for local video trailers in MediaSources if yt is not available // 2. Check for local video trailers in MediaSources if yt is not available
} else if (!isYoutube) { } else if (!isYoutube && shouldCreateVideo) {
isVideo = true; isVideo = true;
const videoSrc = (typeof trailerUrl === 'object' ? trailerUrl.url : trailerUrl); const videoSrc = (typeof trailerUrl === 'object' ? trailerUrl.url : trailerUrl);
@@ -2575,7 +2580,7 @@ const SlideshowManager = {
STATE.slideshow.isTransitioning = false; STATE.slideshow.isTransitioning = false;
if (previousVisibleSlide) { if (previousVisibleSlide) {
const enableAnimations = MediaBarEnhancedSettingsManager.getSetting('slideAnimations', CONFIG.slideAnimationEnabled); const enableAnimations = MediaBarEnhancedSettingsManager.getSetting('slideAnimations', CONFIG.slideAnimationEnabled) && !isLowPowerDevice();
if (enableAnimations) { if (enableAnimations) {
const prevBackdrop = previousVisibleSlide.querySelector(".backdrop"); const prevBackdrop = previousVisibleSlide.querySelector(".backdrop");
const prevLogo = previousVisibleSlide.querySelector(".logo"); const prevLogo = previousVisibleSlide.querySelector(".logo");
@@ -2616,7 +2621,9 @@ const SlideshowManager = {
*/ */
async preloadAdjacentSlides(currentIndex) { async preloadAdjacentSlides(currentIndex) {
const totalItems = STATE.slideshow.totalItems; const totalItems = STATE.slideshow.totalItems;
const preloadCount = Math.min(Math.max(CONFIG.preloadCount || 1, 1), 5); let preloadCount = Math.min(Math.max(CONFIG.preloadCount || 1, 1), 5);
if (isLowPowerDevice()) preloadCount = 1; // Strict limit for TVs
const preloadedIds = new Set(); const preloadedIds = new Set();
// Preload next slides // Preload next slides

View File

@@ -9,12 +9,12 @@
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png", "imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
"versions": [ "versions": [
{ {
"version": "1.7.0.7", "version": "1.7.0.11",
"changelog": "- Add YouTube no-cookie host and referrer policy for iframe security to fix playback issues on iOS/MacOS", "changelog": "- Add YouTube no-cookie host and referrer policy for iframe security to fix playback issues on iOS/MacOS",
"targetAbi": "10.11.0.0", "targetAbi": "10.11.0.0",
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.7.0.7/Jellyfin.Plugin.MediaBarEnhanced.zip", "sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.7.0.10/Jellyfin.Plugin.MediaBarEnhanced.zip",
"checksum": "932e1b1cd932d5c681175e3590b77458", "checksum": "054793363c988cfd1dce37876a0e800f",
"timestamp": "2026-03-06T00:45:37Z" "timestamp": "2026-03-06T02:02:52Z"
}, },
{ {
"version": "1.6.6.4", "version": "1.6.6.4",