-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
31 lines (25 loc) · 942 Bytes
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<script src="../dist/web_audio_player.min.js"></script>
<script>
var player = new WebAudioPlayer();
var currentTrack;
// Equalizer wave similar to the WinAmp's 'Rock' preset.
var eqPreset = [4.76, 3.617, 0, -3.375, -3, 0, 4.76, 5.9, 5.9, 5.52];
// Audio by Jack Strait.
// http://www.flashkit.com/loops/Easy_Listening/Easy_Listening/after-the-rain-150527192016.html
var files = ['https://dl.dropboxusercontent.com/s/gmu0htaucqrn95t/after_the_rain.mp3?dl=1'];
player.setEq(eqPreset);
currentTrack = player.createTrack(files);
currentTrack.load()
.then(function (track) {
track.play();
})
.catch(function (error) {
console.log(error);
});
currentTrack.addEventListener('finished', function () {
console.log('finished on:', this.getDuration(), 's');
});
currentTrack.when(5.5, function () {
console.log('played 5.5s (to be exact:', this.getPlayedTime(), 's)');
});
</script>