[Feature]: Desktop app: music and Listen Together

未關閉
#91 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
15/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
rust, typescript

研究方向

Read epic #80 and prerequisite issues #82 and #83 first, then compare the web player in web/src/music/, especially decoder.worker.ts, engine.ts, and listen.ts, with the shared queue logic in packages/shared/src/music.ts and its music.test.ts tests. The issue calls for a native desktop audio engine, player UI, queue synchronization, and Listen Together integration across several subsystems. Done means gapless playback, matching crossfade and ReplayGain behavior, shared queue continuity, and Listen Together compatibility with web members.

由索引模型根據 Issue 內容生成。

描述

enhancement

[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a planning session with @PhrolovaMoe. Part of #80, builds on #82 and #83. Read the epic first.

Area

Desktop app

Problem

Music on the web is a fully custom, hi-fi player: untranscoded playback, sample-accurate gapless, crossfade and ReplayGain, a server-side queue shared with Subsonic clients, and Listen Together. The app needs the same thing natively, not through mpv.

Proposed solution
Engine
  • Decode with decoder/core (symphonia, gapless sequence, resampling to the output rate), exactly as the web worker does (web/src/music/decoder.worker.ts, engine.ts).
  • Read files through a Read + Seek adapter over HTTP Range requests on /api/music/tracks/{id}/file, with the same fallback the web uses (…/flac for lossless formats the decoder can't read, …/stream only when the user asks for lossy).
  • Output with cpal. On Linux that's the ALSA host, which reaches PipeWire/PulseAudio through their ALSA plugins. Use the device's default rate and follow the default device when it changes.
  • A lock-free ring between the decode thread and the cpal callback, like the web's ring.ts/worklet.ts. The position comes from frames actually played, as on web.
  • ReplayGain Off/Track/Album/Auto (default Auto), crossfade (off by default, never between consecutive tracks of the same album), and volume, all as on web.
Player logic
  • Port packages/shared/src/music.ts (queue, repeat/shuffle, keeping the server's play queue in step) to Rust, with its tests (music.test.ts) ported too. Behaviour must match, because web, Android and Subsonic clients share the server's queue. Send the client argument on nowPlaying/savePlayQueue as the other apps do.
  • Starting a video, clip or room pauses music and hides the pill; leaving it brings the pill back paused. The pill can only be closed while paused. The queue persists. All as on web.
UI

The web is the spec (web/src/music/):

  • Library (Albums / Artists / Songs / Playlists) in the sidebar's music library, routes/album.$id.tsx, artist.$id.tsx, playlist.$id.tsx.
  • The bottom-centre pill → floating card → full-screen Now Playing (Lyrics / Queue / Info) with synced lyrics, tinted from the artwork (Pill.tsx, NowPlaying.tsx, controls.tsx, components.tsx).
  • Stars, ratings, playlists, history: the same mutations.
Listen Together

Port web/src/music/listen.ts and routes/listen.$code.tsx: the listen WebSocket (/api/listen/{code}/ws), the room's routes for files/covers/avatars, guests without sign-in, and joining from tinystream://<host>/listen/<code> and web URLs (the entry point is called by #92).

MPRIS for music is wired in #92. Expose the player state it needs (metadata, art URL, position, rate, controls).

Done when

An album with gapless transitions plays without a gap or click. Crossfade and ReplayGain sound the same as on web. The queue picked up on web continues in the app and the other way round. Listen Together works with web members. CPU use while playing is low (well under a browser tab playing the same).

主要語言
TypeScript
星號
4
分支
1
平均合併
4 小時 49 分鐘
30 天內合併 PR
5

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

tinystream-dev/tinystream 的其他 Issue

查看 tinystream-dev/tinystream 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。