fix(v2): pause music when the viewport shrinks to a phone mid-game

Addresses Copilot's review note: the pause only watched the game stage, so a
desktop window narrowed to phone width while a game ran kept playing with the
top-bar controls hidden.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
This commit is contained in:
zurdiandClaude Opus 5 committed 2026-09-17 17:59:47 +02:00
1 parent 3a4969a356
commit af90842e72
1 file changed
+3 -6
@@ -26,12 +26,9 @@ const audioEl = ref<HTMLAudioElement | null>(null);
// On phones the mini player lives in the top bar, which a running game hides,
// so the music pauses rather than play on with no controls.
watch(
() => playingStore.stageActive,
(active) => {
if (active && smAndDown.value) audioEl.value?.pause();
},
);
watch([() => playingStore.stageActive, smAndDown], ([active, phone]) => {
if (active && phone) audioEl.value?.pause();
});
// Generation token — bumped every time we reassign `src`. Any async
// `play()` promise resolves against the token current when it was