Commit Graph
87 Commits
Author SHA1 Message Date
6578ba42ea Implementation of DLNA casting with additional fixes and features (#1887)
* feat: Add DLNA/UPnP casting support

Add ability to cast audio to DLNA/UPnP media renderers (e.g. WiiM, Sonos,
smart TVs) with gapless playback, album art, and volume sync.

- SSDP device discovery via child process (bypasses Electron sandbox)
- SOAP/UPnP control: play, pause, stop, seek, volume, mute
- SetNextAVTransportURI for gapless track transitions
- Gapless transition detection via position monitoring
- Cast button in player controls with device picker popover
- Volume sync from device on connect
- DIDL-Lite metadata with album art, artist, album, duration
- macOS network entitlements for LAN access
- Electron net.fetch for SOAP (Chromium networking stack)
- Startup fallback from DLNA to web player type
- Error boundary around DLNA player component

Closes #1431

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: Resolve TypeScript lint errors for CI

- Remove unused imports (PlayerStatus, Flex, useTranslation)
- Add itemType to ImageQuery calls
- Inline DlnaDevice interface to avoid cross-boundary import
- Prefix unused parameter with underscore

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: Clear gapless skip flag on explicit play/next/prev actions

Prevents the first track of a new album from being silently skipped
on the DLNA device when the previous album ended with a gapless transition.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: Resolve prettier/eslint formatting and empty catch blocks

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix: Apply perfectionist sorting rules and remaining lint fixes

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* Significant overhauls to discovery, casting, and remote control

* Stop overwriting MPV with Web when DLNA casting finishes, keep volume and player settings if Feishin is closed while casting, prevent changes to player type while casting

* Fixes for DLNA sync/queue logic and player logic

* Linting fixes and perfectionist-sort

* Fixed DLNA looping behavior and improved speaker -> Feishin latency

* Accidentally merged changes in the wrong order inside of Github GUI

* URL handling within DLNA player must now be asynchronous

* feat: switch to cast icon

* feat: improve ui

* Radio implementation & Sonos grouping/configuration

* Merge upstream changes

* Fix package.json

* Memory optimisation for CI attempt 1

* Memory optimisation for CI attempt 2

* Test packages and Electron builder against CI

* Test packages and Electron builder against CI 2

* Revert packages and Electron builder

* Memory optimisation for CI attempt 3

* Memory optimisation for CI attempt 4

* Memory optimisation for CI attempt 5

* Memory optimisation for CI attempt 6

* Revert src and build files to before tests

* Revert build files pending fix on main

* Accidentally prevented changing player from DLNA

* feature: improve design and refactor

* Implement DLNA-local switching and playback speed

* Linting fixes

* Fix radio bug, group detection, UI fixes, etc

* Syntax fixes

* Lint fixes & merge upstream

* On-discovery group isolation & general fixes, etc

* Fixed various issues & stereo pairs

* Possible fix for devices not being properly discovered

* XML decoding fix & Node location improvement

* Change disconnect, volume, and missing dependency behavior

* Simplify discovery on macOS

* Fix playback issues for DLNA and local players

* Build files reversion for merge

* Fix issue with looping for the second time

* Fix skipping back and forwards erroneously

* Transcode OPUS files to MP3 before casting

* Fix merge issues before IPC migration

* Fix upstream changes, playback, and IPC migration

* Fix multiple playback logic issues

* Fix erroneous stop state and disconnect color

* Fix all currently-known playback issues

* Fix 1.15.1 merge

* Fix CI memory issue

* Fix issues with grouping and reconnection

* Update position in queue when reconnecting

* fix(player): stop the DLNA renderer on mediaStop instead of seeking to zero

mediaStop sets PlayerStatus.STOPPED and resets the timestamp to 0 in one
store update, then emits PLAYER_STOP. The DLNA engine only handled PLAYING
and PAUSED and never subscribed to PLAYER_STOP, so the renderer received the
timestamp reset as Seek(0) and kept playing from the start.

- Subscribe to onPlayerStop: send Stop and clear the sent-URL state so the
  next Play re-sends the track (renderers may drop the URI on Stop).
- Ignore seek-to-timestamp while the store is STOPPED.
- Do not map a renderer-side STOPPED to PAUSED when the app itself stopped.

Observed on upmpdcli 1.9.17 (MPD 0.24) and a HEOS NR1609.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): ignore stale DLNA position polls after a seek or stop

