perf(web): instant skips via gapless handoff to a pre-buffered element
Reintroduce the two-element handoff, this time as a skip-speed optimization (not for the OS tile). A second <audio> element pre-buffers the next track; on a forward skip playCurrent hands playback over to it instead of reloading the source, so playback starts immediately instead of ~1s. Covers are pre-warmed in parallel so the new artwork is ready too. Listeners are bound to both elements once (handlers guard with el !== S.audio). Safety: handoff only when the standby is buffered (readyState >= 2); otherwise falls back to the unchanged source-swap path, and a failed handoff play() recovers with a fresh source load. Web-only; the native bridge path is untouched. Note: this does not change the OS media-tile flicker (a separate, MSE-only fix). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
be73f717ac
commit
46e252b494
3 files changed
+94
-49
No files matched your search
@@ -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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user