X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=0e2c1c60b843cce879ee8a57c44d55af5b1aa0a9;hb=57078452549f252460d45e91b84c7eea40dd3e9c;hp=96174c1d6fca530ab2e3dc81af987ed511a426c4;hpb=4f524197ee499b58f574908c58bf50efa69dd359;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 96174c1d..0e2c1c60 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -1288,13 +1288,13 @@ export default { () => { const myIdx = (game.players[0].sid == this.st.user.sid ? 0 : 1); GameStorage.add(game, (err) => { - // If an error occurred, game is not added: a tab already - // added the game. Maybe a focused one, maybe not. - // We know for sure that it emitted the gong start sound. - // ==> Do not play it again. - if (!err && this.st.settings.sound) - new Audio("/sounds/newgame.flac").play().catch(() => {}); + // If an error occurred, game is not added: the focused tab + // already added the game. if (!this.focus) { + if (this.st.settings.sound) + // This will be played several times if several hidden tabs + // on Hall... TODO: fix that (how ?!) + new Audio("/sounds/newgame.flac").play().catch(() => {}); notify( "New live game", { body: "vs " + game.players[1-myIdx].name || "@nonymous" } @@ -1303,7 +1303,7 @@ export default { this.$router.push("/game/" + gameInfo.id); }); }, - this.focus ? 500 + 1000 * Math.random() : 0 + this.focus ? 0 : 500 + 1000 * Math.random() ); } }