Skip to content
Snippets Groups Projects
Commit e8e2cd45 authored by onny's avatar onny
Browse files

fix get initial volume state

parent f2561515
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ export class Player {
doPlay(src) {
if (audioPlayer !== null) {
audioPlayer.fade(store.state.player.volume, 0, 500)
audioPlayer.fade(store.getters.getVolume, 0, 500)
Howler.unload()
} else {
this.updateSeek()
......@@ -40,7 +40,7 @@ export class Player {
audioPlayer = new Howl({
src,
html5: true,
volume: store.state.player.volume,
volume: store.getters.getVolume,
onplay() {
const duration = audioPlayer.duration()
store.dispatch('setPlaying', true)
......@@ -60,7 +60,7 @@ export class Player {
})
audioPlayer.unload()
audioPlayer.play()
audioPlayer.fade(0, store.state.player.volume, 500)
audioPlayer.fade(0, store.getters.getVolume, 500)
}
......
......@@ -51,10 +51,10 @@ export default {
return state.duration
},
getVolume: state => {
if (isNaN(state.volume)) {
return 0.5
} else {
if (state.volume) {
return state.volume
} else {
return 0.5
}
},
isPlaying: state => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment