diff --git a/src/components/Player.vue b/src/components/Player.vue index de32f35..7239ff5 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -24,15 +24,15 @@
+ :class="{ buffering: getBuffering }">
+ :value="getVolume" + @input="setVolume($event.target.value)">
diff --git a/src/store/player.js b/src/store/player.js index f313eb4..f5d259a 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -33,6 +33,20 @@ export default ({ oldVolume: localStorage.getItem('radio.volume') || 0.5, title: '', }, + getters: { + getPlaying: state => { + return state.isPlaying + }, + getBuffering: state => { + return state.isBuffering + }, + getVolume: state => { + return state.volume + }, + getTitle: state => { + return state.title + }, + }, mutations: { setPlaying(state, playerState) { state.isPlaying = playerState @@ -46,16 +60,18 @@ export default ({ setVolume(state, volume) { state.volume = volume localStorage.setItem('radio.volume', volume) + player.setVolume(state.volume) }, toggleMute(state) { if (state.isMute) { - state.volume = state.player.oldVolume + state.volume = state.oldVolume state.isMute = false } else { - state.oldVolume = state.player.volume + state.oldVolume = state.volume state.volume = 0 state.isMute = true } + player.setVolume(state.volume) }, togglePlay(state) { if (state.isPlaying) {