From 4b22651a073c3ee16c68f9158f43fe411770a2c2 Mon Sep 17 00:00:00 2001 From: Wenqi Huang <44907675+Ynng@users.noreply.github.com> Date: Sat, 22 Jan 2022 07:39:26 -0500 Subject: [PATCH] fix: set "onend" callback for howler properly (#1249) Fix #1090 --- src/utils/Player.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/Player.js b/src/utils/Player.js index 12a7e6d..0e48e76 100644 --- a/src/utils/Player.js +++ b/src/utils/Player.js @@ -308,6 +308,9 @@ export default class { src: [source], html5: true, format: ['mp3', 'flac'], + onend: () => { + this._nextTrackCallback(); + }, }); if (autoplay) { this.play(); @@ -317,9 +320,6 @@ export default class { setTrayLikeState(store.state.liked.songs.includes(this.currentTrack.id)); } this.setOutputDevice(); - this._howler.once('end', () => { - this._nextTrackCallback(); - }); } _getAudioSourceFromCache(id) { return getTrackSource(id).then(t => {