The position poller ran every 500 ms with no in-flight guard and the SOAP
client has no timeout. Renderers such as upmpdcli block their control port
for several seconds while seeking an HTTP stream, so polls piled up and
answered late, out of order; an answer issued before a seek or stop then
overwrote the app position with the pre-seek value (observed as the slider
jumping back after a seek, and showing the old position after Stop).

- Skip a poll tick while one is still in flight.
- Discard any poll answer to a request issued before the latest app command
  (seek, stop, play, pause, track load); the play-URL flow now records the
  play time so a stale STOPPED is not mirrored back as a pause.
- In the renderer, ignore device position updates while the app is STOPPED.

Observed on upmpdcli 1.9.17 over a slow Wi-Fi link.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* feat(player): add max sample rate to transcoding settings

Jellyfin transcodes at the source sample rate. For DSD sources (decoded by
ffmpeg at 352.8 kHz) a FLAC transcode is therefore 352.8 kHz, which most
renderers refuse; a HEOS receiver capped at 192 kHz stops immediately.
Jellyfin's universal endpoint accepts maxAudioSampleRate, so expose it.

- TranscodingConfig gains an optional maxSampleRate (Hz).
- Transcoding settings get a "Max sample rate" field next to bitrate and
  format; the format placeholder now mentions flac.
- The Jellyfin adapter appends maxAudioSampleRate to the universal URL.
- Subsonic has no equivalent parameter and ignores the field.

Verified on a Marantz NR1609: the same universal FLAC URL is rejected at
352.8 kHz and plays with maxAudioSampleRate=192000.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): do not let a renderer that ignores SetVolume overwrite the app volume

Every device volume report was propagated to the app. A Marantz NR1609
(HEOS) playing a transcoded stream reports volume 0 and ignores SetVolume,
so each poll and every track change dragged the app slider back to 0 and
pushed 0 to the device.

- Record the app-set volume and give the device 5 s to reflect it before
  its reports count.
- Never pass on a zero that contradicts a non-zero app-set volume; a
  non-zero contradiction is treated as the user turning the device knob.
- After six polls that still contradict the app-set value, stop treating
  the device's volume reports as truth (logged once); trust is restored as
  soon as a report agrees with the app again, and reset on connect.

Direct FLAC on the same receiver reports and accepts volume normally, so
the guard must be per-stream, not per-device.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(ui): add the missing setting.transcodeNote string

The transcoding settings rows all use t('setting.transcodeNote') for their
tooltip, but no locale ever defined the key, so the raw key text was shown.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): use stream.{format} URLs for renderer transcodes on Jellyfin

Jellyfin transcodes were requested through the extension-less
/Audio/{id}/universal route. UPnP/DLNA renderers commonly pick a decoder
from the URL's file extension: a Yamaha HTR-6067 refuses the universal MP3
stream and plays the byte-identical /Audio/{id}/stream.mp3 stream.

For renderer playback only (the DLNA engine passes forRenderer), the
Jellyfin adapter now builds /Audio/{id}/stream.{format}?static=false with
audioBitRate and, when the source sample rate exceeds the configured
maximum, audioSampleRate (that route takes an exact rate, not a maximum).
A source whose container already matches the requested format is sent
untouched via Download, preserving the universal route's behaviour.
Local MPV and web playback keep using universal.

getSongUrl now forwards the song's container and sample rate so the adapter
can make both decisions.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): clamp the transcode sample-rate cap to 48 kHz for lossy formats

