Setting the Starting Audio and Starting Playlist

When you initialize AmplitudeJS you can instruct AmplitudeJS to start at a certain song, certain playlist, and a certain song in a playlist.

Set Starting Song

To set a starting song, you simply need to add the start_song key and pass it the index of the song you want to start. By default this is 0, the first song in the array. To set it to the fourth song in the array, index 3, do this:

  Amplitude.init({
    songs: ["..."],
    start_song: 3
  });

Set Starting Playlist

You can also define which playlist to start with if you have multiple playlists. Similar to the start_song you need to pass the starting_playlist key to the init method:

  Amplitude.init({
    songs: ["..."],
    playlists: {
      "key_of_starting_playlist": ["..."]
    }
    starting_playlist: "key_of_starting_playlist"
  });

Set Starting Song In Playlist

Finally, you can set which song you want to start the player with inside which playlist. To do this, you need to define the starting_playlist key and the starting_playlist_song index like this:

  Amplitude.init({
    songs: ["..."],
    playlists: {
      "key_of_starting_playlist": ["..."]
    }
    starting_playlist: "key_of_starting_playlist",
    starting_playlist_song: 3
  });