Repository navigation
api: web audio player for library tracks - #56
Merged
Merged
Conversation
Add browser playback of library tracks from the web UI:
- api/audio.go: GET /api/tracks/{id}/audio streams the track file with
proper Content-Type and Range support. Formats browsers decode natively
and gaplessly (mp3/wav/flac/ogg) stream as-is; others (aiff, m4a) are
transcoded to WAV through ffmpeg (same decoder as analysis) so browser
position lines up with the beat grid and cue times.
- api/web/index.html: player bar (play/pause, prev/next, seek, volume,
elapsed/total) wired to the library table and deck now-playing state.
- api/audio_test.go: host tests for the endpoint (content types, range
requests, transcode path).
Contributor
Author
|
I wanted a little player to test tracks on the fly. It's quick and dirty but willing to modify it to fit. |
vynulldev
self-requested a review
October 8, 2026 18:41
Owner
|
This is a brilliant and solid feature PR! Thank you! It builds clean, vet and gofmt are happy, the audio tests pass here, and the SPDX headers are in place. Happy to merge this as is. Two small things, both optional and both fine as follow-ups rather than anything blocking:
Really glad to have you here. If you feel like tackling either follow-up that's fine, otherwise I'll note them and we can pick them up later. Thanks again! |
vynulldev
approved these changes
Oct 8, 2026
Review feedback from the maintainer: - The cache never evicted: edited files left their old size/mtime entries behind and the directory grew without bound. After a successful encode, sweep stale entries of the same source (hash matches, size/mtime don't) and evict oldest-mtime entries while the directory is over a 2 GiB cap. - The global transcode mutex serialised transcodes of different tracks. Replace it with a per-source-file mutex, so the same track's probe + Range requests still dedup into one encode but distinct tracks run concurrently.
Contributor
Author
|
Both addressed in e60b132:
|
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds browser playback of library tracks from the web UI.
api/audio.go —
GET /api/tracks/{id}/audiostreams the track file withproper Content-Type and Range support. Formats every desktop browser decodes
natively and gaplessly (mp3/wav/flac/ogg) stream as-is; anything else (AIFF,
M4A/AAC) is transcoded to WAV through ffmpeg — the same decoder the analysis
uses — so the browser position lines up with the beat grid and cue times.
api/web/index.html — player bar in the library view: play/pause,
prev/next, seek, volume, elapsed/total, wired to the library table rows and
the now-playing state.
api/audio_test.go — host tests for the endpoint (content types, range
requests, transcode path).
Verified:
go build ./...clean,go test ./api/...passes.Note: this touches
api/web/index.html, so it may conflict with #55 — happyto rebase once that lands.