Added check for touch events when trying to unlock web audio on iOS devices

This commit is contained in:
Pavle Goloskokovic 2018-01-06 15:03:28 +01:00
parent 01e5274c76
commit 2d2bf4c0e3

View file

@ -71,7 +71,7 @@ var WebAudioSoundManager = new Class({
*/
unlock: function () {
var _this = this;
if (this.context.state === 'suspended') {
if (this.context.state === 'suspended' && 'ontouchstart' in window) {
var unlock_1 = function () {
_this.context.resume().then(function () {
document.body.removeEventListener('touchstart', unlock_1);