refactor(Player.js): 确保在播放时播放器处于enabled状态

This commit is contained in:
runnableAir 2023-08-19 06:38:00 +08:00
parent a5bf5c7dfd
commit 61d0b5953f
1 changed files with 3 additions and 3 deletions

View File

@ -823,6 +823,9 @@ export default class {
this._howler?.once('play', () => {
this._howler?.fade(0, this.volume, PLAY_PAUSE_FADE_DURATION);
// 播放时确保开启player.
// 避免因"忘记设置"导致在播放时播放器不显示的Bug
this._enabled = true;
this._setPlaying(true);
if (this._currentTrack.name) {
setTitle(this._currentTrack);
@ -879,7 +882,6 @@ export default class {
autoPlayTrackID = 'first'
) {
this._isPersonalFM = false;
if (!this._enabled) this._enabled = true;
this.list = trackIDs;
this.current = 0;
this._playlistSource = {
@ -936,13 +938,11 @@ export default class {
addTrackToPlayNext(trackID, playNow = false) {
this._playNextList.push(trackID);
if (playNow) {
if (!this._enabled) this._enabled = true;
this.playNextTrack();
}
}
playPersonalFM() {
this._isPersonalFM = true;
if (!this._enabled) this._enabled = true;
if (this.currentTrackID !== this._personalFMTrack.id) {
this._replaceCurrentTrack(this._personalFMTrack.id, true);
} else {