time on seek
All checks were successful
repod / xml (push) Successful in 24s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Successful in 1m51s

This commit is contained in:
Michel Roux 2023-12-24 11:45:37 +01:00
parent 6cd97896c7
commit 50abff2f9d

View File

@ -77,26 +77,28 @@ export const player = {
}, },
pause: (context) => { pause: (context) => {
audio.pause() audio.pause()
axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{ context.dispatch('time')
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),
}])
}, },
play: () => audio.play(), play: () => audio.play(),
seek: (context, currentTime) => { seek: (context, currentTime) => {
audio.currentTime = currentTime audio.currentTime = currentTime
context.dispatch('time')
}, },
stop: (context) => { stop: (context) => {
context.dispatch('pause') context.dispatch('pause')
context.commit('episode', null) context.commit('episode', null)
context.commit('action', 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) => { volume: (context, volume) => {
audio.volume = volume audio.volume = volume
}, },