feat(web): gapless audio handoff to fix desktop media-tile flicker
Add a second <audio> element; S.audio always points at the active one and listeners are bound to both once (handlers guard with el !== S.audio). preloadNext buffers the next track into the standby element, and playCurrent hands playback over to it on skip instead of swapping the source — so the active element never empties and Windows keeps the media tile (also makes forward skips instant/gapless). Safety: handoff only when the standby is buffered (readyState >= 2); falls back to the unchanged source-swap path otherwise, if there's no second element, or if handoff play() rejects. Web-only — the native bridge path is untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
687650518e
commit
98d7c84269
4 files changed
+92
-48
No files matched your search
+1
-1
@@ -74,7 +74,7 @@ Versioning: two-part `MAJOR.MINOR` — each release bumps the minor (features an
|
||||
- **Android** — Offline detail screen flashed open then immediately returned: its initial empty state (before Room emitted) was mistaken for "deleted". Now shows a brief spinner until loaded, and only leaves when the last song is actually removed
|
||||
- **Android** — Lyrics autoscroll: rewrote centering to use the active line's *measured* position in a `LazyColumn` instead of a fixed line-height estimate. Eliminates the stutter and the downward drift on wrapped (multi-line) lyrics — the active line now tracks smoothly and sits at a natural ~40 %-from-top reading anchor
|
||||
- **Web** — Home now refreshes on an explicit Home click (matching Android): the album rows re-fetch and the random row re-randomizes instead of serving the 5-minute cache. Back/forward navigation still keeps the cached state
|
||||
- **Web (PWA)** — OS media tile no longer disappears/reappears when skipping tracks on desktop: the Media Session metadata is now mutated in place instead of replaced with a new `MediaMetadata` each track (which made Windows rebuild the tile)
|
||||
- **Web (PWA)** — OS media tile no longer disappears/reappears when skipping tracks on desktop. Two fixes: (1) the Media Session metadata is mutated in place instead of replaced with a new `MediaMetadata` each track, and (2) gapless handoff — playback is handed to a second, pre-buffered `<audio>` element on skip so the active element never empties (the source-swap gap is what made Windows hide the tile). Falls back to the classic source swap when the next track isn't preloaded
|
||||
|
||||
### Internal
|
||||
- **Android** — Offline system: `Room` DB (`novasonic_offline.db`) with `downloaded_tracks`, `download_groups`, `group_track_cross_refs`; `OfflineRepository` holds hot `StateFlow` maps for O(1) local-path lookups; `DownloadWorker` streams audio + cover art via `HttpURLConnection` to `context.filesDir/offline/{audio|covers}/`. `MusicRepository.streamUrl()` checks local files first, so playback uses the `file://` URI on every entry point
|
||||
|
||||
Reference in new issue
Block a user