Skip to content

Commit 2c0e1cd

Browse files
committed
fix audio issue
1 parent c381e16 commit 2c0e1cd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.js

+8
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,15 @@ function onKeyUp(e) {
584584
}
585585
}
586586

587+
function unlockAudio() {
588+
var context = _game.sound.context;
589+
if (context && context.state === 'suspended')
590+
context.resume();
591+
}
592+
587593
function initControls() {
594+
_game.input.onUp.add(unlockAudio);
595+
588596
_game.input.onDown.add(flap);
589597
_game.input.keyboard.addCallbacks(_game, onKeyDown, onKeyUp);
590598
}

0 commit comments

Comments
 (0)