Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2e761bbd | ||
|
|
85f90e8fbb | ||
|
|
9f5f607168 | ||
|
|
108a644983 | ||
|
|
ab778f774f | ||
|
|
5dcb60487e | ||
|
|
9a6997f1da | ||
|
|
31d315ed8f | ||
|
|
2b1301ea0b | ||
|
|
ee8c0b8888 | ||
|
|
64ef4915b8 | ||
|
|
1f655ed7b6 |
@@ -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.6.1.28</Version>
|
<Version>1.6.1.32</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>
|
||||||
|
|
||||||
|
|||||||
@@ -1258,9 +1258,20 @@ const ApiUtils = {
|
|||||||
*/
|
*/
|
||||||
async fetchSponsorBlockData(videoId) {
|
async fetchSponsorBlockData(videoId) {
|
||||||
if (!CONFIG.useSponsorBlock) return { intro: null, outro: null };
|
if (!CONFIG.useSponsorBlock) return { intro: null, outro: null };
|
||||||
|
|
||||||
|
// Return cached result if available
|
||||||
|
if (!this._sponsorBlockCache) this._sponsorBlockCache = {};
|
||||||
|
if (this._sponsorBlockCache[videoId]) {
|
||||||
|
return this._sponsorBlockCache[videoId];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`https://sponsor.ajay.app/api/skipSegments?videoID=${videoId}&categories=["intro","outro"]`);
|
const response = await fetch(`https://sponsor.ajay.app/api/skipSegments?videoID=${videoId}&categories=["intro","outro"]`);
|
||||||
if (!response.ok) return { intro: null, outro: null };
|
if (!response.ok) {
|
||||||
|
const result = { intro: null, outro: null };
|
||||||
|
this._sponsorBlockCache[videoId] = result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const segments = await response.json();
|
const segments = await response.json();
|
||||||
let intro = null;
|
let intro = null;
|
||||||
@@ -1274,7 +1285,9 @@ const ApiUtils = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return { intro, outro };
|
const result = { intro, outro };
|
||||||
|
this._sponsorBlockCache[videoId] = result;
|
||||||
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Error fetching SponsorBlock data:', error);
|
console.warn('Error fetching SponsorBlock data:', error);
|
||||||
return { intro: null, outro: null };
|
return { intro: null, outro: null };
|
||||||
@@ -1709,6 +1722,13 @@ const SlideCreator = {
|
|||||||
event.target._endTime = playerVars.end || undefined;
|
event.target._endTime = playerVars.end || undefined;
|
||||||
event.target._videoId = videoId;
|
event.target._videoId = videoId;
|
||||||
|
|
||||||
|
if (STATE.slideshow.isMuted) {
|
||||||
|
event.target.mute();
|
||||||
|
} else {
|
||||||
|
event.target.unMute();
|
||||||
|
event.target.setVolume(40);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof event.target.setPlaybackQuality === 'function') {
|
if (typeof event.target.setPlaybackQuality === 'function') {
|
||||||
event.target.setPlaybackQuality(quality);
|
event.target.setPlaybackQuality(quality);
|
||||||
}
|
}
|
||||||
@@ -1718,14 +1738,6 @@ const SlideCreator = {
|
|||||||
const isVideoPlayerOpen = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer');
|
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') && !document.hidden && (!isVideoPlayerOpen || isVideoPlayerOpen.classList.contains('hide'))) {
|
||||||
// Set mute state only for active slide
|
|
||||||
if (STATE.slideshow.isMuted) {
|
|
||||||
event.target.mute();
|
|
||||||
} else {
|
|
||||||
event.target.unMute();
|
|
||||||
event.target.setVolume(40);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.target.playVideo();
|
event.target.playVideo();
|
||||||
|
|
||||||
// Check if it actually started playing after a short delay (handling autoplay blocks)
|
// Check if it actually started playing after a short delay (handling autoplay blocks)
|
||||||
@@ -1755,15 +1767,17 @@ const SlideCreator = {
|
|||||||
if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) {
|
if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) {
|
||||||
STATE.slideshow.slideInterval.stop();
|
STATE.slideshow.slideInterval.stop();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
event.target.mute();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'onStateChange': (event) => {
|
'onStateChange': (event) => {
|
||||||
if (event.data === YT.PlayerState.ENDED) {
|
if (event.data === YT.PlayerState.ENDED) {
|
||||||
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
if (slide && slide.classList.contains('active')) {
|
if (slide && slide.classList.contains('active')) {
|
||||||
|
if (CONFIG.waitForTrailerToEnd) {
|
||||||
SlideshowManager.nextSlide();
|
SlideshowManager.nextSlide();
|
||||||
|
} else {
|
||||||
|
event.target.playVideo(); // Loop if trailer is shorter than slide duration
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1793,40 +1807,36 @@ const SlideCreator = {
|
|||||||
style: "object-fit: cover; object-position: center center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; 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) {
|
|
||||||
videoAttributes.muted = "";
|
videoAttributes.muted = "";
|
||||||
}
|
|
||||||
|
|
||||||
backdrop = SlideUtils.createElement("video", videoAttributes);
|
backdrop = SlideUtils.createElement("video", videoAttributes);
|
||||||
|
|
||||||
if (!STATE.slideshow.isMuted) {
|
|
||||||
backdrop.volume = 0.4;
|
backdrop.volume = 0.4;
|
||||||
}
|
|
||||||
|
|
||||||
STATE.slideshow.videoPlayers[itemId] = backdrop;
|
STATE.slideshow.videoPlayers[itemId] = backdrop;
|
||||||
|
|
||||||
backdrop.addEventListener('play', () => {
|
backdrop.addEventListener('play', (event) => {
|
||||||
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
// backdrop.addEventListener('play', (event) => {
|
if (!slide || !slide.classList.contains('active')) {
|
||||||
// const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
console.log(`Local video ${itemId} started playing but slide is not active, pausing.`);
|
||||||
|
event.target.pause();
|
||||||
// if (!slide || !slide.classList.contains('active')) {
|
event.target.currentTime = 0;
|
||||||
// console.log(`Local video ${itemId} started playing but is not active, pausing.`);
|
return;
|
||||||
// event.target.pause();
|
}
|
||||||
// event.target.currentTime = 0;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) {
|
if (CONFIG.waitForTrailerToEnd && STATE.slideshow.slideInterval) {
|
||||||
STATE.slideshow.slideInterval.stop();
|
STATE.slideshow.slideInterval.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
backdrop.addEventListener('ended', () => {
|
backdrop.addEventListener('ended', () => {
|
||||||
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
|
if (slide && slide.classList.contains('active')) {
|
||||||
SlideshowManager.nextSlide();
|
SlideshowManager.nextSlide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
backdrop.addEventListener('error', () => {
|
backdrop.addEventListener('error', () => {
|
||||||
if (CONFIG.waitForTrailerToEnd) {
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
|
if (CONFIG.waitForTrailerToEnd && slide && slide.classList.contains('active')) {
|
||||||
SlideshowManager.nextSlide();
|
SlideshowManager.nextSlide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2281,42 +2291,40 @@ const SlideshowManager = {
|
|||||||
|
|
||||||
if (previousVisibleSlide) {
|
if (previousVisibleSlide) {
|
||||||
previousVisibleSlide.classList.remove("active");
|
previousVisibleSlide.classList.remove("active");
|
||||||
previousVisibleSlide.setAttribute("inert", "");
|
// previousVisibleSlide.setAttribute("inert", "");
|
||||||
previousVisibleSlide.setAttribute("tabindex", "-1");
|
// previousVisibleSlide.setAttribute("tabindex", "-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSlide.classList.add("active");
|
currentSlide.classList.add("active");
|
||||||
currentSlide.removeAttribute("inert");
|
// // Update Play/Pause Button State if it was paused
|
||||||
currentSlide.setAttribute("tabindex", "0");
|
// if (STATE.slideshow.isPaused) {
|
||||||
|
// STATE.slideshow.isPaused = false;
|
||||||
// Update Play/Pause Button State if it was paused
|
// const pauseButton = document.querySelector('.pause-button');
|
||||||
if (STATE.slideshow.isPaused) {
|
// if (pauseButton) {
|
||||||
STATE.slideshow.isPaused = false;
|
// pauseButton.innerHTML = '<i class="material-icons">pause</i>';
|
||||||
const pauseButton = document.querySelector('.pause-button');
|
// const pauseLabel = LocalizationUtils.getLocalizedString('ButtonPause', 'Pause');
|
||||||
if (pauseButton) {
|
// pauseButton.setAttribute("aria-label", pauseLabel);
|
||||||
pauseButton.innerHTML = '<i class="material-icons">pause</i>';
|
// pauseButton.setAttribute("title", pauseLabel);
|
||||||
const pauseLabel = LocalizationUtils.getLocalizedString('ButtonPause', 'Pause');
|
// }
|
||||||
pauseButton.setAttribute("aria-label", pauseLabel);
|
// }
|
||||||
pauseButton.setAttribute("title", pauseLabel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manage Video Playback: Stop others, Play current
|
// Manage Video Playback: Stop others, Play current
|
||||||
|
|
||||||
// 1. Pause and mute all other YouTube players
|
// 1. Stop all other YouTube players and local video elements
|
||||||
if (STATE.slideshow.videoPlayers) {
|
if (STATE.slideshow.videoPlayers) {
|
||||||
Object.keys(STATE.slideshow.videoPlayers).forEach(id => {
|
Object.keys(STATE.slideshow.videoPlayers).forEach(id => {
|
||||||
if (id !== currentItemId) {
|
if (id !== currentItemId) {
|
||||||
const p = STATE.slideshow.videoPlayers[id];
|
const p = STATE.slideshow.videoPlayers[id];
|
||||||
if (p) {
|
if (!p) return;
|
||||||
try {
|
// YouTube player
|
||||||
if (typeof p.pauseVideo === 'function') {
|
if (typeof p.pauseVideo === 'function') {
|
||||||
p.pauseVideo();
|
p.pauseVideo();
|
||||||
if (typeof p.mute === 'function') {
|
|
||||||
p.mute();
|
|
||||||
}
|
}
|
||||||
}
|
// HTML5 <video> element (local trailers)
|
||||||
} catch (e) { console.warn("Error pausing player", id, e); }
|
if (p instanceof HTMLVideoElement) {
|
||||||
|
p.pause();
|
||||||
|
p.muted = true;
|
||||||
|
p.currentTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2326,13 +2334,24 @@ const SlideshowManager = {
|
|||||||
document.querySelectorAll('video').forEach(video => {
|
document.querySelectorAll('video').forEach(video => {
|
||||||
if (!video.closest(`.slide[data-item-id="${currentItemId}"]`)) {
|
if (!video.closest(`.slide[data-item-id="${currentItemId}"]`)) {
|
||||||
video.pause();
|
video.pause();
|
||||||
video.muted = true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3. Play and Reset current video
|
// 3. Play and Reset current video
|
||||||
const videoBackdrop = currentSlide.querySelector('.video-backdrop');
|
const videoBackdrop = currentSlide.querySelector('.video-backdrop');
|
||||||
|
|
||||||
|
// Auto-unpause when a video slide becomes active
|
||||||
|
if (videoBackdrop && STATE.slideshow.isPaused) {
|
||||||
|
STATE.slideshow.isPaused = false;
|
||||||
|
const pauseButton = document.querySelector('.pause-button');
|
||||||
|
if (pauseButton) {
|
||||||
|
pauseButton.innerHTML = '<i class="material-icons">pause</i>';
|
||||||
|
const pauseLabel = LocalizationUtils.getLocalizedString('ButtonPause', 'Pause');
|
||||||
|
pauseButton.setAttribute("aria-label", pauseLabel);
|
||||||
|
pauseButton.setAttribute("title", pauseLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update mute button visibility
|
// Update mute button visibility
|
||||||
const muteButton = document.querySelector('.mute-button');
|
const muteButton = document.querySelector('.mute-button');
|
||||||
if (muteButton) {
|
if (muteButton) {
|
||||||
@@ -2362,28 +2381,12 @@ const SlideshowManager = {
|
|||||||
} else if (STATE.slideshow.videoPlayers && STATE.slideshow.videoPlayers[currentItemId]) {
|
} else if (STATE.slideshow.videoPlayers && STATE.slideshow.videoPlayers[currentItemId]) {
|
||||||
const player = STATE.slideshow.videoPlayers[currentItemId];
|
const player = STATE.slideshow.videoPlayers[currentItemId];
|
||||||
if (player && typeof player.loadVideoById === 'function' && player._videoId) {
|
if (player && typeof player.loadVideoById === 'function' && player._videoId) {
|
||||||
// If same video is already loaded, just seek and play (much faster)
|
// Use loadVideoById to enforce start and end times
|
||||||
let isAlreadyLoaded = false;
|
|
||||||
if (typeof player.getVideoData === 'function') {
|
|
||||||
try {
|
|
||||||
const data = player.getVideoData();
|
|
||||||
if (data && data.video_id === player._videoId) {
|
|
||||||
isAlreadyLoaded = true;
|
|
||||||
}
|
|
||||||
} catch (e) { /* player not fully ready */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAlreadyLoaded) {
|
|
||||||
player.seekTo(player._startTime || 0);
|
|
||||||
player.playVideo();
|
|
||||||
} else {
|
|
||||||
// Full load needed (first time or different video)
|
|
||||||
player.loadVideoById({
|
player.loadVideoById({
|
||||||
videoId: player._videoId,
|
videoId: player._videoId,
|
||||||
startSeconds: player._startTime || 0,
|
startSeconds: player._startTime || 0,
|
||||||
endSeconds: player._endTime
|
endSeconds: player._endTime
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (STATE.slideshow.isMuted) {
|
if (STATE.slideshow.isMuted) {
|
||||||
player.mute();
|
player.mute();
|
||||||
|
|||||||
@@ -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.6.1.28",
|
"version": "1.6.1.32",
|
||||||
"changelog": "- fix tv mode issue\n- refactor video playback management",
|
"changelog": "- fix tv mode issue\n- refactor video playback management",
|
||||||
"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.6.1.28/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.6.1.32/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
"checksum": "2b44f2ee7399b70c4bfdaae33ff80437",
|
"checksum": "8d12099d8b1972412b6c300eeddc0c1b",
|
||||||
"timestamp": "2026-02-14T14:38:40Z"
|
"timestamp": "2026-02-14T15:57:28Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"version": "1.6.0.2",
|
"version": "1.6.0.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user