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,7 +106,9 @@ 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) => {
|
||||||
|
const episode = context.state.episode
|
||||||
|
episode.action = {
|
||||||
podcast: context.state.podcastUrl,
|
podcast: context.state.podcastUrl,
|
||||||
episode: context.state.episode.url,
|
episode: context.state.episode.url,
|
||||||
guid: context.state.episode.guid,
|
guid: context.state.episode.guid,
|
||||||
@ -114,7 +117,10 @@ export const player = {
|
|||||||
started: Math.round(context.state.started),
|
started: Math.round(context.state.started),
|
||||||
position: Math.round(audio.currentTime),
|
position: Math.round(audio.currentTime),
|
||||||
total: Math.round(audio.duration),
|
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