diff --git a/user_scripts/XAudioJS/XAudioServer.js b/user_scripts/XAudioJS/XAudioServer.js index 8fb1818..8284ac6 100644 --- a/user_scripts/XAudioJS/XAudioServer.js +++ b/user_scripts/XAudioJS/XAudioServer.js @@ -202,17 +202,19 @@ XAudioServer.prototype.initializeWebAudio = function () { } var parentObj = this; XAudioJSWebAudioWatchDogTimer = setInterval(function () { - if(typeof XAudioJSWebAudioContextHandle.state != "undefined" && XAudioJSWebAudioContextHandle.state === 'suspended') { - XAudioJSWebAudioWatchDogLast = (new Date()).getTime(); - try { - XAudioJSWebAudioContextHandle.resume(); + if(typeof XAudioJSWebAudioContextHandle.state != "undefined") { + if (XAudioJSWebAudioContextHandle.state === 'suspended') { + XAudioJSWebAudioWatchDogLast = (new Date()).getTime(); + try { + XAudioJSWebAudioContextHandle.resume(); + } + catch (e) {} } - catch (e) {} - } - else { - var timeDiff = (new Date()).getTime() - XAudioJSWebAudioWatchDogLast; - if (timeDiff > 500) { - parentObj.initializeWebAudio(); + else { + var timeDiff = (new Date()).getTime() - XAudioJSWebAudioWatchDogLast; + if (timeDiff > 500) { + parentObj.initializeWebAudio(); + } } } }, 500);