Created
February 23, 2012 02:39
-
-
Save dnoyes/1889375 to your computer and use it in GitHub Desktop.
html5 audio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var a = new Audio(); | |
var sources = [ | |
'topsecret1.wav', | |
'topsecret2.wav', | |
'topsecret3.wav']; | |
function playSound() { | |
var i = Math.floor(Math.random()*3); | |
a.pause(); | |
a.src = sources[i]; | |
a.startTime = 0; | |
a.play(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment