-2

Maybe my question title maybe wrong and i can't try too big as title, but the thing is i am trying to add song in playlist from ajax request.

in jplayer i created playlist and set songs using setPlaylist function and this works fine. problem is when i click on album button it start playing song and i want it to pause.

This is my song function :

AddSongToPlaylist(songs) {    
    songs.filter((song) => {
         self.MySong.addSong(song);
         self.MySong.setUser(song.user_id);
         myplayer.setPlaylist(self.MySong.getSongList());
    });
}

And on button i did this : AddSongToPlaylist(song_object)

My song is object class that adds songs to songList and from there i pick songs using .getSongList

But i don't think there will be any issue but there could be solution where i can run AddSongToPlaylist(song_object) function one time only when no matched song added to list.

Please let me know if anyone tried this.

Earon
  • 733
  • 1
  • 12
  • 18

1 Answers1

0

This is impossible to answer properly without more detail. What function(s) does clicking on the album button call? What are the jPlaylist options that you specified?

The setPlaylist function for jPlaylist automatically plays the media if you have the autoplay option set to true on your playlist options.

If this isn't the case then provide more details.

Martin Dawson
  • 7,455
  • 6
  • 49
  • 92