Compare commits
68 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1cbcad177 | ||
|
|
feedd5d95f | ||
|
|
87d82cca15 | ||
|
|
a70746e095 | ||
|
|
f32283e0bf | ||
|
|
8f3985f307 | ||
|
|
0b2817ecff | ||
|
|
84faee2db4 | ||
|
|
3efa07ec51 | ||
|
|
af603e8803 | ||
|
|
fe63414e4b | ||
|
|
614c86083f | ||
|
|
17b9e8921e | ||
|
|
5075226ba8 | ||
|
|
443fb1008b | ||
|
|
8f12140aad | ||
|
|
1469712bb5 | ||
|
|
76ff03ac17 | ||
|
|
25b1ba5f2b | ||
|
|
eed3ca1860 | ||
|
|
0f14577f5d | ||
|
|
9999d6a633 | ||
|
|
a935fd7d5d | ||
|
|
60293e81e1 | ||
|
|
f54e55fe04 | ||
|
|
b3c42e2100 | ||
|
|
20ddbb32c7 | ||
|
|
14a5075e22 | ||
|
|
accb316a81 | ||
|
|
51c5cdf5bf | ||
|
|
306eff757b | ||
|
|
b8f28a5735 | ||
|
|
0932d9611d | ||
|
|
5e616db0ae | ||
|
|
538b0f2110 | ||
|
|
e717c07c54 | ||
|
|
0fa2d01ca3 | ||
|
|
5299b2a9d5 | ||
|
|
4f244988b9 | ||
|
|
5635a8f05e | ||
|
|
c901da4b0c | ||
|
|
c45cd0281f | ||
|
|
0c3e74829a | ||
|
|
e6b769f099 | ||
|
|
77371f7b98 | ||
|
|
988b800b6d | ||
|
|
4c6514ba9f | ||
|
|
6910eba7d6 | ||
|
|
3585b47b6c | ||
|
|
8170abdc94 | ||
|
|
535c0e17bf | ||
|
|
df1cee0eeb | ||
|
|
16cc56030f | ||
|
|
13ecbac96e | ||
|
|
8bca6f9052 | ||
|
|
217db2a66d | ||
|
|
5fd7bcb8b6 | ||
|
|
0b0e41a9f9 | ||
|
|
370db55714 | ||
|
|
e5d4800ef1 | ||
|
|
b910e92364 | ||
|
|
82283b1faf | ||
|
|
1588b1a6b2 | ||
|
|
de19466341 | ||
|
|
15054e314c | ||
|
|
3877f96b09 | ||
|
|
abca7cb3b6 | ||
|
|
998a0cfc68 |
@@ -21,6 +21,7 @@ namespace Jellyfin.Plugin.MediaBarEnhanced.Configuration
|
||||
public bool SlideAnimationEnabled { get; set; } = true;
|
||||
public bool EnableVideoBackdrop { get; set; } = true;
|
||||
public bool UseSponsorBlock { get; set; } = true;
|
||||
public bool PreferLocalTrailers { get; set; } = false;
|
||||
public bool WaitForTrailerToEnd { get; set; } = true;
|
||||
public bool StartMuted { get; set; } = true;
|
||||
public bool FullWidthVideo { get; set; } = true;
|
||||
|
||||
@@ -57,6 +57,14 @@
|
||||
<div class="fieldDescription">Show trailers as background if available.<br>Adds a
|
||||
mute/unmute and pause/play button to control the video in the right top corner.</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription" id="PreferLocalTrailersContainer">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="PreferLocalTrailers"
|
||||
name="PreferLocalTrailers" />
|
||||
<span>Prefer Local Trailers</span>
|
||||
</label>
|
||||
<div class="fieldDescription">If enabled, local trailers will be preferred over remote (YouTube) trailers.</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="WaitForTrailerToEnd"
|
||||
@@ -174,8 +182,7 @@
|
||||
</div>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="PreferredVideoQuality">Preferred YouTube Quality</label>
|
||||
<select is="emby-select" id="PreferredVideoQuality" name="PreferredVideoQuality"
|
||||
class="emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="PreferredVideoQuality" name="PreferredVideoQuality" class="selectLayout emby-select-withcolor emby-select">
|
||||
<option value="Auto">Auto (Smart)</option>
|
||||
<option value="Maximum">Maximum (4K+)</option>
|
||||
<option value="1080p">1080p</option>
|
||||
@@ -277,11 +284,12 @@
|
||||
<h2 class="sectionTitle">Content Sorting</h2>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="SortBy">Sort By</label>
|
||||
<select is="emby-select" id="SortBy" name="SortBy" class="emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="SortBy" name="SortBy" class="selectLayout emby-select-withcolor emby-select">
|
||||
<option value="Random">Random</option>
|
||||
<option value="Original">Original (Custom List Order)</option>
|
||||
<option value="PremiereDate">Premiere Date</option>
|
||||
<option value="DateCreated">Date Created</option>
|
||||
<option value="ProductionYear">Production Year</option>
|
||||
<option value="CriticRating">Critic Rating</option>
|
||||
<option value="CommunityRating">Community Rating</option>
|
||||
<option value="Name">Name</option>
|
||||
<option value="Runtime">Runtime</option>
|
||||
@@ -290,7 +298,7 @@
|
||||
</div>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="SortOrder">Sort Order</label>
|
||||
<select is="emby-select" id="SortOrder" name="SortOrder" class="emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="SortOrder" name="SortOrder" class="selectLayout emby-select-withcolor emby-select">
|
||||
<option value="Ascending">Ascending</option>
|
||||
<option value="Descending">Descending</option>
|
||||
</select>
|
||||
@@ -396,7 +404,8 @@
|
||||
'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo',
|
||||
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
|
||||
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder'
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder',
|
||||
'PreferLocalTrailers'
|
||||
];
|
||||
|
||||
keys.forEach(function (key) {
|
||||
@@ -430,6 +439,23 @@
|
||||
updateDesc();
|
||||
}
|
||||
|
||||
// Handle Prefer Local Trailers visibility
|
||||
var enableVideoBackdropCheckbox = page.querySelector('#EnableVideoBackdrop');
|
||||
var preferLocalContainer = page.querySelector('#PreferLocalTrailersContainer');
|
||||
|
||||
function updatePreferLocalVisibility() {
|
||||
if (enableVideoBackdropCheckbox && enableVideoBackdropCheckbox.checked) {
|
||||
if (preferLocalContainer) preferLocalContainer.style.display = 'block';
|
||||
} else {
|
||||
if (preferLocalContainer) preferLocalContainer.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if (enableVideoBackdropCheckbox) {
|
||||
enableVideoBackdropCheckbox.addEventListener('change', updatePreferLocalVisibility);
|
||||
updatePreferLocalVisibility();
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
},
|
||||
@@ -445,7 +471,8 @@
|
||||
'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo',
|
||||
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
|
||||
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder'
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder',
|
||||
'PreferLocalTrailers'
|
||||
];
|
||||
|
||||
keys.forEach(function (key) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
|
||||
<Title>Jellyfin Media Bar Enhanced Plugin</Title>
|
||||
<Authors>CodeDevMLH</Authors>
|
||||
<Version>1.5.0.6</Version>
|
||||
<Version>1.6.0.0</Version>
|
||||
<RepositoryUrl>https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Jellyfin Slideshow by M0RPH3US v3.0.9
|
||||
* Modified by CodeDevMLH v1.1.0.0
|
||||
* Jellyfin Slideshow by M0RPH3US v4.0.1
|
||||
* Modified by CodeDevMLH
|
||||
*
|
||||
* New features:
|
||||
* - optional Trailer background video support
|
||||
@@ -14,6 +14,9 @@
|
||||
* - option to disable loading screen
|
||||
* - option to put collection (boxsets) IDs into the slideshow to display their items
|
||||
* - option to enable client-side settings (allow users to override settings locally on their device)
|
||||
* - option to enable seasonal content (only show items that are relevant to the current season/holiday)
|
||||
* - option to prefer local trailers (from the media item) over online sources
|
||||
* - options to sort the content by various criteria (PremiereDate, ProductionYear, Random, Original order, etc.)
|
||||
*/
|
||||
|
||||
@import url(https://fonts.googleapis.com/css2?family=Archivo+Narrow:ital,wght@0,400..700;1,400..700&display=swap);
|
||||
@@ -991,4 +994,4 @@
|
||||
|
||||
.dots-container .slide-counter {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Jellyfin Slideshow by M0RPH3US v4.0.1
|
||||
* Modified by CodeDevMLH v1.1.0.0
|
||||
* Modified by CodeDevMLH
|
||||
*
|
||||
* New features:
|
||||
* - optional Trailer background video support
|
||||
@@ -14,6 +14,9 @@
|
||||
* - option to disable loading screen
|
||||
* - option to put collection (boxsets) IDs into the slideshow to display their items
|
||||
* - option to enable client-side settings (allow users to override settings locally on their device)
|
||||
* - option to enable seasonal content (only show items that are relevant to the current season/holiday)
|
||||
* - option to prefer local trailers (from the media item) over online sources
|
||||
* - options to sort the content by various criteria (PremiereDate, ProductionYear, Random, Original order, etc.)
|
||||
*/
|
||||
|
||||
//Core Module Configuration
|
||||
@@ -38,6 +41,7 @@ const CONFIG = {
|
||||
slideAnimationEnabled: true,
|
||||
enableVideoBackdrop: true,
|
||||
useSponsorBlock: true,
|
||||
preferLocalTrailers: false,
|
||||
waitForTrailerToEnd: true,
|
||||
startMuted: true,
|
||||
fullWidthVideo: true,
|
||||
@@ -84,6 +88,7 @@ const STATE = {
|
||||
isMuted: CONFIG.startMuted,
|
||||
customTrailerUrls: {},
|
||||
ytPromise: null,
|
||||
autoplayTimeouts: [],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -484,14 +489,18 @@ const SlideUtils = {
|
||||
let valA, valB;
|
||||
|
||||
switch (sortBy) {
|
||||
case 'DateCreated':
|
||||
valA = new Date(a.DateCreated).getTime();
|
||||
valB = new Date(b.DateCreated).getTime();
|
||||
break;
|
||||
case 'PremiereDate':
|
||||
valA = new Date(a.PremiereDate).getTime();
|
||||
valB = new Date(b.PremiereDate).getTime();
|
||||
break;
|
||||
case 'ProductionYear':
|
||||
valA = a.ProductionYear || 0;
|
||||
valB = b.ProductionYear || 0;
|
||||
break;
|
||||
case 'CriticRating':
|
||||
valA = a.CriticRating || 0;
|
||||
valB = b.CriticRating || 0;
|
||||
break;
|
||||
case 'CommunityRating':
|
||||
valA = a.CommunityRating || 0;
|
||||
valB = b.CommunityRating || 0;
|
||||
@@ -600,7 +609,10 @@ const SlideUtils = {
|
||||
getOrCreateSlidesContainer() {
|
||||
let container = document.getElementById("slides-container");
|
||||
if (!container) {
|
||||
container = this.createElement("div", { id: "slides-container" });
|
||||
container = this.createElement("div", {
|
||||
id: "slides-container",
|
||||
className: "noautofocus"
|
||||
});
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
return container;
|
||||
@@ -725,10 +737,14 @@ const SlideUtils = {
|
||||
width: '100%',
|
||||
videoId: videoId,
|
||||
playerVars: {
|
||||
autoplay: 1,
|
||||
autoplay: 0,
|
||||
controls: 1,
|
||||
iv_load_policy: 3,
|
||||
rel: 0
|
||||
rel: 0,
|
||||
playsinline: 1,
|
||||
origin: window.location.origin,
|
||||
widget_referrer: window.location.href,
|
||||
enablejsapi: 1
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1019,7 +1035,7 @@ const ApiUtils = {
|
||||
|
||||
const response = await fetch(
|
||||
// `${STATE.jellyfinData.serverAddress}/Items/${itemId}`,
|
||||
`${STATE.jellyfinData.serverAddress}/Items/${itemId}?Fields=Overview,RemoteTrailers,Genres,CommunityRating,CriticRating,OfficialRating,PremiereDate,ProductionYear,MediaSources,RunTimeTicks`,
|
||||
`${STATE.jellyfinData.serverAddress}/Items/${itemId}?Fields=Overview,RemoteTrailers,Genres,CommunityRating,CriticRating,OfficialRating,PremiereDate,ProductionYear,MediaSources,RunTimeTicks,LocalTrailerCount`,
|
||||
{
|
||||
headers: this.getAuthHeaders(),
|
||||
}
|
||||
@@ -1319,6 +1335,42 @@ const ApiUtils = {
|
||||
console.error(`Error fetching collection items for ${collectionId}:`, error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches the first local trailer for an item
|
||||
* @param {string} itemId - Item ID
|
||||
* @returns {Promise<Object|null>} Trailer data object {id, url} or null
|
||||
*/
|
||||
async fetchLocalTrailer(itemId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${STATE.jellyfinData.serverAddress}/Users/${STATE.jellyfinData.userId}/Items/${itemId}/LocalTrailers`,
|
||||
{
|
||||
headers: this.getAuthHeaders(),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const trailers = await response.json();
|
||||
if (trailers && trailers.length > 0) {
|
||||
const trailer = trailers[0];
|
||||
const mediaSourceId = trailer.MediaSources && trailer.MediaSources[0] ? trailer.MediaSources[0].Id : trailer.Id;
|
||||
|
||||
// Return object with ID and URL
|
||||
return {
|
||||
id: trailer.Id,
|
||||
url: `${STATE.jellyfinData.serverAddress}/Videos/${trailer.Id}/stream.mp4?Static=true&mediaSourceId=${mediaSourceId}&api_key=${STATE.jellyfinData.accessToken}`
|
||||
};
|
||||
}
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching local trailer for ${itemId}:`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1375,6 +1427,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");
|
||||
|
||||
@@ -1501,12 +1571,21 @@ const SlideCreator = {
|
||||
let isVideo = false;
|
||||
let trailerUrl = null;
|
||||
|
||||
// 1. Check for Remote Trailers (YouTube)
|
||||
// Priority: Custom Config URL > Metadata RemoteTrailer
|
||||
// 1. Check for Remote/Local Trailers
|
||||
// Priority: Custom Config URL > (PreferLocal -> Local) > Metadata RemoteTrailer
|
||||
|
||||
// 1a. Custom URL override
|
||||
if (STATE.slideshow.customTrailerUrls && STATE.slideshow.customTrailerUrls[itemId]) {
|
||||
trailerUrl = STATE.slideshow.customTrailerUrls[itemId];
|
||||
console.log(`Using custom trailer URL for ${itemId}: ${trailerUrl}`);
|
||||
} else if (item.RemoteTrailers && item.RemoteTrailers.length > 0) {
|
||||
}
|
||||
// 1b. Check Local Trailer if preferred
|
||||
else if (CONFIG.preferLocalTrailers && item.LocalTrailerCount > 0 && item.localTrailerUrl) {
|
||||
trailerUrl = item.localTrailerUrl;
|
||||
console.log(`Using local trailer for ${itemId}: ${trailerUrl}`);
|
||||
}
|
||||
// 1c. Fallback to Remote Trailer
|
||||
else if (item.RemoteTrailers && item.RemoteTrailers.length > 0) {
|
||||
trailerUrl = item.RemoteTrailers[0].Url;
|
||||
}
|
||||
|
||||
@@ -1523,12 +1602,17 @@ const SlideCreator = {
|
||||
let videoId = null;
|
||||
|
||||
try {
|
||||
const urlObj = new URL(trailerUrl);
|
||||
if (urlObj.hostname.includes('youtube.com') || urlObj.hostname.includes('youtu.be')) {
|
||||
let urlToCheck = trailerUrl;
|
||||
if (typeof trailerUrl === 'object' && trailerUrl.url) {
|
||||
urlToCheck = trailerUrl.url;
|
||||
}
|
||||
|
||||
const urlObjChecked = new URL(urlToCheck);
|
||||
if (urlObjChecked.hostname.includes('youtube.com') || urlObjChecked.hostname.includes('youtu.be')) {
|
||||
isYoutube = true;
|
||||
videoId = urlObj.searchParams.get('v');
|
||||
if (!videoId && urlObj.hostname.includes('youtu.be')) {
|
||||
videoId = urlObj.pathname.substring(1);
|
||||
videoId = urlObjChecked.searchParams.get('v');
|
||||
if (!videoId && urlObjChecked.hostname.includes('youtu.be')) {
|
||||
videoId = urlObjChecked.pathname.substring(1);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -1557,7 +1641,11 @@ const SlideCreator = {
|
||||
fs: 0,
|
||||
iv_load_policy: 3,
|
||||
rel: 0,
|
||||
loop: 0
|
||||
loop: 0,
|
||||
playsinline: 1,
|
||||
origin: window.location.origin,
|
||||
widget_referrer: window.location.href,
|
||||
enablejsapi: 1
|
||||
};
|
||||
|
||||
// Determine video quality
|
||||
@@ -1610,10 +1698,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`);
|
||||
@@ -1622,6 +1723,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();
|
||||
@@ -1654,11 +1758,12 @@ const SlideCreator = {
|
||||
|
||||
const videoAttributes = {
|
||||
className: "backdrop video-backdrop",
|
||||
src: trailerUrl,
|
||||
className: "backdrop video-backdrop",
|
||||
src: (typeof trailerUrl === 'object' ? trailerUrl.url : trailerUrl),
|
||||
autoplay: false,
|
||||
preload: "auto",
|
||||
loop: false,
|
||||
style: "object-fit: cover; width: 100%; height: 100%; pointer-events: none;"
|
||||
style: "object-fit: cover; object-position: center center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; pointer-events: none;"
|
||||
};
|
||||
|
||||
if (STATE.slideshow.isMuted) {
|
||||
@@ -1945,11 +2050,20 @@ const SlideCreator = {
|
||||
|
||||
/**
|
||||
* Creates a trailer button
|
||||
* @param {string} url - Trailer URL
|
||||
* @param {string|Object} trailerInfo - Trailer URL string or object {id, url}
|
||||
* @returns {HTMLElement} Trailer button element
|
||||
*/
|
||||
createTrailerButton(url) {
|
||||
createTrailerButton(trailerInfo) {
|
||||
const trailerText = LocalizationUtils.getLocalizedString('Trailer', 'Trailer');
|
||||
|
||||
let url = trailerInfo;
|
||||
let localTrailerId = null;
|
||||
|
||||
if (typeof trailerInfo === 'object' && trailerInfo !== null) {
|
||||
url = trailerInfo.url;
|
||||
localTrailerId = trailerInfo.id;
|
||||
}
|
||||
|
||||
return SlideUtils.createElement("button", {
|
||||
className: "detailButton trailer-button",
|
||||
innerHTML: `<span class="material-icons">movie</span> <span class="trailer-text">${trailerText}</span>`,
|
||||
@@ -1957,7 +2071,13 @@ const SlideCreator = {
|
||||
onclick: (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
SlideUtils.openVideoModal(url);
|
||||
|
||||
if (localTrailerId) {
|
||||
// Play local trailer using native player
|
||||
ApiUtils.playItem(localTrailerId);
|
||||
} else {
|
||||
SlideUtils.openVideoModal(url);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -2000,6 +2120,11 @@ const SlideCreator = {
|
||||
|
||||
const item = await ApiUtils.fetchItemDetails(itemId);
|
||||
|
||||
// Pre-fetch local trailer URL if needed
|
||||
if (CONFIG.preferLocalTrailers && item.LocalTrailerCount > 0) {
|
||||
item.localTrailerUrl = await ApiUtils.fetchLocalTrailer(itemId);
|
||||
}
|
||||
|
||||
const slideElement = this.createSlideElement(
|
||||
item,
|
||||
item.Type === "Movie" ? "Movie" : "TV Show"
|
||||
@@ -2492,15 +2617,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2603,52 +2739,76 @@ const SlideshowManager = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only trap keys if focus is on body (neutral) or inside our container.
|
||||
// To allow standard TV navigation to work for other elements (e.g. library cards).
|
||||
const activeEl = document.activeElement;
|
||||
const isBody = activeEl === document.body || !activeEl;
|
||||
const isInContainer = container.contains(activeEl) || activeEl === container;
|
||||
const activeElement = document.activeElement;
|
||||
const isTvDevice = window.browser && window.browser.tv;
|
||||
const isTvLayout = window.layoutManager && window.layoutManager.tv;
|
||||
const hasTvClass = document.documentElement.classList.contains('layout-tv') || document.body.classList.contains('layout-tv');
|
||||
const isTvMode = isTvDevice || isTvLayout || hasTvClass;
|
||||
|
||||
if (!isBody && !isInContainer) {
|
||||
return;
|
||||
}
|
||||
// Check Focus State
|
||||
const isBodyFocused = activeElement === document.body;
|
||||
const hasDirectFocus = container.contains(activeElement) || activeElement === container;
|
||||
|
||||
// Determine if we should handle navigation keys (Arrows, Space, M)
|
||||
// TV Mode: Strict focus required (must be on slideshow)
|
||||
// Desktop Mode: Loose focus allowed (slideshow OR body/nothing focused)
|
||||
const canControlSlideshow = isTvMode ? hasDirectFocus : (hasDirectFocus || isBodyFocused);
|
||||
|
||||
const focusElement = document.activeElement;
|
||||
// Check for Input Fields (always ignore typing)
|
||||
const isInputElement = activeElement && (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA' || activeElement.isContentEditable);
|
||||
if (isInputElement) return;
|
||||
|
||||
// Check active video players (ignore if video is playing/overlay is open)
|
||||
const videoPlayer = document.querySelector('.videoPlayerContainer');
|
||||
const trailerPlayer = document.querySelector('.youtubePlayerContainer');
|
||||
const isVideoOpen = (videoPlayer && !videoPlayer.classList.contains('hide')) || (trailerPlayer && !trailerPlayer.classList.contains('hide'));
|
||||
if (isVideoOpen) return;
|
||||
|
||||
switch (e.key) {
|
||||
case "ArrowRight":
|
||||
SlideshowManager.nextSlide();
|
||||
e.preventDefault();
|
||||
if (canControlSlideshow) {
|
||||
SlideshowManager.nextSlide();
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ArrowLeft":
|
||||
SlideshowManager.prevSlide();
|
||||
e.preventDefault();
|
||||
if (canControlSlideshow) {
|
||||
SlideshowManager.prevSlide();
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case " ": // Space bar
|
||||
this.togglePause();
|
||||
e.preventDefault();
|
||||
if (canControlSlideshow) {
|
||||
this.togglePause();
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case "m": // Mute toggle
|
||||
case "M":
|
||||
this.toggleMute();
|
||||
e.preventDefault();
|
||||
if (canControlSlideshow) {
|
||||
this.toggleMute();
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Enter":
|
||||
const currentItemId = STATE.slideshow.itemIds[STATE.slideshow.currentSlideIndex];
|
||||
if (currentItemId) {
|
||||
if (window.Emby && window.Emby.Page) {
|
||||
Emby.Page.show(
|
||||
`/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`
|
||||
);
|
||||
} else {
|
||||
window.location.href = `#/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`;
|
||||
}
|
||||
// Enter always requires direct focus on the slideshow to avoid conflicts
|
||||
if (hasDirectFocus) {
|
||||
const currentItemId = STATE.slideshow.itemIds[STATE.slideshow.currentSlideIndex];
|
||||
if (currentItemId) {
|
||||
if (window.Emby && window.Emby.Page) {
|
||||
Emby.Page.show(
|
||||
`/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`
|
||||
);
|
||||
} else {
|
||||
window.location.href = `#/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`;
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
e.preventDefault();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,12 +9,28 @@
|
||||
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.5.0.6",
|
||||
"changelog": "- fix: keyboard controls in TV mode\n- Add sorting options for content in configuration\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 4.0.1 from original repo",
|
||||
"version": "1.6.0.0",
|
||||
"changelog": "- add local trailer support on trailer button\nfix: iOS/MacOS playback issue?",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.0.6/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "c1c0736b06b3855523fe2eac25e6b34b",
|
||||
"timestamp": "2026-02-09T00:31:34Z"
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.6.0.0/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "d16997010900e2b18c1a8b33d4ecb9be",
|
||||
"timestamp": "2026-02-10T21:18:25Z"
|
||||
},
|
||||
{
|
||||
"version": "1.5.1.3",
|
||||
"changelog": "- fix: iOS/MacOS playback issue?",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.1.3/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "9d9dbed453673d4b78acf2adaaaee126",
|
||||
"timestamp": "2026-02-10T20:12:59Z"
|
||||
},
|
||||
{
|
||||
"version": "1.5.0.28",
|
||||
"changelog": "- fix: Keyboard controls in TV mode\n- Add sorting options for content\n- Add local trailer support\n- fix performance issue\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 4.0.1 from upstream repo",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.0.28/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "0261ff27be18d48cefa5078706954240",
|
||||
"timestamp": "2026-02-10T00:35:41Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.0.3",
|
||||
|
||||
32
test_scripts/fetch_random_item_browser_console.js
Normal file
32
test_scripts/fetch_random_item_browser_console.js
Normal file
@@ -0,0 +1,32 @@
|
||||
(async () => {
|
||||
const apiClient = window.ApiClient;
|
||||
if (!apiClient) { console.error("Logged in?"); return; }
|
||||
|
||||
try {
|
||||
// Fetch 1 random item ID
|
||||
const rnd = await apiClient.getItems(apiClient.getCurrentUserId(), { SortBy: "Random", Limit: 1, Recursive: true, IncludeItemTypes: "Movie,Series" });
|
||||
if (rnd.Items.length > 0) {
|
||||
const id = rnd.Items[0].Id;
|
||||
console.log("Random Item ID:", id);
|
||||
|
||||
// Fetch Default Details
|
||||
const defd = await apiClient.getItem(apiClient.getCurrentUserId(), id);
|
||||
console.log("Default Fields:", defd);
|
||||
|
||||
// Fetch ALL Known Fields manually
|
||||
const allFields = "Chapters,People,MediaStreams,UserData,RecursiveItemCount,DateCreated,MediaSources,ProductionYear,Studios,Genres,Tags,RemoteTrailers,ProviderIds,Overview,CommunityRating,CriticRating,OfficialRating,PremiereDate,RunTimeTicks";
|
||||
const full = await res.json();
|
||||
console.log("Full Details:", full);
|
||||
|
||||
// Helper to download JSON
|
||||
const blob = new Blob([JSON.stringify(full, null, 2)], { type: "application/json" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `jellyfin-item-${id}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
console.log("Downloaded JSON file.");
|
||||
} else { console.warn("No items."); }
|
||||
} catch (e) { console.error(e); }
|
||||
})();
|
||||
32
test_scripts/fetch_random_item_browser_console_2.js
Normal file
32
test_scripts/fetch_random_item_browser_console_2.js
Normal file
@@ -0,0 +1,32 @@
|
||||
(async () => {
|
||||
// 1. Get Auth Data from the active client
|
||||
const apiClient = window.ApiClient;
|
||||
if (!apiClient) {
|
||||
console.error("ApiClient not found. Are you logged in?");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log("Fetching random item...");
|
||||
|
||||
// 2. Fetch 1 random item
|
||||
// const result = await apiClient.getItems(apiClient.getCurrentUserId(), { SortBy: "Random", Limit: 1, Recursive: true, IncludeItemTypes: "Movie,Series" });
|
||||
const result = await apiClient.getItems(apiClient.getCurrentUserId(), {
|
||||
SortBy: "Random",
|
||||
Limit: 1,
|
||||
Recursive: true,
|
||||
IncludeItemTypes: "Movie,Series", // Optional: filter types
|
||||
Fields: "Overview,RemoteTrailers,Genres,CommunityRating,CriticRating,OfficialRating,PremiereDate,RunTimeTicks,ProductionYear,MediaSources" // Request ALL fields
|
||||
});
|
||||
|
||||
if (result.Items.length > 0) {
|
||||
const item = result.Items[0];
|
||||
console.log("Random Item Found:", item.Name);
|
||||
console.dir(item); // Prints the full interactive object
|
||||
} else {
|
||||
console.warn("No items found.");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching item:", error);
|
||||
}
|
||||
})();
|
||||
28
test_scripts/fetch_specific_items.js
Normal file
28
test_scripts/fetch_specific_items.js
Normal file
@@ -0,0 +1,28 @@
|
||||
(async () => {
|
||||
const apiClient = window.ApiClient;
|
||||
if (!apiClient) {
|
||||
console.error("ApiClient nicht gefunden.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Die ID des Items, das du abrufen möchtest
|
||||
const itemId = "DEINE_ITEM_ID_HIER";
|
||||
const userId = apiClient.getCurrentUserId();
|
||||
|
||||
try {
|
||||
console.log(`Rufe Details für Item ${itemId} ab...`);
|
||||
|
||||
// Nutze getItem() statt getItems()
|
||||
// Parameter: userId, itemId
|
||||
const item = await apiClient.getItem(userId, itemId);
|
||||
|
||||
if (item) {
|
||||
console.log("Item Details gefunden:", item.Name);
|
||||
console.dir(item); // Zeigt alle Metadaten (Genres, Pfade, ProviderIds, etc.)
|
||||
} else {
|
||||
console.warn("Item konnte nicht gefunden werden.");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Abrufen des Items:", error);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user