Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d90523eef | ||
|
|
2a3e8057a1 | ||
|
|
42026b0ee8 | ||
|
|
64dbc3cfd3 | ||
|
|
c998266dd7 | ||
|
|
9b941e5a77 | ||
|
|
1d70d7166d | ||
|
|
5331f0faf1 | ||
|
|
0508188705 | ||
|
|
cc861f4263 | ||
|
|
10e6cdc4a2 | ||
|
|
a8c7faab6b |
@@ -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.3</Version>
|
<Version>1.7.0.7</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>
|
||||||
|
|
||||||
|
|||||||
@@ -1403,8 +1403,6 @@ const ApiUtils = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: trailer.Id,
|
id: trailer.Id,
|
||||||
// static=true forces Jellyfin to direct-stream (no transcoding) which enables
|
|
||||||
// HTTP Range Requests (Accept-Ranges: bytes) — required by Safari for video playback
|
|
||||||
url: `${STATE.jellyfinData.serverAddress}/Videos/${trailer.Id}/stream.mp4?mediaSourceId=${mediaSourceId}&api_key=${STATE.jellyfinData.accessToken}&static=true`
|
url: `${STATE.jellyfinData.serverAddress}/Videos/${trailer.Id}/stream.mp4?mediaSourceId=${mediaSourceId}&api_key=${STATE.jellyfinData.accessToken}&static=true`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1444,7 +1442,7 @@ const ApiUtils = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: video.Id,
|
id: video.Id,
|
||||||
url: `${STATE.jellyfinData.serverAddress}/Videos/${video.Id}/stream.mp4?api_key=${STATE.jellyfinData.accessToken}`
|
url: `${STATE.jellyfinData.serverAddress}/Videos/${video.Id}/stream.mp4?api_key=${STATE.jellyfinData.accessToken}&static=true`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1670,7 +1668,7 @@ const SlideCreator = {
|
|||||||
|
|
||||||
trailerUrl = {
|
trailerUrl = {
|
||||||
id: videoId,
|
id: videoId,
|
||||||
url: `${STATE.jellyfinData.serverAddress}/Videos/${videoId}/stream.mp4?api_key=${STATE.jellyfinData.accessToken}`
|
url: `${STATE.jellyfinData.serverAddress}/Videos/${videoId}/stream.mp4?api_key=${STATE.jellyfinData.accessToken}&static=true`
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// Assume it's a standard URL (YouTube, etc.)
|
// Assume it's a standard URL (YouTube, etc.)
|
||||||
@@ -1751,8 +1749,8 @@ const SlideCreator = {
|
|||||||
// Fetch SponsorBlock data
|
// Fetch SponsorBlock data
|
||||||
ApiUtils.fetchSponsorBlockData(videoId).then(segments => {
|
ApiUtils.fetchSponsorBlockData(videoId).then(segments => {
|
||||||
const playerVars = {
|
const playerVars = {
|
||||||
autoplay: 1,
|
autoplay: 0,
|
||||||
mute: 1, // need to be muted for Safari, because apple makes life difficult...
|
mute: STATE.slideshow.isMuted ? 1 : 0,
|
||||||
controls: 0,
|
controls: 0,
|
||||||
disablekb: 1,
|
disablekb: 1,
|
||||||
fs: 0,
|
fs: 0,
|
||||||
@@ -1800,8 +1798,6 @@ const SlideCreator = {
|
|||||||
const iframe = event.target.getIframe();
|
const iframe = event.target.getIframe();
|
||||||
if (iframe) {
|
if (iframe) {
|
||||||
iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
|
iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
|
||||||
// Full allow attribute matching what YouTube sets on their own embed pages
|
|
||||||
iframe.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store start/end time and videoId for later use
|
// Store start/end time and videoId for later use
|
||||||
@@ -1812,8 +1808,9 @@ const SlideCreator = {
|
|||||||
// Store reference to wrapper for fading
|
// Store reference to wrapper for fading
|
||||||
event.target._wrapperDiv = videoBackdrop;
|
event.target._wrapperDiv = videoBackdrop;
|
||||||
|
|
||||||
// Unmute now if user wants sound.
|
if (STATE.slideshow.isMuted) {
|
||||||
if (!STATE.slideshow.isMuted) {
|
event.target.mute();
|
||||||
|
} else {
|
||||||
event.target.unMute();
|
event.target.unMute();
|
||||||
event.target.setVolume(40);
|
event.target.setVolume(40);
|
||||||
}
|
}
|
||||||
@@ -1822,34 +1819,28 @@ const SlideCreator = {
|
|||||||
event.target.setPlaybackQuality(quality);
|
event.target.setPlaybackQuality(quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop playback if slide was navigated away from
|
// Only play if this is the active slide
|
||||||
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
const slide = document.querySelector(`.slide[data-item-id="${itemId}"]`);
|
||||||
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'))) {
|
||||||
event.target.stopVideo();
|
event.target.playVideo();
|
||||||
} 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,
|
// Check if it actually started playing after a short delay (handling autoplay blocks)
|
||||||
// and fallback to muted play if autoplay failed for any reason.
|
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
|
// Re-check conditions before processing fallback
|
||||||
const isVideoPlayerOpenNow = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer');
|
const isVideoPlayerOpenNow = document.querySelector('.videoPlayerContainer') || document.querySelector('.youtubePlayerContainer');
|
||||||
if (document.hidden || (isVideoPlayerOpenNow && !isVideoPlayerOpenNow.classList.contains('hide')) || !slide.classList.contains('active')) {
|
if (document.hidden || (isVideoPlayerOpenNow && !isVideoPlayerOpenNow.classList.contains('hide')) || !slide.classList.contains('active')) {
|
||||||
console.log(`Navigation detected during autoplay check for ${itemId}, stopping video.`);
|
console.log(`Navigation detected during autoplay check for ${itemId}, stopping video.`);
|
||||||
try {
|
try {
|
||||||
event.target.stopVideo();
|
event.target.stopVideo();
|
||||||
} catch (e) { console.warn("Error stopping video:", e); }
|
} catch (e) { console.warn("Error stopping video in timeout:", e); }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If somehow not playing/buffering yet, force muted fallback
|
if (event.target.getPlayerState() !== YT.PlayerState.PLAYING &&
|
||||||
const state = event.target.getPlayerState();
|
event.target.getPlayerState() !== YT.PlayerState.BUFFERING) {
|
||||||
if (state !== YT.PlayerState.PLAYING && state !== YT.PlayerState.BUFFERING) {
|
console.warn(`Autoplay blocked for ${itemId}, attempting muted fallback`);
|
||||||
console.warn(`Autoplay stalled for ${itemId}, attempting muted fallback`);
|
|
||||||
event.target.mute();
|
event.target.mute();
|
||||||
event.target.playVideo();
|
event.target.playVideo();
|
||||||
}
|
}
|
||||||
@@ -1857,6 +1848,11 @@ const SlideCreator = {
|
|||||||
|
|
||||||
if (!STATE.slideshow.autoplayTimeouts) STATE.slideshow.autoplayTimeouts = [];
|
if (!STATE.slideshow.autoplayTimeouts) STATE.slideshow.autoplayTimeouts = [];
|
||||||
STATE.slideshow.autoplayTimeouts.push(timeoutId);
|
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) => {
|
'onStateChange': (event) => {
|
||||||
@@ -1900,7 +1896,6 @@ const SlideCreator = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
videoAttributes.muted = "";
|
videoAttributes.muted = "";
|
||||||
videoAttributes.playsinline = ""; // again Safari needs extra treatment...
|
|
||||||
|
|
||||||
videoBackdrop = SlideUtils.createElement("video", videoAttributes);
|
videoBackdrop = SlideUtils.createElement("video", videoAttributes);
|
||||||
videoBackdrop.volume = 0.4;
|
videoBackdrop.volume = 0.4;
|
||||||
@@ -1932,10 +1927,7 @@ const SlideCreator = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
videoBackdrop.addEventListener('error', (event) => {
|
videoBackdrop.addEventListener('error', (event) => {
|
||||||
const src = event.target.src || event.target.getAttribute('data-src') || 'unknown';
|
console.warn(`Local video error for item ${itemId}`);
|
||||||
const errCode = event.target.error ? event.target.error.code : 'n/a';
|
|
||||||
const errMsg = event.target.error ? event.target.error.message : 'n/a';
|
|
||||||
console.warn(`Local video error for item ${itemId} | code=${errCode} | msg=${errMsg} | url=${src}`);
|
|
||||||
const slide = event.target.closest('.slide');
|
const slide = event.target.closest('.slide');
|
||||||
if (slide && slide.classList.contains('active')) {
|
if (slide && slide.classList.contains('active')) {
|
||||||
SlideshowManager.nextSlide();
|
SlideshowManager.nextSlide();
|
||||||
@@ -2474,16 +2466,19 @@ const SlideshowManager = {
|
|||||||
if (videoBackdrop.tagName === 'VIDEO') {
|
if (videoBackdrop.tagName === 'VIDEO') {
|
||||||
// Restore src from data-src if it was deactivated to release connections
|
// Restore src from data-src if it was deactivated to release connections
|
||||||
const lazySrc = videoBackdrop.getAttribute('data-src');
|
const lazySrc = videoBackdrop.getAttribute('data-src');
|
||||||
const isFreshLoad = lazySrc && !videoBackdrop.src;
|
if (lazySrc && !videoBackdrop.src) {
|
||||||
|
videoBackdrop.src = lazySrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
videoBackdrop.currentTime = 0;
|
||||||
|
|
||||||
videoBackdrop.muted = STATE.slideshow.isMuted;
|
videoBackdrop.muted = STATE.slideshow.isMuted;
|
||||||
if (!STATE.slideshow.isMuted) {
|
if (!STATE.slideshow.isMuted) {
|
||||||
videoBackdrop.volume = 0.4;
|
videoBackdrop.volume = 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
const doPlay = () => {
|
|
||||||
if (!currentSlide.classList.contains('active')) return;
|
|
||||||
videoBackdrop.play().catch(e => {
|
videoBackdrop.play().catch(e => {
|
||||||
|
// Check if it actually started playing after a short delay (handling autoplay blocks)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (videoBackdrop.paused && currentSlide.classList.contains('active')) {
|
if (videoBackdrop.paused && currentSlide.classList.contains('active')) {
|
||||||
console.warn(`Autoplay blocked for ${currentItemId}, attempting muted fallback`);
|
console.warn(`Autoplay blocked for ${currentItemId}, attempting muted fallback`);
|
||||||
@@ -2492,41 +2487,22 @@ const SlideshowManager = {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
if (isFreshLoad) {
|
|
||||||
// Safari: set src, then wait for loadedmetadata before seeking/playing
|
|
||||||
videoBackdrop.src = lazySrc;
|
|
||||||
videoBackdrop.load();
|
|
||||||
videoBackdrop.addEventListener('loadedmetadata', () => {
|
|
||||||
videoBackdrop.currentTime = 0;
|
|
||||||
doPlay();
|
|
||||||
}, { once: true });
|
|
||||||
} else {
|
|
||||||
// src already set (e.g. paused slide resuming)
|
|
||||||
videoBackdrop.currentTime = 0;
|
|
||||||
doPlay();
|
|
||||||
}
|
|
||||||
} 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) {
|
||||||
// Use loadVideoById to enforce start and end times
|
// Use loadVideoById to enforce start and end times
|
||||||
// load always starts muted first, then unmute if needed
|
|
||||||
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) {
|
||||||
player.mute();
|
player.mute();
|
||||||
if (!STATE.slideshow.isMuted) {
|
} else {
|
||||||
setTimeout(() => {
|
|
||||||
// Only unmute if still on the same slide
|
|
||||||
if (currentSlide.classList.contains('active')) {
|
|
||||||
player.unMute();
|
player.unMute();
|
||||||
player.setVolume(40);
|
player.setVolume(40);
|
||||||
}
|
}
|
||||||
}, 600);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if playback successfully started, otherwise fallback to muted
|
// Check if playback successfully started, otherwise fallback to muted
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -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.3",
|
"version": "1.7.0.7",
|
||||||
"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.3/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.7.0.7/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||||
"checksum": "b4f35ff869129d43c075948e5430b199",
|
"checksum": "932e1b1cd932d5c681175e3590b77458",
|
||||||
"timestamp": "2026-03-05T23:23:07Z"
|
"timestamp": "2026-03-06T00:45:37Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"version": "1.6.6.4",
|
"version": "1.6.6.4",
|
||||||
|
|||||||
Reference in New Issue
Block a user