From 88d5e679e400bc2118dd54e07fd799a63fae583d Mon Sep 17 00:00:00 2001 From: runnableAir <1316214297@qq.com> Date: Thu, 17 Aug 2023 17:58:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(player):=20=E6=8F=92=E9=98=9F=E6=9B=B2?= =?UTF-8?q?=E7=9B=AE=E5=88=87=E6=8D=A2=E6=97=B6=E4=B8=8B=E4=B8=80=E9=A6=96?= =?UTF-8?q?=E6=9B=B2=E7=9B=AE=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/Player.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/utils/Player.js b/src/utils/Player.js index 55c8f6fc72..c4b6992f8c 100644 --- a/src/utils/Player.js +++ b/src/utils/Player.js @@ -14,6 +14,8 @@ import { decode as base642Buffer } from '@/utils/base64'; const PLAY_PAUSE_FADE_DURATION = 200; +const INDEX_IN_PLAY_NEXT = -1; + /** * @readonly * @enum {string} @@ -255,8 +257,8 @@ export default class { const next = this._reversed ? this.current - 1 : this.current + 1; if (this._playNextList.length > 0) { - let trackID = this._playNextList.shift(); - return [trackID, this.current]; + let trackID = this._playNextList[0]; + return [trackID, INDEX_IN_PLAY_NEXT]; } // 循环模式开启,则重新播放当前模式下的相对的下一首 @@ -704,7 +706,12 @@ export default class { this._setPlaying(false); return false; } - this.current = index; + let next = index; + if (index === INDEX_IN_PLAY_NEXT) { + this._playNextList.shift(); + next = this.current; + } + this.current = next; this._replaceCurrentTrack(trackID); return true; }