From e65606fd9de1cba18840dd08a37355d370617582 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 28 Feb 2018 18:11:13 +0100 Subject: [PATCH 1/2] Throttle track progress for better performance --- front/src/components/audio/Track.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/components/audio/Track.vue b/front/src/components/audio/Track.vue index ff177e624..e291dae78 100644 --- a/front/src/components/audio/Track.vue +++ b/front/src/components/audio/Track.vue @@ -19,7 +19,7 @@ import {mapState} from 'vuex' import url from '@/utils/url' import formats from '@/audio/formats' - +import _ from 'lodash' // import logger from '@/logging' export default { @@ -98,11 +98,11 @@ export default { } } }, - updateProgress: function () { + updateProgress: _.throttle(function () { if (this.$refs.audio) { this.$store.dispatch('player/updateProgress', this.$refs.audio.currentTime) } - }, + }, 1000), ended: function () { if (this.looping === 1) { this.setCurrentTime(0) From f40eefcd6a944059fed4095a73d286bd81119068 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 28 Feb 2018 18:16:25 +0100 Subject: [PATCH 2/2] Fix #98: Now stop running radio when clearing queue --- changes/changelog.d/91.bugfix | 1 + changes/changelog.d/98.feature | 0 front/src/store/queue.js | 2 +- front/test/unit/specs/store/queue.spec.js | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changes/changelog.d/98.feature diff --git a/changes/changelog.d/91.bugfix b/changes/changelog.d/91.bugfix index e69de29bb..4fde544cf 100644 --- a/changes/changelog.d/91.bugfix +++ b/changes/changelog.d/91.bugfix @@ -0,0 +1 @@ +Fixed queue skipping tracks (#91) diff --git a/changes/changelog.d/98.feature b/changes/changelog.d/98.feature new file mode 100644 index 000000000..e69de29bb diff --git a/front/src/store/queue.js b/front/src/store/queue.js index 1725699d0..07263da63 100644 --- a/front/src/store/queue.js +++ b/front/src/store/queue.js @@ -133,8 +133,8 @@ export default { } }, clean ({dispatch, commit}) { + dispatch('radios/stop', null, {root: true}) dispatch('player/stop', null, {root: true}) - // radios.stop() commit('tracks', []) dispatch('currentIndex', -1) // so we replay automatically on next track append diff --git a/front/test/unit/specs/store/queue.spec.js b/front/test/unit/specs/store/queue.spec.js index 3b970647f..5439362dc 100644 --- a/front/test/unit/specs/store/queue.spec.js +++ b/front/test/unit/specs/store/queue.spec.js @@ -308,6 +308,7 @@ describe('store/queue', () => { { type: 'ended', payload: true } ], expectedActions: [ + { type: 'radios/stop', payload: null, options: {root: true} }, { type: 'player/stop', payload: null, options: {root: true} }, { type: 'currentIndex', payload: -1 } ]