1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4706 from TheMelmacian/feature/random_backdrop_image

Use a random backdrop image for video osd
This commit is contained in:
Bill Thornton 2023-09-14 00:19:39 -04:00 committed by GitHub
commit a7bf44bca3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 49 deletions

View file

@ -36,6 +36,7 @@ import Dashboard from '../../utils/dashboard';
import ServerConnections from '../../components/ServerConnections';
import confirm from '../../components/confirm/confirm';
import { download } from '../../scripts/fileDownloader';
import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage';
function autoFocus(container) {
import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
@ -501,34 +502,12 @@ function renderDetailPageBackdrop(page, item, apiClient) {
return false;
}
let imgUrl;
let hasbackdrop = false;
const itemBackdropElement = page.querySelector('#itemBackdrop');
if (item.BackdropImageTags?.length) {
imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: 'Backdrop',
maxWidth: dom.getScreenWidth(),
index: 0,
tag: item.BackdropImageTags[0]
});
imageLoader.lazyImage(itemBackdropElement, imgUrl);
hasbackdrop = true;
} else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
imgUrl = apiClient.getScaledImageUrl(item.ParentBackdropItemId, {
type: 'Backdrop',
maxWidth: dom.getScreenWidth(),
index: 0,
tag: item.ParentBackdropImageTags[0]
});
imageLoader.lazyImage(itemBackdropElement, imgUrl);
hasbackdrop = true;
} else if (item.ImageTags?.Primary) {
imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: 'Primary',
maxWidth: dom.getScreenWidth(),
tag: item.ImageTags.Primary
});
const imgUrl = getItemBackdropImageUrl(apiClient, item, { maxWitdh: dom.getScreenWidth() }, false);
if (imgUrl) {
imageLoader.lazyImage(itemBackdropElement, imgUrl);
hasbackdrop = true;
} else {