Passing the configured maximum sample rate through unchanged asked
Jellyfin for e.g. 192 kHz MP3 from a DSD source; libmp3lame, libopus and
aac cannot encode above 48 kHz, so ffmpeg fails and the stream never
starts (observed as "Unable to load file or stream" from mpv with
transcoding enabled). Clamp the cap to 48 kHz for aac, mp3, ogg, opus and
vorbis on both the universal and the stream.{format} routes; lossless
formats keep the configured value.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): seek transcoded DLNA streams by re-sending with a start offset

Jellyfin's transcode routes answer with a chunked body, no Content-Length and
Accept-Ranges: none, so a renderer cannot range into them. A UPnP Seek on such a
stream is accepted by a HEOS receiver (Marantz NR1609) and then the transport sits
in TRANSITIONING until it is given a new URI; the slider snaps back and nothing
plays. The same request on a direct file works, which is why it only shows with
transcoding on.

Seeks on these streams are now expressed the way Jellyfin's own web client does it:
the current track is re-sent with `startTimeTicks` at the requested position and the
main process adds that offset to every position it polls, so the app keeps showing
track time. The pending handoff / resume seek that the play flow already carried is
sent the same way, which also removes the post-Play Seek (and its mute trick) on
these streams. Streams the server cannot offset, other servers, and speed-changed
playback keep the plain Seek. The timestamp reset that a track change makes in the same
store update as the song swap is no longer forwarded as a Seek on these streams (it
restarted the old stream on the receiver just before the new URI arrived), and the main
process drops any Seek that still reaches it for a chunked stream. Verified on the NR1609: a re-sent stream with a 60 s
offset starts within 4 s and reports position from 0; without the offset the
receiver hangs in TRANSITIONING after Seek.

The offset only takes effect with a distinct play session: Jellyfin keys a running
transcode on media path, user agent, device id and play session id, and Feishin sent
an empty id, so the offset request was served from the job already running, from its
start. Transcode URLs now carry a play session id derived from item, format, sample-rate
cap and offset (a running job is also found by session id alone, so the item must
be part of it), which also means a changed cap no longer replays the old transcode.
The send flow additionally checks, right before the URI goes out, that the song it
resolved is still the current one, so a rapid double skip no longer delivers the
earlier track after the later one. (A forward skip legitimately triggers two sends,
from the song-change subscription and from MEDIA_NEXT; the existing 500 ms same-URL
check collapses that pair, so the guard must not be a plain "newer send started" test,
which made both sends stand down and nothing reach the renderer.)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): send the next track when the renderer does not advance on its own

The poller reports a track end in two ways: gapless (the renderer switched to the
queued next URI by itself) and not gapless (it sat at the end of the track, or dropped
to STOPPED). The engine ignored the flag and treated every end as gapless: it marked
the send as already done and only queued the following track, so a renderer that
accepts SetNextAVTransportURI but never acts on it (Yamaha HTR-6067) was left at the
end of the old track while the app walked the queue, one "stuck at end" every 1.5 s,
through the rest of the album. The flag left set also swallowed the next manual skip.

The handler now honours the flag: when the renderer did not advance, the new current
track is sent and the queue is re-armed from there.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): announce a transcoded DLNA stream by its own container

The DIDL-Lite protocolInfo sent with a track took its MIME type from the source's
content type or suffix before looking at the URL, so a FLAC file transcoded to MP3 for
a renderer was announced as audio/flac. A renderer that picks its decoder from the
announcement, or filters by it, refuses or mis-decodes the stream. The URL's own
extension (stream.mp3) now takes precedence; direct-play URLs have none and are
unaffected.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): time out DLNA SOAP calls and treat NO_MEDIA_PRESENT as stopped

The SOAP client had no timeout. Since the poller issues one request at a time, a
renderer that never answers a position query parked polling for good: the slider froze,
seeks looked ignored and track ends were never noticed. A Yamaha HTR-6067 stalls like
this and also takes up to 7 s to answer SetAVTransportURI, so polls now give up after
4 s and commands after 15 s; a timed-out poll simply yields to the next tick.

