Hi guys,
i was playing around with your audio player and I really like it so far. Good job!
Nevertheless I believe having stumbled over a little missing update on the mainControls, when pressing pause, which was easy to fix. Beware that this is only noticable when not the start song is playing.
My initialization of amplitude.js looks like this:
Amplitude.init({
songs: songsData,
soundcloud_client : LH.soundcloudClientID,
debug: true,
autoplay: false,
callbacks: {
before_play: "_lh_amplitude_before_play",
after_play: "_lh_amplitude_after_play",
before_stop: "_lh_amplitude_before_stop",
after_stop: "_lh_amplitude_after_stop",
before_next: "_lh_amplitude_before_next",
after_next: "_lh_amplitude_after_next",
before_prev: "_lh_amplitude_before_prev",
after_prev: "_lh_amplitude_after_prev",
before_album_change: "_lh_amplitude_before_album_change",
after_album_change: "_lh_amplitude_after_album_change",
after_init: "_lh_amplitude_after_init"
}
});
At the beginning within the privatePlayPauseClickHandle function the variable
var playing_song_index = this.getAttribute('amplitude-song-index');
is set. The problem is, that the amplitude-song-index of the mainControls is never updated to the current index of the song that is playing until now. That is the reason, why the audio player then is jumping back to the start song (in my case the first song amplitude-song-index ="0").
My Solution
I have fixed it for me by simply setting the current song index to the amplitude-song-index attribute by adding following line after here
mainControls[i].setAttribute('amplitude-song-index', config.active_index);
I have to admit that I did some further customizations, like:
- adding a loading feedback, until a song plays
- mixing audio URLs from soundcloud and my own server for Amplitude's songs JSON data
- combination with the responsive rangeslider.js for Amplitude's amplitude-song-time-visualization
If you don't experience this bug in your distribution, then pardon my fault, which was caused of my customizations. Feel free to close this issue in that case. If you need further infos let me know.
Cheers Dario