fix(web): trigger audio.play() during 'loading' state, not only 'playing'

The layout's play-intent effect gated audioEl.play() on player.isPlaying
(state === 'playing'), but the state progression is loading → DOM play()
→ 'playing' event → state='playing'. Without calling play() during
loading, the DOM never starts, the event never fires, and state is
pinned to loading forever. Call play() for the intent-to-play union
(loading + playing), matching the store's design.
This commit is contained in:
2026-04-24 22:12:34 -04:00
parent 571eb2ec53
commit 4264ecf538
+4 -1
View File
@@ -53,7 +53,10 @@
$effect(() => {
if (!audioEl) return;
if (player.isPlaying) {
// "Intent to play" = loading or playing. During 'loading' the DOM hasn't
// emitted 'playing' yet, but we still need to call play() to get there.
const intent = player.state === 'playing' || player.state === 'loading';
if (intent) {
audioEl.play().catch(() => { /* interrupted / blocked — store gets the event */ });
} else {
audioEl.pause();