The same receiver reports NO_MEDIA_PRESENT rather than STOPPED once it has dropped or
finished a stream; the poller only knew STOPPED, so the app sat on a silent device
believing it was playing. The state is now treated as a stop. The play-URL handler's
catch, which swallowed every failure silently, logs it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* fix(player): keep a queued next URI clear of a Play in flight

A Yamaha HTR-6067 given SetNextAVTransportURI within about 300 ms of Play switches to
the queued URI instead of the one it was just told to play (reproduced by SOAP: 50 ms
after Play jumps, 300 ms after does not). The engine re-arms the queued next one second
after issuing a load, and on that receiver the load itself takes about that long, so the
re-arm landed on top of Play: a seek (re-sent as a new stream) or a track change played
the following track instead.

Next-URI changes (set and clear) now wait until no load or Play is in flight (a load
runs from SetAVTransportURI until Play has returned) and the last Play is at least a
second old; and Play waits for any next-URI call still being answered, since this
receiver takes up to a second to answer SetNextAVTransportURI while loading.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UxDiPkoRCtgk6rMMNjPfdT

* Fix issue with client-side disconnection

* Initial review pass

* Lint fix

* Implement requests and unify

* Fix playback logic

* Design parity improvements

* Fix popover issue and implement feedback

* Fix playback skipping since recent modifications

* Implement requests

---------

