Created
October 15, 2014 20:32
-
-
Save adamrabung/f2d957ba2a24a0b43eef to your computer and use it in GitHub Desktop.
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
<html> | |
<body> | |
<a href="#" onclick="play()">Play</a> | |
</body> | |
</html> | |
<script type="text/javascript" src="https://www.dropbox.com/s/e0sejqv37b1g867/soundmanager2-jsmin.js?dl=1"></script> | |
<script type="text/javascript"> | |
var sound; | |
var url = "https://www.dropbox.com/s/lu9wx75la7tkrsf/duck.mp3?dl=1"; | |
function play() { | |
if (!sound) { | |
// first time: create | |
sound = soundManager.createSound({ | |
id: 'foo', | |
url: url | |
}); | |
sound.play(); | |
} else { | |
// subsequent cases: re-use | |
sound.play({ | |
url: url | |
}); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment