Patched the player next/previous and auto play logic

pull/49/head
Nikan Dalvand 2019-08-03 22:09:00 +04:30
parent e486ed751e
commit bf5f4f625d
1 changed files with 8 additions and 2 deletions

View File

@ -57,7 +57,8 @@ export default {
playingStatus: false, playingStatus: false,
isFavorited: false, isFavorited: false,
duration: '00:00', duration: '00:00',
isFullscreen: false isFullscreen: false,
updateCurrent: false
} }
}, },
computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']), computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']),
@ -65,7 +66,10 @@ export default {
this.drawVisualizer() this.drawVisualizer()
}, },
updated () { updated () {
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream) if (this.updateCurrent) {
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream)
this.updateCurrent = false
}
}, },
methods: { methods: {
drawVisualizer () { drawVisualizer () {
@ -196,6 +200,7 @@ export default {
map.style['height'] = '0%' map.style['height'] = '0%'
window.setTimeout(() => { window.setTimeout(() => {
this.playQueueItem(this.currentlyPlaying + 1) this.playQueueItem(this.currentlyPlaying + 1)
this.updateCurrent = true
}, 500) }, 500)
}, },
playPrevious () { playPrevious () {
@ -204,6 +209,7 @@ export default {
map.style['height'] = '0%' map.style['height'] = '0%'
window.setTimeout(() => { window.setTimeout(() => {
this.playQueueItem(this.currentlyPlaying - 1) this.playQueueItem(this.currentlyPlaying - 1)
this.updateCurrent = true
}, 500) }, 500)
}, },
play () { play () {