Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Play keystroke audio in quick succession
  • Loading branch information
hypatiah committed Dec 9, 2016
commit 56771adee2202015f0da1234f64d6bcf3ca8d4f8
3 changes: 3 additions & 0 deletions 01 - JavaScript Drum Kit/index-START.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
console.log(audio)
if(!audio) return; //stop function all together
// note if call .play on audio element already playing, it won't play again. so if press "F" in successsion it will only play every 5 sec
audio.currentTime = 0; //rewind to the start, so that it can be played many times quickly
audio.play();

});
</script>

Expand Down