Skip to content

Commit

Permalink
Unlock Audio For Android Chrome >= 55
Browse files Browse the repository at this point in the history
  • Loading branch information
paraselene committed Mar 28, 2017
1 parent 9aa4cac commit 668eb19
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ WebAudioOut.prototype.unlock = function(callback) {
source.connect(this.destination);
source.start(0);

if (source.context.state === 'suspended') {
source.context.resume();
}

setTimeout(this.checkIfUnlocked.bind(this, source, 0), 0);
};

Expand All @@ -130,7 +134,7 @@ WebAudioOut.prototype.checkIfUnlocked = function(source, attempt) {
};

WebAudioOut.NeedsUnlocking = function() {
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
};

WebAudioOut.IsSupported = function() {
Expand Down

0 comments on commit 668eb19

Please sign in to comment.