diff --git a/components/settings/PlaybackControlsSettings.tsx b/components/settings/PlaybackControlsSettings.tsx index 7a1a8d2b9..34379abeb 100644 --- a/components/settings/PlaybackControlsSettings.tsx +++ b/components/settings/PlaybackControlsSettings.tsx @@ -98,6 +98,48 @@ export const PlaybackControlsSettings: React.FC = () => { [settings?.maxAutoPlayEpisodeCount?.key, t, updateSettings], ); + // Clamp persisted value to the 5-60s bounds so the dropdown always shows a + // valid selection even if an out-of-range value was stored previously. + const autoplayCountdown = Math.min( + 60, + Math.max(5, settings?.autoplayCountdownSeconds ?? 15), + ); + const castAutoplayCountdown = Math.min( + 60, + Math.max(5, settings?.castAutoplayCountdownSeconds ?? 30), + ); + + const autoplayCountdownOptions = useMemo( + () => [ + { + options: AUTOPLAY_COUNTDOWN_SECONDS.map((seconds) => ({ + type: "radio" as const, + label: String(seconds), + value: String(seconds), + selected: seconds === autoplayCountdown, + onPress: () => updateSettings({ autoplayCountdownSeconds: seconds }), + })), + }, + ], + [autoplayCountdown, updateSettings], + ); + + const castAutoplayCountdownOptions = useMemo( + () => [ + { + options: AUTOPLAY_COUNTDOWN_SECONDS.map((seconds) => ({ + type: "radio" as const, + label: String(seconds), + value: String(seconds), + selected: seconds === castAutoplayCountdown, + onPress: () => + updateSettings({ castAutoplayCountdownSeconds: seconds }), + })), + }, + ], + [castAutoplayCountdown, updateSettings], + ); + const playbackSpeedOptions = useMemo( () => [ { @@ -259,6 +301,48 @@ export const PlaybackControlsSettings: React.FC = () => { > + + + + {autoplayCountdown} + + + } + title={t("home.settings.other.autoplay_countdown_seconds")} + /> + + + + + + {castAutoplayCountdown} + + + + } + title={t("home.settings.other.cast_autoplay_countdown_seconds")} + /> + ); @@ -279,3 +363,6 @@ const AUTOPLAY_EPISODES_COUNT = ( { key: "6", value: 6 }, { key: "7", value: 7 }, ]; + +// Selectable next-episode countdown durations, bounded to 5-60 seconds. +const AUTOPLAY_COUNTDOWN_SECONDS: number[] = [5, 10, 15, 20, 30, 45, 60]; diff --git a/translations/en.json b/translations/en.json index b3789acdd..38bc45fbe 100644 --- a/translations/en.json +++ b/translations/en.json @@ -405,6 +405,8 @@ "segment_skip_none": "None", "segment_skip_ask": "Show Skip Button", "segment_skip_auto": "Auto Skip", + "autoplay_countdown_seconds": "Player countdown (seconds)", + "cast_autoplay_countdown_seconds": "Chromecast countdown (seconds)", "disabled": "Disabled" }, "downloads": {