How can my code know when jPlayer Playlist moves to the next audio file?

177 views Asked by At
  • I am displaying the audio name for each audio file played in jPlayer playlist (http://jplayer.org/latest/demo-02-jPlayerPlaylist)
  • I've attached a jQuery function to the Previous and Next button, so e.g. when one clicks the next button, the name of the next audio file is displayed:

            jQuery('#'+elemId).find('.jp-next').click(function() {
                showCurrentFileName(elemId);
            });     
    
  • However, when one lets the audio play to the end, jPlayer Playlist loads and begins playing the next audio file, but of course the name of the previous file is still displayed.

Is there an "movedToNextSong" event I can attach to so that when the a new song is displayed, my code can notified and display the appropriate audio file title?

1

There are 1 answers

0
Palo On

No but there is play event.

$("#jquery_jplayer_1").jPlayer({
    play : function(){
        if($("#jquery_jplayer_1").data("jPlayer").status.currentTime === 0){//only run at start of the song
            //display next file
        }
    }
});