Music Player: keep the playlist after a page reload

未关闭
#127 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@Ziqian-Huang0607 已经在做这个了。

开始于 2026年11月25日。

评估

这个 Issue 还没有评估数据。

描述

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

主要语言
JavaScript
星标
16
派生
8
平均合并
4 小时 24 分钟
30 天内合并 PR
10

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codehubbers/OrbitOS 的其他 Issue

查看 codehubbers/OrbitOS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。