fixed initial track playback

This commit is contained in:
2026-02-06 06:50:44 -08:00
parent 3401967d7c
commit 5a920de85d

View File

@@ -660,9 +660,16 @@
aria-label={isPlaying ? "Pause" : "Play"}
title={isPlaying ? "Pause" : "Play"}
onclick={() => {
if (!audioEl) return;
if (audioEl.paused) void audioEl.play();
else audioEl.pause();
if (!audioEl || !snap.currentTrack) return;
// If src is not set, it's an initial play action.
// Delegate to syncAndAutoplay to ensure src is set and loaded.
if (!audioEl.src) {
void syncAndAutoplay();
} else {
if (audioEl.paused) void audioEl.play();
else audioEl.pause();
}
}}
disabled={!snap.currentTrack}
>
@@ -981,9 +988,16 @@
aria-label={isPlaying ? "Pause" : "Play"}
title={isPlaying ? "Pause" : "Play"}
onclick={() => {
if (!audioEl) return;
if (audioEl.paused) void audioEl.play();
else audioEl.pause();
if (!audioEl || !snap.currentTrack) return;
// If src is not set, it's an initial play action.
// Delegate to syncAndAutoplay to ensure src is set and loaded.
if (!audioEl.src) {
void syncAndAutoplay();
} else {
if (audioEl.paused) void audioEl.play();
else audioEl.pause();
}
}}
disabled={!snap.currentTrack}
>