New display setting to configure slideshow delay

This commit is contained in:
Richard Nesnass
2025-07-23 01:01:12 +02:00
committed by Bill Thornton
parent c2df080ad8
commit a2fef21af2
7 changed files with 52 additions and 1 deletions
@@ -169,6 +169,30 @@ export function DisplayPreferences({ onChange, values }: Readonly<DisplayPrefere
</Fragment>
) }
<FormControl fullWidth>
<TextField
aria-describedby='display-settings-slideshow-interval-description'
value={values.slideshowInterval}
label={globalize.translate('LabelSlideshowInterval')}
name='slideshowInterval'
onChange={onChange}
slotProps={{
htmlInput: {
inputMode: 'numeric',
max: '3600',
min: '1',
pattern: '[0-9]',
required: true,
step: '1',
type: 'number'
}
}}
/>
<FormHelperText id='display-settings-slideshow-interval-description'>
{globalize.translate('LabelSlideshowIntervalHelp')}
</FormHelperText>
</FormControl>
<FormControl fullWidth>
<FormControlLabel
aria-describedby='display-settings-faster-animations-description'
@@ -103,6 +103,7 @@ async function loadDisplaySettings({
maxDaysForNextUp: settings.maxDaysForNextUp(),
screensaver: settings.screensaver() || 'none',
screensaverInterval: settings.backdropScreensaverInterval(),
slideshowInterval: settings.slideshowInterval(),
theme: settings.theme() || defaultTheme?.id || FALLBACK_THEME_ID
};
@@ -18,5 +18,6 @@ export interface DisplaySettingsValues {
maxDaysForNextUp: number;
screensaver: string;
screensaverInterval: number;
slideshowInterval: number;
theme: string;
}
@@ -89,6 +89,7 @@ function loadForm(context, user, userSettings) {
}
context.querySelector('.selectDashboardThemeContainer').classList.toggle('hide', !user.Policy.IsAdministrator);
context.querySelector('.txtSlideshowIntervalContainer').classList.remove('hide');
if (appHost.supports(AppFeature.Screensaver)) {
context.querySelector('.selectScreensaverContainer').classList.remove('hide');
@@ -112,6 +113,7 @@ function loadForm(context, user, userSettings) {
loadScreensavers(context, userSettings);
context.querySelector('#txtBackdropScreensaverInterval').value = userSettings.backdropScreensaverInterval();
context.querySelector('#txtSlideshowInterval').value = userSettings.slideshowInterval();
context.querySelector('#txtScreensaverTime').value = userSettings.screensaverTime();
context.querySelector('.chkDisplayMissingEpisodes').checked = user.Configuration.DisplayMissingEpisodes || false;
@@ -157,6 +159,7 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
userSettingsInstance.dashboardTheme(context.querySelector('#selectDashboardTheme').value);
userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value);
userSettingsInstance.backdropScreensaverInterval(context.querySelector('#txtBackdropScreensaverInterval').value);
userSettingsInstance.slideshowInterval(context.querySelector('#txtSlideshowInterval').value);
userSettingsInstance.screensaverTime(context.querySelector('#txtScreensaverTime').value);
userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value);
@@ -214,6 +214,11 @@
<div class="fieldDescription">${LabelBackdropScreensaverIntervalHelp}</div>
</div>
<div class="inputContainer hide txtSlideshowIntervalContainer inputContainer-withDescription">
<input is="emby-input" type="number" id="txtSlideshowInterval" pattern="[0-9]*" required="required" min="1" max="3600" step="1" label="${LabelSlideshowInterval}" />
<div class="fieldDescription">${LabelSlideshowIntervalHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" id="chkFadein" />
+4 -1
View File
@@ -1,4 +1,5 @@
import { ServerConnections } from 'lib/jellyfin-apiclient';
import * as userSettings from '../../scripts/settings/userSettings';
import { PluginType } from 'types/plugin.ts';
export default class PhotoPlayer {
@@ -24,7 +25,9 @@ export default class PhotoPlayer {
interval: 11000,
interactive: true,
// playbackManager.shuffle has no options. So treat 'shuffle' as a 'play' action
autoplay: options.autoplay || options.shuffle,
autoplay: {
delay: userSettings.slideshowInterval() * 1000
},
user: result
});
+14
View File
@@ -464,6 +464,19 @@ export class UserSettings {
return parseInt(this.get('backdropScreensaverInterval', false), 10) || 5;
}
/**
* Get or set the interval between slides when using the slideshow.
* @param {number|undefined} [val] - The interval between slides in seconds.
* @return {number} The interval between slides in seconds.
*/
slideshowInterval(val) {
if (val !== undefined) {
return this.set('slideshowInterval', val.toString(), false);
}
return parseInt(this.get('slideshowInterval', false), 10) || 5;
}
/**
* Get or set the amount of time it takes to activate the screensaver in seconds. Default 3 minutes.
* @param {number|undefined} [val] - The amount of time it takes to activate the screensaver in seconds.
@@ -705,6 +718,7 @@ export const skin = currentSettings.skin.bind(currentSettings);
export const theme = currentSettings.theme.bind(currentSettings);
export const screensaver = currentSettings.screensaver.bind(currentSettings);
export const backdropScreensaverInterval = currentSettings.backdropScreensaverInterval.bind(currentSettings);
export const slideshowInterval = currentSettings.slideshowInterval.bind(currentSettings);
export const screensaverTime = currentSettings.screensaverTime.bind(currentSettings);
export const libraryPageSize = currentSettings.libraryPageSize.bind(currentSettings);
export const maxDaysForNextUp = currentSettings.maxDaysForNextUp.bind(currentSettings);