feat: ✨ Playback speed and volume setting doesn't stick (fix #185)
This commit is contained in:
parent
f0a2d199f9
commit
e439730a4d
@ -1,4 +1,5 @@
|
||||
import type { EpisodeActionInterface, EpisodeInterface } from '../utils/types.ts'
|
||||
import { getCookie, setCookie } from '../utils/cookies.ts'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { defineStore } from 'pinia'
|
||||
import { formatEpisodeTimestamp } from '../utils/time.ts'
|
||||
@ -23,6 +24,9 @@ export const usePlayer = defineStore('player', {
|
||||
}),
|
||||
actions: {
|
||||
init() {
|
||||
audio.playbackRate = parseFloat(getCookie('repod.rate') || '1')
|
||||
audio.volume = parseFloat(getCookie('repod.volume') || '1')
|
||||
|
||||
audio.ondurationchange = () => (this.duration = audio.duration)
|
||||
audio.onended = () => this.stop()
|
||||
audio.onloadeddata = () => (this.loaded = true)
|
||||
@ -123,9 +127,11 @@ export const usePlayer = defineStore('player', {
|
||||
},
|
||||
setVolume(volume: number) {
|
||||
audio.volume = volume
|
||||
setCookie('repod.volume', volume.toString(), 365)
|
||||
},
|
||||
setRate(rate: number) {
|
||||
audio.playbackRate = rate
|
||||
setCookie('repod.rate', rate.toString(), 365)
|
||||
},
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user