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:
HoneyandClaude Opus 4.8 committed 2026-06-26 17:13:22 +02:00
1 parent 687650518e
commit 98d7c84269
4 files changed
+92 -48

No files matched your search

+1
View File
@@ -742,6 +742,7 @@
<div class="toast-container" id="toast-container"></div>
<audio id="audio-element" preload="auto" playsinline crossorigin="anonymous"></audio>
<audio id="audio-element-b" preload="auto" playsinline crossorigin="anonymous"></audio>
<audio id="preview-audio"></audio>
<audio id="abs-audio"></audio>