From 2c92825a089531d682ab26e268c61621b59f9f32 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 7 May 2019 11:39:37 +0200 Subject: [PATCH] Removed errored sounds from cache --- front/src/components/audio/Player.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/front/src/components/audio/Player.vue b/front/src/components/audio/Player.vue index d3a3decae..0c451bdac 100644 --- a/front/src/components/audio/Player.vue +++ b/front/src/components/audio/Player.vue @@ -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