Update XAudioServer.js

This commit is contained in:
jsemu2 2019-04-24 02:10:02 -04:00
parent ece7e865c5
commit ccc1a8200f

View file

@ -202,13 +202,22 @@ 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();
}
catch (e) {}
}
else {
var timeDiff = (new Date()).getTime() - XAudioJSWebAudioWatchDogLast;
if (timeDiff > 500) {
parentObj.initializeWebAudio();
}
}
}, 500);
}
if (this.userEventLatch) {
if (this.userEventLatch && typeof XAudioJSWebAudioContextHandle.state != "undefined") {
var lazyEnableWA = function () {
if(XAudioJSWebAudioContextHandle.state === 'suspended') {
XAudioJSWebAudioContextHandle.resume();