From 5916d9f423c410a9b93de6def0edc3de9e158349 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Wed, 17 Jan 2018 17:31:56 +0100 Subject: [PATCH] Setting last audio tag event listener to set touchUnlocked when it is ready for playback --- src/sound/html5/HTML5AudioSoundManager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sound/html5/HTML5AudioSoundManager.js b/src/sound/html5/HTML5AudioSoundManager.js index 07c760e5c..4955eadbc 100644 --- a/src/sound/html5/HTML5AudioSoundManager.js +++ b/src/sound/html5/HTML5AudioSoundManager.js @@ -100,6 +100,11 @@ var HTML5AudioSoundManager = new Class({ } return true; }); + var lastTag = allTags[allTags.length - 1]; + lastTag.oncanplaythrough = function () { + lastTag.oncanplaythrough = null; + _this.touchUnlocked = true; + }; allTags.forEach(function (tag) { tag.load(); });