mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Randomize backdrop images in screensaver
This provides a more varied experience viewing the backdrop screensaver.
This commit is contained in:
parent
1f4efb34f9
commit
7265308c8b
2 changed files with 4 additions and 2 deletions
|
@ -14,6 +14,7 @@ import 'material-design-icons-iconfont';
|
||||||
import '../../elements/emby-button/paper-icon-button-light';
|
import '../../elements/emby-button/paper-icon-button-light';
|
||||||
import ServerConnections from '../ServerConnections';
|
import ServerConnections from '../ServerConnections';
|
||||||
import screenfull from 'screenfull';
|
import screenfull from 'screenfull';
|
||||||
|
import { randomInt } from '../../utils/number.ts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of transition event.
|
* Name of transition event.
|
||||||
|
@ -71,7 +72,8 @@ function getBackdropImageUrl(item, options, apiClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.BackdropImageTags?.length) {
|
if (item.BackdropImageTags?.length) {
|
||||||
options.tag = item.BackdropImageTags[0];
|
options.index = randomInt(0, item.BackdropImageTags.length - 1);
|
||||||
|
options.tag = item.BackdropImageTags[options.index];
|
||||||
return apiClient.getScaledImageUrl(item.Id, options);
|
return apiClient.getScaledImageUrl(item.Id, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class BackdropScreensaver {
|
||||||
SortBy: 'Random',
|
SortBy: 'Random',
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: 'Taglines',
|
Fields: 'Taglines',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 10,
|
||||||
StartIndex: 0,
|
StartIndex: 0,
|
||||||
Limit: 200
|
Limit: 200
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue