fix: started state and decodeUrl

This commit is contained in:
Michel Roux 2024-01-16 23:13:07 +01:00
parent 9dc09c2185
commit f4fc4b52e3
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { decodeUrl } from '../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import moment from '@nextcloud/moment' import moment from '@nextcloud/moment'
import router from '../router.js' import router from '../router.js'
@ -25,8 +26,8 @@ export const player = {
paused: null, paused: null,
podcastUrl: null, podcastUrl: null,
volume: 1, volume: 1,
started: 0,
rate: 1, rate: 1,
started: 0,
}, },
mutations: { mutations: {
action: (state, action) => { action: (state, action) => {
@ -47,13 +48,14 @@ export const player = {
state.episode = episode state.episode = episode
if (episode) { if (episode) {
state.podcastUrl = atob(router.currentRoute.params.url) state.podcastUrl = decodeUrl(router.currentRoute.params.url)
audio.src = episode.url audio.src = episode.url
audio.load() audio.load()
audio.play() audio.play()
if (episode.action && episode.action.position && episode.action.position < episode.action.total) { if (episode.action && episode.action.position && episode.action.position < episode.action.total) {
audio.currentTime = episode.action.position audio.currentTime = episode.action.position
state.started = audio.currentTime
} }
} else { } else {
state.loaded = false state.loaded = false
@ -73,6 +75,9 @@ export const player = {
rate: (state, rate) => { rate: (state, rate) => {
state.rate = rate state.rate = rate
}, },
started: (state, started) => {
state.started = started
},
}, },
actions: { actions: {
load: async (context, episode) => { load: async (context, episode) => {

View File

@ -26,6 +26,7 @@ import Episodes from '../components/Feed/Episodes.vue'
import Loading from '../components/Atoms/Loading.vue' import Loading from '../components/Atoms/Loading.vue'
import { NcEmptyContent } from '@nextcloud/vue' import { NcEmptyContent } from '@nextcloud/vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { decodeUrl } from '../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
export default { export default {
@ -47,7 +48,7 @@ export default {
}, },
computed: { computed: {
url() { url() {
return atob(this.$route.params.url) return decodeUrl(this.$route.params.url)
}, },
}, },
async mounted() { async mounted() {