diff --git a/src/store/player.js b/src/store/player.js index f14bab1..bebe25f 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -25,6 +25,7 @@ export const player = { paused: null, podcastUrl: null, volume: 1, + started: 0, rate: 1, }, mutations: { @@ -33,6 +34,7 @@ export const player = { if (action && action.position && action.position < action.total) { audio.currentTime = action.position + state.started = audio.currentTime } }, currentTime: (state, currentTime) => { @@ -84,7 +86,10 @@ export const player = { audio.pause() context.dispatch('time') }, - play: () => audio.play(), + play: (context) => { + audio.play() + context.commit('started', audio.currentTime) + }, seek: (context, currentTime) => { audio.currentTime = currentTime context.dispatch('time') @@ -99,7 +104,7 @@ export const player = { guid: context.state.episode.guid, action: 'play', timestamp: moment().format('YYYY-MM-DD[T]HH:mm:ss'), - started: Math.round(context.state.action ? context.state.action.started : 0), + started: Math.round(context.state.started), position: Math.round(audio.currentTime), total: Math.round(audio.duration), }]),