mirror of
https://github.com/rommapp/romm.git
synced 2026-12-06 15:54:45 +01:00
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:
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
|
||||
|
||||
Reference in new issue
Block a user