Skip to content

Commit

Permalink
Adding failsafe for browsers not supporting Web Audio API (hello IE)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunraz committed Sep 13, 2014
1 parent 6f93f89 commit acb2610
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}

0 comments on commit acb2610

Please sign in to comment.