From 50abff2f9d20cc6f6ae61ca6201e79c3409e66ba Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 24 Dec 2023 11:45:37 +0100 Subject: [PATCH] time on seek --- src/store/player.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/store/player.js b/src/store/player.js index 7d68af3..3a4cb89 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -77,26 +77,28 @@ export const player = { }, pause: (context) => { audio.pause() - axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{ - podcast: context.state.podcastUrl, - episode: context.state.episode.episodeUrl, - guid: context.state.episode.episodeGuid, - action: 'play', - timestamp: moment().format('YYYY-MM-DD[T]HH:mm:ss'), - started: Math.round(context.state.action ? context.state.action.started : 0), - position: Math.round(audio.currentTime), - total: Math.round(audio.duration), - }]) + context.dispatch('time') }, play: () => audio.play(), seek: (context, currentTime) => { audio.currentTime = currentTime + context.dispatch('time') }, stop: (context) => { context.dispatch('pause') context.commit('episode', null) context.commit('action', null) }, + time: async (context) => axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{ + podcast: context.state.podcastUrl, + episode: context.state.episode.episodeUrl, + guid: context.state.episode.episodeGuid, + action: 'play', + timestamp: moment().format('YYYY-MM-DD[T]HH:mm:ss'), + started: Math.round(context.state.action ? context.state.action.started : 0), + position: Math.round(audio.currentTime), + total: Math.round(audio.duration), + }]), volume: (context, volume) => { audio.volume = volume },