Created
January 12, 2019 17:44
-
-
Save jamesmundy/d43a5e3fbce5d11b197457c65e4a757d to your computer and use it in GitHub Desktop.
Implementation of Howler.js player code
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
function playTrack(trackNumber, listen) { | |
if (track) { | |
track.pause(); | |
} | |
if (typeof listen === 'undefined') { | |
listen = false; | |
} | |
var src = base + trackNumber + ".m4a"; | |
track = new Howl({ | |
src: src, | |
autoplay: false, | |
loop: false, | |
volume: 1 | |
}); | |
console.log("playing " + src); | |
track.play(); | |
track.on("end", | |
function() { | |
track.off("end"); | |
if (listen) { | |
beginListening(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment