From 7094e789637628911a0ef786bded49b8f6970a03 Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Fri, 5 Mar 2021 21:54:24 -0600 Subject: [PATCH] Added a restriction to the in-game audio cue restricting play to only occur if the window is minimized and/or does not have focus. --- gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js index 31aed1aa1..38b48dba8 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js @@ -1956,7 +1956,10 @@ var GempLotrGameUI = Class.extend({ PlaySound: function(soundObj) { var myAudio = document.getElementById(soundObj); - myAudio.play(); + if(!document.hasFocus() || document.hidden || document.msHidden || document.webkitHidden) + { + myAudio.play(); + } }, createActionChoiceContextMenu: function (actions, event, selectActionFunction) {