2 thoughts on “Learn to Build an Audio Player Using HTML5

  1. how can i implement a play all button using this ?
    var currentSong = 0;
    $(‘#playall’).click(function () {
    audio.play();
    showDuration()
    currentSong = $(‘#playlist li’).index()
    });

    audio.addEventListener(‘ended’, function () {
    currentSong++;
    if (currentSong == $(‘#playlist li’).length) {
    currentSong = 0;
    }
    var nextsong = $($(“#playlist li”)[currentSong])
    initAudio(nextsong)
    audio.play();

    showDuration()
    })

    I tried to do this but it only play the next song, after that, it doesn’t play the third

Leave a Reply

Your email address will not be published. Required fields are marked *