diff --git a/src/components/Main.vue b/src/components/Main.vue index e63a7a6..2c0ed43 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -65,6 +65,13 @@ export default { audioPlayer.volume(newVolume) } }, + 'player.isPaused'(newState, oldState) { + if (newState === true && audioPlayer !== null) { + audioPlayer.pause() + } else if (newState === false && audioPlayer !== null) { + audioPlayer.play() + } + }, }, mounted() { this.loadStations() diff --git a/src/store.js b/src/store.js index b48d1c9..d3cdf20 100644 --- a/src/store.js +++ b/src/store.js @@ -7,8 +7,9 @@ export default new Vuex.Store({ player: { isPlaying: false, isBuffering: false, - volume: 0, isMute: false, + isPaused: false, + volume: 0, oldVolume: 0, }, }, @@ -33,11 +34,12 @@ export default new Vuex.Store({ } }, togglePlay(state) { - console.log('toggle play') if (state.player.isPlaying) { state.player.isPlaying = false + state.player.isPaused = true } else { state.player.isPlaying = true + state.player.isPaused = false } }, },