Skip to content
Snippets Groups Projects
Verified Commit 2c92825a authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Removed errored sounds from cache

parent 3b06cd25
Branches
Tags
No related merge requests found
......@@ -391,6 +391,7 @@ export default {
self.$store.commit('player/duration', this.duration())
},
onloaderror: function (sound, error) {
self.removeFromCache(this)
if (this != self.currentSound) {
return
}
......@@ -544,6 +545,17 @@ export default {
})
this.soundsCache = _.reverse(toKeep)
},
removeFromCache (sound) {
let toKeep = []
this.soundsCache.forEach((e) => {
if (e.sound === sound) {
e.sound.unload()
} else {
toKeep.push(e)
}
})
this.soundsCache = toKeep
},
async loadSound (newValue, oldValue) {
let trackData = newValue
let oldSound = this.currentSound
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment