Skip to content

Add autoplay toggle in Settings

jedmund requested to merge jedmund/autoplay-setting into main

Adds a Playback > Autoplay setting to /settings, backed by the existing settings key-value table (getSetting/setSetting).

Behavior when autoplay is off

  • /random loads an album but does not auto-start playback — user presses Play to start.
  • When a track ends, playback stops instead of auto-advancing to the next track.
  • Manual Play/Next/Prev (buttons, spacebar, arrow keys, track-row clicks) work as before.
  • Error and stall recovery still skip to the next track (these are corrective, not autoplay).

Default: on (existing behavior preserved).

Files

  • New src/routes/api/settings/autoplay/+server.ts — GET/POST for the autoplay setting.
  • src/routes/settings/+page.svelte — new Playback card with On/Off toggle.
  • src/routes/random/+page.svelte — fetches setting on mount; startFadeIn and handleAudioEnded short-circuit when disabled.

Test plan

  • Toggle autoplay in /settings; reload and confirm it persists
  • Autoplay on: /random auto-plays, auto-advances, skip loads next album and plays
  • Autoplay off: /random loads without playing; press Play, track plays; track end stops playback; skip loads next album without playing
  • Manual controls (spacebar, arrow keys, track clicks) work in both modes

Merge request reports

Loading