fix: player bar instant update + stop music on app close

player.js: move NSBridge.setQueue() into requestAnimationFrame so the
updatePlayerUI DOM changes are committed and painted before the blocking
@JavascriptInterface call. setQueue serializes a large JSON payload and
blocks the JS/Blink main thread while Java parses it — deferring it one
frame ensures the player bar visually updates immediately on tap.

MusicService: onTaskRemoved now calls player.stop() + stopSelf() so
swiping the app from recents stops playback instead of leaving it running
in the background.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-09 15:00:18 +02:00
1 parent 7084fc4118
commit 8e752fa892
2 files changed
+12 -5

No files matched your search

@@ -101,8 +101,8 @@ class MusicService : MediaSessionService() {
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo) = mediaSession
override fun onTaskRemoved(rootIntent: Intent?) {
// Keep playing when swiped from recents; only stop if idle/empty
if (!player.playWhenReady || player.mediaItemCount == 0) stopSelf()
player.stop()
stopSelf()
}
override fun onDestroy() {