1
0
Fork 0
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:
Yenof 2023-10-28 17:11:33 -07:00 committed by Dmitry Lyzo
parent 1f4efb34f9
commit 7265308c8b
2 changed files with 4 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import 'material-design-icons-iconfont';
import '../../elements/emby-button/paper-icon-button-light';
import ServerConnections from '../ServerConnections';
import screenfull from 'screenfull';
import { randomInt } from '../../utils/number.ts';
/**
* Name of transition event.
@ -71,7 +72,8 @@ function getBackdropImageUrl(item, options, apiClient) {
}
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);
}