initial commit
This commit is contained in:
commit
e279281330
52 changed files with 916 additions and 0 deletions
25
static/js/app.js
Normal file
25
static/js/app.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const min_playtime = 1000
|
||||
const fade_threshold = 2000
|
||||
|
||||
function preload_audio (file) {
|
||||
return new Howl({
|
||||
src: [file]
|
||||
})
|
||||
}
|
||||
|
||||
function play_audio (sound, timeout, callback) {
|
||||
sound.play()
|
||||
|
||||
if (timeout) {
|
||||
if (timeout - fade_threshold > min_playtime) {
|
||||
setTimeout(function () {
|
||||
sound.fade(sound.volume(), 0, fade_threshold)
|
||||
}, timeout - fade_threshold)
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
sound.stop()
|
||||
callback()
|
||||
}, timeout)
|
||||
}
|
||||
}
|
2
static/js/howler.min.js
vendored
Normal file
2
static/js/howler.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue