feat: 🚸 add event bus to player for auto update list
This commit is contained in:
parent
2c1b95c6bb
commit
bdeb46a194
@ -1,3 +1,4 @@
|
|||||||
|
import { EventBus } from './bus.js'
|
||||||
import axios from '@nextcloud/axios'
|
import axios from '@nextcloud/axios'
|
||||||
import { decodeUrl } from '../utils/url.js'
|
import { decodeUrl } from '../utils/url.js'
|
||||||
import { formatEpisodeTimestamp } from '../utils/time.js'
|
import { formatEpisodeTimestamp } from '../utils/time.js'
|
||||||
@ -105,16 +106,21 @@ export const player = {
|
|||||||
context.dispatch('pause')
|
context.dispatch('pause')
|
||||||
context.commit('episode', null)
|
context.commit('episode', null)
|
||||||
},
|
},
|
||||||
time: async (context) => axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{
|
time: async (context) => {
|
||||||
podcast: context.state.podcastUrl,
|
const episode = context.state.episode
|
||||||
episode: context.state.episode.url,
|
episode.action = {
|
||||||
guid: context.state.episode.guid,
|
podcast: context.state.podcastUrl,
|
||||||
action: 'play',
|
episode: context.state.episode.url,
|
||||||
timestamp: formatEpisodeTimestamp(new Date()),
|
guid: context.state.episode.guid,
|
||||||
started: Math.round(context.state.started),
|
action: 'play',
|
||||||
position: Math.round(audio.currentTime),
|
timestamp: formatEpisodeTimestamp(new Date()),
|
||||||
total: Math.round(audio.duration),
|
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) => {
|
volume: (_, volume) => {
|
||||||
audio.volume = volume
|
audio.volume = volume
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user