Skip to content

Commit 668eb19

Browse files
committed
Unlock Audio For Android Chrome >= 55
1 parent 9aa4cac commit 668eb19

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/webaudio.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ WebAudioOut.prototype.unlock = function(callback) {
109109
source.connect(this.destination);
110110
source.start(0);
111111

112+
if (source.context.state === 'suspended') {
113+
source.context.resume();
114+
}
115+
112116
setTimeout(this.checkIfUnlocked.bind(this, source, 0), 0);
113117
};
114118

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

132136
WebAudioOut.NeedsUnlocking = function() {
133-
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
137+
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
134138
};
135139

136140
WebAudioOut.IsSupported = function() {

0 commit comments

Comments
 (0)