-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
662168b
commit 696895b
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Abbey Load demo</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
<script src="abbey-load.js"></script> | ||
<script> | ||
/* | ||
Simple Abbey Load demo by @alvinsight | ||
*/ | ||
var context; | ||
var source; | ||
|
||
if (typeof AudioContext !== "undefined") { | ||
context = new AudioContext(); | ||
} else if (typeof webkitAudioContext !== "undefined") { | ||
context = new webkitAudioContext(); | ||
} else { | ||
throw new Error('Web Audio should be available in order to use Abbey Load'); | ||
} | ||
|
||
var loader = new AbbeyLoad([{'sound' : 'path/to/sound.mp3'}],filesLoaded); | ||
|
||
function filesLoaded(buffers){ | ||
|
||
source = context.createBufferSource(); | ||
|
||
source.buffer = buffers['sound']; | ||
|
||
source.connect(context.destination); | ||
|
||
source.start(0); | ||
|
||
} | ||
</script> | ||
</html> |