diff --git a/src/renderer/layouts/PlayerBar.vue b/src/renderer/layouts/PlayerBar.vue index 48a2078..f2e15ca 100644 --- a/src/renderer/layouts/PlayerBar.vue +++ b/src/renderer/layouts/PlayerBar.vue @@ -98,8 +98,12 @@ export default { }) this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream) let readyCounter = 0 + let end = false this.wavesurfer.on('ready', () => { - console.log('ready') + if (end) { + end = false + return + } readyCounter += 1 this.duration = formatSeconds(this.getDuration()) let map = this.wavesurfer.minimap.drawer.container @@ -110,6 +114,15 @@ export default { this.playingStatus = this.isPlaying() } }) + this.wavesurfer.on('finish', () => { + if (this.currentlyPlaying >= 0 && (this.currentlyPlaying + 1) !== this.playerQueue.length) { + this.playNext() + } + if (this.currentlyPlaying >= 0 && (this.currentlyPlaying + 1) === this.playerQueue.length) { + this.playingStatus = false + end = true + } + }) let currentWidth = 0 let hoverStatus = false let hoverWidth = '0px'