Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(player): 插队曲目切换后下一首曲目丢失 #2118

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/utils/Player.js
Original file line number Diff line number Diff line change
@@ -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;
}