fix: set "onend" callback for howler properly (#1249)

Fix #1090
This commit is contained in:
Wenqi Huang 2022-01-22 07:39:26 -05:00 committed by GitHub
parent 75fed70c38
commit 4b22651a07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,6 +308,9 @@ export default class {
src: [source], src: [source],
html5: true, html5: true,
format: ['mp3', 'flac'], format: ['mp3', 'flac'],
onend: () => {
this._nextTrackCallback();
},
}); });
if (autoplay) { if (autoplay) {
this.play(); this.play();
@ -317,9 +320,6 @@ export default class {
setTrayLikeState(store.state.liked.songs.includes(this.currentTrack.id)); setTrayLikeState(store.state.liked.songs.includes(this.currentTrack.id));
} }
this.setOutputDevice(); this.setOutputDevice();
this._howler.once('end', () => {
this._nextTrackCallback();
});
} }
_getAudioSourceFromCache(id) { _getAudioSourceFromCache(id) {
return getTrackSource(id).then(t => { return getTrackSource(id).then(t => {