1
0
flewkey.com/static/music/player.js

15 lines
431 B
JavaScript
Raw Normal View History

2020-07-12 22:35:49 -04:00
function getAudio(player) {
return player.getElementsByTagName("audio")[0];
}
window.onload = function() {
var players = document.getElementsByClassName("player");
for (var i = 0; i < players.length; i++) {
getAudio(players[i])["queue"] = i;
getAudio(players[i]).addEventListener('ended', function(event) {
const next = event.target["queue"] + 1;
if (next < players.length) getAudio(players[next]).play();
});
}
}