Music Player: keep the playlist after a page reload

Aperta
#127 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Ziqian-Huang0607 ci sta già lavorando.

Dal 25/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

backend difficulty: medium frontend

New here? Say hi on Discord first, it's the fastest way to get help: https://discord.gg/NW2YZACf4k

The Music Player (#120) keeps its playlist only in React state, so a reload clears it and you have to add tracks again from My Files.

Expected

  • The playlist, the current track and the volume survive a reload.
  • Shuffle and repeat settings survive too.

Suggested approach

  • Store { trackIds, currentIndex, volume, shuffle, repeat } in the user's preferences, using the same PUT /api/users/preferences the Weather app uses. Add a music field to the preferences in src/models/User.js.
  • Save only file ids (file-<id>). Don't save the URL or any content, and rebuild the track list from GET /api/files?meta=1 on load.
  • Skip ids that no longer exist, for example a deleted file.
  • Debounce saves, at most once every couple of seconds, so dragging the volume slider doesn't spam the API.

Where: src/context/MusicContext.js and src/models/User.js.

Done when

  • Reloading keeps the playlist and settings.
  • A deleted file is dropped quietly.
  • Tests cover the restore and deleted-file cases.

Comment "I'd like to take this" and we'll assign you. Questions are welcome in Discord: https://discord.gg/NW2YZACf4k

Lingua principale
JavaScript
Stelle
16
Fork
8
Merge medio
4h 24m
PR unite (30g)
10

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codehubbers/OrbitOS

Tutte le issue di codehubbers/OrbitOS

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.