This commit is contained in:
jsemu2 2019-04-24 02:19:58 -04:00
parent ccc1a8200f
commit 5e48af37de

View file

@ -202,17 +202,19 @@ XAudioServer.prototype.initializeWebAudio = function () {
} }
var parentObj = this; var parentObj = this;
XAudioJSWebAudioWatchDogTimer = setInterval(function () { XAudioJSWebAudioWatchDogTimer = setInterval(function () {
if(typeof XAudioJSWebAudioContextHandle.state != "undefined" && XAudioJSWebAudioContextHandle.state === 'suspended') { if(typeof XAudioJSWebAudioContextHandle.state != "undefined") {
XAudioJSWebAudioWatchDogLast = (new Date()).getTime(); if (XAudioJSWebAudioContextHandle.state === 'suspended') {
try { XAudioJSWebAudioWatchDogLast = (new Date()).getTime();
XAudioJSWebAudioContextHandle.resume(); try {
XAudioJSWebAudioContextHandle.resume();
}
catch (e) {}
} }
catch (e) {} else {
} var timeDiff = (new Date()).getTime() - XAudioJSWebAudioWatchDogLast;
else { if (timeDiff > 500) {
var timeDiff = (new Date()).getTime() - XAudioJSWebAudioWatchDogLast; parentObj.initializeWebAudio();
if (timeDiff > 500) { }
parentObj.initializeWebAudio();
} }
} }
}, 500); }, 500);