Co-authored-by: Paul Barker <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Manuel <[email protected]>
Co-authored-by: speedy-axolotl <[email protected]>
Co-authored-by: Ray Tran <[email protected]>
2026-09-11 22:01:16 -07:00
jeffvli 1e294c77f8 ci: skip weblate commits and fetch pre-push tip
Weblate translation pushes are not conventional, so ignore them.
After a force-push the pre-push tip is unreachable from any ref,
so commitlint cannot resolve the range without an explicit fetch.
2026-08-25 20:50:58 -07:00
jeffvli 8b5d646048 chore: add agent docs, skills, and commitlint
Introduce AGENTS.md (CLAUDE.md symlink), docs/agents guides, repo skills, and CI commitlint with Feishin scopes.
2026-08-16 11:53:21 -07:00
oHaoDaio d23f7619ec chore: Support pnpm v11 2026-06-09 22:15:47 -07:00
BotBlake f6f25154a1 add "enhancement" to exempt-issue-labels (#2061) 2026-06-09 11:22:36 -07:00
jeffvli 49bfc907cd bump lock-threads to v6 2026-05-28 23:07:47 -07:00
Kendall Garner a2cdce66bc chore(github): update bug report template 2026-05-27 21:20:08 -07:00
jeffvli bf7ca937ff force pnpm v10 in dockerfile 2026-05-25 22:00:31 -07:00
Damien Erambert 914ed5b8f3 macOS 26-friendly icon (#1941) 2026-04-13 20:32:21 -07:00
Jeff 16c9e6cc1b Fix various build issues (#1942)
* remove dynamic import for platform features

* increase node memory limit on macOS build

* fix invalid dynamic imports in renderer

* remove discord-rpc import in renderer
2026-04-10 01:54:11 -07:00
jeffvli 11d26af893 remove arm/v7 from container build 2026-04-06 09:47:28 -07:00
jeffvli 799cdb44d3 use pnpm v10 on runners 2026-03-13 17:11:24 -07:00
jeffvli 372892199f pin pnpm/action-setup to v4 2026-03-13 17:02:34 -07:00
jeffvli d16184fb25 bump actions dependencies to latest due to deprecated Node v20 2026-03-13 16:59:55 -07:00
jeffvli b8564f6d41 skip wait-for-lint on workflow dispatch 2026-03-13 16:38:32 -07:00
jeffvli adf48decc4 run PR publish on electron-builder config changes 2026-03-09 09:52:42 -07:00
jeffvli b67ee797cb move arm64 build configuration to electron-builder config (#1689) 2026-02-10 19:25:26 -08:00
Ahmed ElSayed fb170bb7c4 Add win-arm64 target (#1665) 2026-02-07 15:39:57 -08:00
jeffvli cf663de2fc add handlers and setting for nightly release 2026-02-05 23:45:32 -08:00
jeffvli 65c215fa9c fix R2_ENDPOINT_URL reference 2026-02-05 20:58:15 -08:00
jeffvli 8af972c20b add nightly publish build 2026-02-05 20:48:05 -08:00
jeffvli dcb84dd442 only run PR build on src changes 2025-12-23 20:26:24 -08:00
jeffvli ac257a9dc1 update PR publish to wait for lint success 2025-12-23 20:23:53 -08:00
jeffvli 5b45ae27fe add automatic update instructions to beta release notes 2025-11-03 00:44:52 -08:00
jeffvli 68f242d208 revert beta publish behavior 2025-10-25 19:19:06 -07:00
jeffvli c0264bd7b6 re-add beta suffix to tag version 2025-10-25 18:53:58 -07:00
jeffvli bb73d66153 test beta publish without re-release 2025-10-25 18:47:28 -07:00
jeffvli e14c017e34 add combined publish workflow 2025-10-22 01:46:34 -07:00
jeffvli 7cfce2589d fix release edit from draft 2025-10-22 01:45:19 -07:00
jeffvli 7aefe6890d update beta publish
- add increment beta version
- fix set prerelease
- move delete/cleanup to last step
2025-10-22 01:30:16 -07:00
jeffvli 877f286f43 switch test runner to only ubuntu-latest 2025-10-21 21:36:22 -07:00
Jonathan Chemla e02647feff auto-publish to winget-pkgs (#1188) 2025-10-21 15:09:48 -07:00
jeffvli f332d547a3 rename lint job 2025-10-12 16:20:50 -07:00
jeffvli fc847631d3 move prerelease set to new step 2025-10-12 03:57:08 -07:00
jeffvli 1d9f462959 fix prerelease notes 2025-10-12 03:56:57 -07:00
jeffvli 369b956c66 remove EP_PRE_RELEASE variable on publish 2025-10-12 03:30:36 -07:00
jeffvli 5f14ccf70d set electron-builder publish to draft, convert to prerelease after build 2025-10-12 03:21:09 -07:00
jeffvli 1686e7ad0b add separate beta publish scripts 2025-10-12 00:54:07 -07:00
jeffvli 3f7a402ce8 add commit notes to beta deploy 2025-10-11 20:05:26 -07:00
jeffvli 20c585aa1c remove unneeded tag deletion 2025-10-11 19:43:08 -07:00
jeffvli 0248997a75 delete old tags in addition to release 2025-10-11 19:41:19 -07:00
jeffvli aaaeea1fa5 split workflow into separate jobs, fix release rename step 2025-10-11 19:39:52 -07:00
jeffvli 22504e9e84 simplify prerelease deletion 2025-10-11 19:28:16 -07:00
jeffvli 5fb2ae839f fix previous release parser 2025-10-11 19:23:05 -07:00
jeffvli 15b00910f3 rework nightly deploy again
- rename to beta
- autodelete previous beta releases
- rename release title to Beta
2025-10-11 19:09:56 -07:00
jeffvli 6cce72a22a rework nightly deploy
- rename to development
- only manual push
- allow input for semantic version number
- set release to github prerelease instead of draft
2025-10-11 19:02:45 -07:00
jeffvli d48fe81d7f re-add build in nightly 2025-10-11 17:14:04 -07:00
jeffvli f0d0f826fb remove duplicate build in nightly 2025-10-11 15:06:52 -07:00
jeffvli 4d12a4d6cb add release channel setting and implementation 2025-10-11 15:05:29 -07:00
jeffvli f14d1f3c5c convert version bump to use pwsh 2025-10-11 14:15:03 -07:00