Skip to content

Instantly share code, notes, and snippets.

@jamesmundy
Created January 12, 2019 17:44
Show Gist options
  • Save jamesmundy/d43a5e3fbce5d11b197457c65e4a757d to your computer and use it in GitHub Desktop.
Save jamesmundy/d43a5e3fbce5d11b197457c65e4a757d to your computer and use it in GitHub Desktop.
Implementation of Howler.js player code
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