From fa66dd90f49ce31c3b47e95f34cf2d5886cb6fe8 Mon Sep 17 00:00:00 2001 From: Eric Robinson Date: Tue, 12 Dec 2017 13:37:31 -0500 Subject: [PATCH] Ensure that automatic playlist advance works When playlists advance, the music should continue to play. The recent change to stop `setMusic` from "autoplaying" in this case must now be handled directly by the caller. This is far more clear to read: "set next music and play it." --- src/APlayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/APlayer.js b/src/APlayer.js index c39d103..35348f8 100644 --- a/src/APlayer.js +++ b/src/APlayer.js @@ -573,13 +573,16 @@ class APlayer { if (this.audio.currentTime !== 0) { if (this.mode === 'random') { this.setMusic(this.nextRandomNum()); + this.play(); } else if (this.mode === 'single') { this.setMusic(this.playIndex); + this.play(); } else if (this.mode === 'order') { if (this.playIndex < this.option.music.length - 1) { this.setMusic(++this.playIndex); + this.play(); } else { this.ended = true; @@ -590,6 +593,7 @@ class APlayer { else if (this.mode === 'circulation') { this.playIndex = (this.playIndex + 1) % this.option.music.length; this.setMusic(this.playIndex); + this.play(); } } }