diff --git a/src/store/player.js b/src/store/player.js index 93113d5..eb19fd6 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -9,8 +9,8 @@ const audio = new Audio() audio.ondurationchange = () => store.commit('player/duration', audio.duration) audio.onended = () => store.dispatch('player/stop') audio.onloadeddata = () => store.commit('player/loaded', true) -audio.onplay = () => store.commit('player/paused', false) -audio.onpause = () => store.commit('player/paused', true) +audio.onplay = () => store.dispatch('player/play') +audio.onpause = () => store.dispatch('player/pause') audio.onratechange = () => store.commit('player/rate', audio.playbackRate) audio.onseeked = () => store.commit('player/currentTime', audio.currentTime) audio.ontimeupdate = () => store.commit('player/currentTime', audio.currentTime) @@ -89,10 +89,12 @@ export const player = { }, pause: (context) => { audio.pause() + context.commit('paused', true) context.dispatch('time') }, play: (context) => { audio.play() + context.commit('paused', false) context.commit('started', audio.currentTime) }, seek: (context, currentTime) => {