Added playnext first revision logic,Update the pause button when queue ends

pull/48/head
Nikan Dalvand 2019-08-02 23:55:41 +04:30
parent e29ba8eb33
commit 0bcbc33119
1 changed files with 14 additions and 1 deletions

View File

@ -98,8 +98,12 @@ export default {
}) })
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream) this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream)
let readyCounter = 0 let readyCounter = 0
let end = false
this.wavesurfer.on('ready', () => { this.wavesurfer.on('ready', () => {
console.log('ready') if (end) {
end = false
return
}
readyCounter += 1 readyCounter += 1
this.duration = formatSeconds(this.getDuration()) this.duration = formatSeconds(this.getDuration())
let map = this.wavesurfer.minimap.drawer.container let map = this.wavesurfer.minimap.drawer.container
@ -110,6 +114,15 @@ export default {
this.playingStatus = this.isPlaying() 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 currentWidth = 0
let hoverStatus = false let hoverStatus = false
let hoverWidth = '0px' let hoverWidth = '0px'