amplitudejs icon indicating copy to clipboard operation
amplitudejs copied to clipboard

Repeat doesn't work when playlists were initialized

Open kaszarobert opened this issue 4 years ago • 0 comments

Issue description

If the song list was initialized with the "playlists" key in Amplitude.init(), then after clicking to an element with "amplitude-repeat" class, the player does not repeat the playlist. I wrote the steps to reproduce below.

It works when it was initialized with "songs" only (with no multiple playlist) as seen here: https://521dimensions.com/open-source/amplitudejs/docs/examples/blue-playlist.html

Also, repeating a single song (using "amplitude-repeat-song") on a playlist working with no problems, too.

Environment

  • What's My Browser Support link: Chrome 93
  • Amplitude.js Version: 5.3.2

Steps to reproduce the issue

  1. Go to https://521dimensions.com/open-source/amplitudejs/docs/examples/multiple-playlists.html
  2. Click to the repeat button on Playlist 1
  3. Go back to the previous (last track) called "Offcut # 6"
  4. Jump to the last few seconds

What is expected?

Expected: After finishing "Offcut # 6", the first song in the playlist (Risin' High) should start.

Actual: After finishing "Offcut # 6", the playback stops after it jumps to the first song.

Link to where issue can be reproduced

https://521dimensions.com/open-source/amplitudejs/docs/examples/multiple-playlists.html

Additional details / screenshots

In src/utilities/audioNavigation.js the setNextPlaylist(playlist) function, the code that decides if it should start the playback checks on the global object.

    if (endOfList && !config.repeat) {
    } else {
      if (!(songEnded && !config.repeat && endOfList)) {
        Core.play();
      }
    }

Shouldn't this check on the current playlist instead? Like that:

    if (endOfList && !config.playlists[playlist].repeat) {
    } else {
      if (!(songEnded && !config.playlists[playlist].repeat && endOfList)) {
        Core.play();
      }
    }

kaszarobert avatar Sep 09 '21 18:09 kaszarobert