implement play/pause
This commit is contained in:
parent
9336aa180c
commit
0afb670d16
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user