From af4b787b43ebffe20ad50327c7834d079c35da3d Mon Sep 17 00:00:00 2001 From: Tomer Lahav Date: Tue, 2 May 2017 18:27:11 -0400 Subject: [PATCH 1/2] Fix for WebAudio context not being unlocked on Android Chrome >= 55. --- src/howler.core.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/howler.core.js b/src/howler.core.js index 2c811a65..76e5271e 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -315,6 +315,9 @@ source.start(0); } + // Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55. + self.ctx.resume(); + // Setup a timeout to check that we are unlocked on the next event loop. source.onended = function() { source.disconnect(0); From 223cca33c1556b27198479be675ff934041a5601 Mon Sep 17 00:00:00 2001 From: Tomer Lahav Date: Wed, 3 May 2017 11:38:01 -0400 Subject: [PATCH 2/2] Safer fix (do not call ctx.resume() on older environments that do not support it). --- src/howler.core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/howler.core.js b/src/howler.core.js index 76e5271e..f69dd756 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -316,7 +316,9 @@ } // Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55. - self.ctx.resume(); + if (typeof self.ctx.resume === 'function') { + self.ctx.resume(); + } // Setup a timeout to check that we are unlocked on the next event loop. source.onended = function() {