mirror of
https://github.com/sbrl/soundbox.git
synced 2018-01-10 21:33:43 +00:00
55 lines
No EOL
1.3 KiB
HTML
55 lines
No EOL
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>SoundBox.js Example</title>
|
|
</head>
|
|
<body>
|
|
<h1>SoundBox.js Example</h1>
|
|
<p>All sounds from <a href="http://www.bfxr.net/" target="_blank">Bfxr</a>.</p>
|
|
|
|
<button onclick="play_sound_1();">Play Sound 1</button>
|
|
<button onclick="play_sound_2();">Play Sound 2</button>
|
|
<button onclick="play_sound_3();">Play Sound 3</button>
|
|
|
|
<button onclick="play_multiple_sounds();">Play Multiple Sounds</button>
|
|
|
|
|
|
<!----------->
|
|
<style>
|
|
body { font-family: sans-serif; }
|
|
</style>
|
|
|
|
<script src="soundbox.min.js"></script>
|
|
<script>
|
|
window.addEventListener("load", function(event) {
|
|
window.soundbox = new SoundBox();
|
|
soundbox.load("beep1", "examplesounds/beep1.wav");
|
|
soundbox.load("beep2", "examplesounds/beep2.wav");
|
|
soundbox.load("beep3", "examplesounds/beep3.wav");
|
|
});
|
|
|
|
function play_sound_1()
|
|
{
|
|
soundbox.play("beep1");
|
|
}
|
|
function play_sound_2()
|
|
{
|
|
soundbox.play("beep2");
|
|
}
|
|
function play_sound_3()
|
|
{
|
|
soundbox.play("beep3");
|
|
}
|
|
|
|
function play_multiple_sounds()
|
|
{
|
|
soundbox.play("beep1", function() {
|
|
soundbox.play("beep2", function() {
|
|
soundbox.play("beep3");
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |