diff --git a/src/sound/webaudio/WebAudioSoundManager.js b/src/sound/webaudio/WebAudioSoundManager.js index 90860ba6de..53bbae9c0b 100644 --- a/src/sound/webaudio/WebAudioSoundManager.js +++ b/src/sound/webaudio/WebAudioSoundManager.js @@ -77,17 +77,20 @@ var WebAudioSoundManager = new Class({ */ this.destination = this.masterMuteNode; - this.locked = this.context.state === 'suspended' && ('ontouchstart' in window || 'onclick' in window); + this.locked = this.context.state === 'suspended'; BaseSoundManager.call(this, game); - if (this.locked && game.isBooted) + if (this.locked) { - this.unlock(); - } - else - { - game.events.once(GameEvents.BOOT, this.unlock, this); + if (game.isBooted) + { + this.unlock(); + } + else + { + game.events.once(GameEvents.BOOT, this.unlock, this); + } } }, @@ -320,15 +323,18 @@ var WebAudioSoundManager = new Class({ { bodyRemove('touchstart', unlockHandler); bodyRemove('touchend', unlockHandler); - bodyRemove('click', unlockHandler); + bodyRemove('mousedown', unlockHandler); + bodyRemove('mouseup', unlockHandler); bodyRemove('keydown', unlockHandler); _this.unlocked = true; + }, function () { bodyRemove('touchstart', unlockHandler); bodyRemove('touchend', unlockHandler); - bodyRemove('click', unlockHandler); + bodyRemove('mousedown', unlockHandler); + bodyRemove('mouseup', unlockHandler); bodyRemove('keydown', unlockHandler); }); } @@ -338,7 +344,8 @@ var WebAudioSoundManager = new Class({ { body.addEventListener('touchstart', unlockHandler, false); body.addEventListener('touchend', unlockHandler, false); - body.addEventListener('click', unlockHandler, false); + body.addEventListener('mousedown', unlockHandler, false); + body.addEventListener('mouseup', unlockHandler, false); body.addEventListener('keydown', unlockHandler, false); } },