From a2c42996a1d54390a8fce618f498d9ce45e9adb0 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Sat, 17 Feb 2018 17:30:21 +0100
Subject: [PATCH] Removed autoplay on page reload

---
 CHANGELOG                            |  1 +
 front/src/components/audio/Track.vue |  8 +++++---
 front/src/store/index.js             | 16 ----------------
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index dd44b9ef..97362e82 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ Changelog
 
 - Front: added some unittests for the store (#55)
 - Front: fixed broken login redirection when 401
+- Front: Removed autoplay on page reload
 
 
 0.3.5 (2018-01-07)
diff --git a/front/src/components/audio/Track.vue b/front/src/components/audio/Track.vue
index c8627925..a513c468 100644
--- a/front/src/components/audio/Track.vue
+++ b/front/src/components/audio/Track.vue
@@ -59,13 +59,15 @@ export default {
 
     },
     loaded: function () {
-      if (this.isCurrent && this.autoplay) {
+      if (this.isCurrent) {
         this.$store.commit('player/duration', this.$refs.audio.duration)
         if (this.startTime) {
           this.setCurrentTime(this.startTime)
         }
-        this.$store.commit('player/playing', true)
-        this.$refs.audio.play()
+        if (this.autoplay) {
+          this.$store.commit('player/playing', true)
+          this.$refs.audio.play()
+        }
       }
     },
     updateProgress: function () {
diff --git a/front/src/store/index.js b/front/src/store/index.js
index 507f0b58..a5df7c24 100644
--- a/front/src/store/index.js
+++ b/front/src/store/index.js
@@ -37,7 +37,6 @@ export default new Vuex.Store({
       key: 'player',
       paths: [
         'player.looping',
-        'player.playing',
         'player.volume',
         'player.duration',
         'player.errored'],
@@ -45,21 +44,6 @@ export default new Vuex.Store({
         return mutation.type.startsWith('player/') && mutation.type !== 'player/currentTime'
       }
     }),
-    createPersistedState({
-      key: 'progress',
-      paths: ['player.currentTime'],
-      filter: (mutation) => {
-        let delay = 10
-        return mutation.type === 'player/currentTime' && parseInt(mutation.payload) % delay === 0
-      },
-      reducer: (state) => {
-        return {
-          player: {
-            currentTime: state.player.currentTime
-          }
-        }
-      }
-    }),
     createPersistedState({
       key: 'queue',
       filter: (mutation) => {
-- 
GitLab