implement play/pause
This commit is contained in:
parent
9336aa180c
commit
0afb670d16
@ -65,6 +65,13 @@ export default {
|
|||||||
audioPlayer.volume(newVolume)
|
audioPlayer.volume(newVolume)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'player.isPaused'(newState, oldState) {
|
||||||
|
if (newState === true && audioPlayer !== null) {
|
||||||
|
audioPlayer.pause()
|
||||||
|
} else if (newState === false && audioPlayer !== null) {
|
||||||
|
audioPlayer.play()
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadStations()
|
this.loadStations()
|
||||||
|
@ -7,8 +7,9 @@ export default new Vuex.Store({
|
|||||||
player: {
|
player: {
|
||||||
isPlaying: false,
|
isPlaying: false,
|
||||||
isBuffering: false,
|
isBuffering: false,
|
||||||
volume: 0,
|
|
||||||
isMute: false,
|
isMute: false,
|
||||||
|
isPaused: false,
|
||||||
|
volume: 0,
|
||||||
oldVolume: 0,
|
oldVolume: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -33,11 +34,12 @@ export default new Vuex.Store({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
togglePlay(state) {
|
togglePlay(state) {
|
||||||
console.log('toggle play')
|
|
||||||
if (state.player.isPlaying) {
|
if (state.player.isPlaying) {
|
||||||
state.player.isPlaying = false
|
state.player.isPlaying = false
|
||||||
|
state.player.isPaused = true
|
||||||
} else {
|
} else {
|
||||||
state.player.isPlaying = true
|
state.player.isPlaying = true
|
||||||
|
state.player.isPaused = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user