We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ca73ae commit f510f71Copy full SHA for f510f71
1 file changed
src/sound/html5/HTML5AudioSoundManager.js
@@ -71,6 +71,23 @@ var HTML5AudioSoundManager = new Class({
71
this.sounds.push(sound);
72
return sound;
73
},
74
+ unlock: function () {
75
+ var _this = this;
76
+ if ('ontouchstart' in window) {
77
+ var unlock_1 = function () {
78
+ document.body.removeEventListener('touchstart', unlock_1);
79
+ document.body.removeEventListener('touchend', unlock_1);
80
+ _this.game.cache.audio.entries.each(function (key, tags) {
81
+ for (var i = 0; i < tags.length; i++) {
82
+ tags[i].load();
83
+ }
84
+ return true;
85
+ });
86
+ };
87
+ document.body.addEventListener('touchstart', unlock_1, false);
88
+ document.body.addEventListener('touchend', unlock_1, false);
89
90
+ },
91
onBlur: function () {
92
this.forEachActiveSound(function (sound) {
93
if (sound.isPlaying) {
0 commit comments