From acb2610efd61f9f0713e6b53a651398551967b6e Mon Sep 17 00:00:00 2001 From: Thunraz Date: Sat, 13 Sep 2014 03:44:01 +0200 Subject: [PATCH] Adding failsafe for browsers not supporting Web Audio API (hello IE) --- lib/main.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 1c18734..c35394d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -112,8 +112,10 @@ function loadSounds() { } function playSound(buffer) { - var source = audioContext.createBufferSource(); - source.buffer = buffer; - source.connect(audioContext.destination); - source.start(0); + try { + var source = audioContext.createBufferSource(); + source.buffer = buffer; + source.connect(audioContext.destination); + source.start(0); + } catch(e) {} } \ No newline at end of file