~vesto/grooveboat

5b20c656a624ac1714c17715943c15f26f640fff — Steve Gattuso 5 years ago 6bd52db
prevents a track from being played if prev stopped
1 files changed, 7 insertions(+), 2 deletions(-)

M src/js/services/jukebox.js
M src/js/services/jukebox.js => src/js/services/jukebox.js +7 -2
@@ 179,6 179,10 @@ function* syncTrack() {
}

function setOnDeck({track}) {
  if (!track) {
    return;
  }

  onDeckPlayer = new Howl({
    src: [track.get('url')],
    format: ['mp3'],


@@ 226,14 230,15 @@ function* playTrack({startedAt, track}) {
      }));
    });

    const {canceled} = yield race({
    const {canceled, stopped} = yield race({
      loaded: call(awaitLoad),
      canceled: take(ActionTypes.PLAY_TRACK),
      stopped: take(ActionTypes.STOP_TRACK),
    });

    yield cancel(timeoutTask);

    if (canceled) {
    if (canceled || stopped) {
      // Some other track started getting played before we had a chance to load
      // this one
      return;