Music Player: keep the playlist after a page reload

Đang mở
#127 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Ziqian-Huang0607 đang làm issue này rồi.

Từ ngày 25/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
16
Fork
8
Merge trung bình
4 giờ 24 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codehubbers/OrbitOS

Tất cả issue của codehubbers/OrbitOS

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.