Page 1 of 1

Play icon adds song to current playlist and plays it.

PostPosted: Thu Jan 19, 2012 11:22 pm
by ytechie
Here is how to make the play icon next to each song add the song to the end of the playlist and play it.

We are going to edit playlist.jsp. This is the first part we are going to edit:

Code: Select all
function onPlay(path) {
   startPlayer = true;
   playlistService.play(path, playlistCallback);
}


Simply change "playlistService.play" to "playlistService.add".

This is the second part of the file we are going to edit:

Code: Select all
function triggerPlayer() {
   if (startPlayer) {
      startPlayer = false;
      if (songs.length > 0) {
         skip(0);
      }
   }
   updateCurrentImage();
   if (songs.length == 0) {
      player.sendEvent("LOAD", new Array());
      player.sendEvent("STOP");
   }
}


Change "skip(0);" to "skip(songs.length - 1);".

Hope this helps! :D

Re: Play icon adds song to current playlist and plays it.

PostPosted: Thu Jan 19, 2012 11:31 pm
by baxtr
Most excellent....I love this one......great for those parties when I've had a few and go to add music to the playlist and click the play button only to delete the list and play just that song... Thanks!!!!!!!!!

Re: Play icon adds song to current playlist and plays it.

PostPosted: Fri Oct 05, 2012 4:34 pm
by stratosrv
Hi..
This work in 4.7 too?
I can't find this code in playlist.jsp

thank you.

Re: Play icon adds song to current playlist and plays it.

PostPosted: Thu Sep 05, 2013 2:21 am
by baxtr
any chance this can be modified to add the song into the "next" spot of a playlist already in session? Say I have 1000 songs in the list, I am on number 50 and someone asks to hear something....adding it to the bottom of the list and playing it just ends the playlist.....this would insert it, then continue on with the list.


Now, this should likely be a different button seeing as you may want to add but not add it next ...if you understand what I mean.

Re: Play icon adds song to current playlist and plays it.

PostPosted: Fri Sep 06, 2013 3:49 am
by mjeppo
Unfortunately, the described sections of code do not exist in the Playlist.js file.
Maybe the tutorial is for older versions of ss?