feat: 🚸 add event bus to player for auto update list
All checks were successful
repod / xml (push) Successful in 12s
repod / php (push) Successful in 31s
repod / nodejs (push) Successful in 2m43s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-03-05 10:37:16 +01:00
parent 2c1b95c6bb
commit bdeb46a194

View File

@ -1,3 +1,4 @@
import { EventBus } from './bus.js'
import axios from '@nextcloud/axios'
import { decodeUrl } from '../utils/url.js'
import { formatEpisodeTimestamp } from '../utils/time.js'
@ -105,7 +106,9 @@ export const player = {
context.dispatch('pause')
context.commit('episode', null)
},
time: async (context) => axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{
time: async (context) => {
const episode = context.state.episode
episode.action = {
podcast: context.state.podcastUrl,
episode: context.state.episode.url,
guid: context.state.episode.guid,
@ -114,7 +117,10 @@ export const player = {
started: Math.round(context.state.started),
position: Math.round(audio.currentTime),
total: Math.round(audio.duration),
}]),
}
axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [episode.action])
EventBus.$emit('updateEpisodesList', episode)
},
volume: (_, volume) => {
audio.volume = volume
},