Added small timeout before playback to avoid loading lots of tracks when skipping through the queue
This commit is contained in:
parent
bc87674b34
commit
58195cd4d1
|
@ -254,7 +254,8 @@ export default {
|
||||||
maxPreloaded: 3,
|
maxPreloaded: 3,
|
||||||
preloadDelay: 15,
|
preloadDelay: 15,
|
||||||
soundsCache: [],
|
soundsCache: [],
|
||||||
soundId: null
|
soundId: null,
|
||||||
|
playTimeout: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -577,6 +578,7 @@ export default {
|
||||||
this.soundId = this.currentSound.play()
|
this.soundId = this.currentSound.play()
|
||||||
this.$store.commit('player/errored', false)
|
this.$store.commit('player/errored', false)
|
||||||
this.$store.commit('player/playing', true)
|
this.$store.commit('player/playing', true)
|
||||||
|
this.$store.dispatch('player/updateProgress', 0)
|
||||||
this.observeProgress(true)
|
this.observeProgress(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -672,10 +674,18 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
currentTrack: {
|
currentTrack: {
|
||||||
async handler (newValue, oldValue) {
|
async handler (newValue, oldValue) {
|
||||||
await this.loadSound(newValue, oldValue)
|
clearTimeout(this.playTimeout)
|
||||||
if (!newValue || !newValue.album.cover) {
|
let self = this
|
||||||
this.ambiantColors = this.defaultAmbiantColors
|
if (this.currentSound) {
|
||||||
|
this.currentSound.pause()
|
||||||
}
|
}
|
||||||
|
this.$store.commit("player/isLoadingAudio", true)
|
||||||
|
this.playTimeout = setTimeout(async () => {
|
||||||
|
await self.loadSound(newValue, oldValue)
|
||||||
|
if (!newValue || !newValue.album.cover) {
|
||||||
|
self.ambiantColors = self.defaultAmbiantColors
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
},
|
},
|
||||||
immediate: false
|
immediate: false
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue