Pause music on window blur
@@ -13,10 +13,13 @@ function initMusic() {
modPlayer = new ScripTracker();
modPlayer.on(ScripTracker.Events.playerReady, onSongLoaded);
window.removeEventListener("click", initMusic);
+ window.removeEventListener("keydown", initMusic);
}
// Initialise audio on first click
window.addEventListener("click", initMusic);
+window.addEventListener("keydown", initMusic);
+window.addEventListener("blur", pause);
function onSongLoaded(player) {
console.log("ONLOADED");
