From 5e48af37de846a329ebf8c0a3b410fc4029acef9 Mon Sep 17 00:00:00 2001 From: jsemu2 Date: Wed, 24 Apr 2019 02:19:58 -0400 Subject: [PATCH] update --- user_scripts/XAudioJS/XAudioServer.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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);