fix(player): 🚸 record action when using keyboard media keys
This commit is contained in:
parent
ce0e6e06bc
commit
2c1b95c6bb
@ -9,8 +9,8 @@ const audio = new Audio()
|
|||||||
audio.ondurationchange = () => store.commit('player/duration', audio.duration)
|
audio.ondurationchange = () => store.commit('player/duration', audio.duration)
|
||||||
audio.onended = () => store.dispatch('player/stop')
|
audio.onended = () => store.dispatch('player/stop')
|
||||||
audio.onloadeddata = () => store.commit('player/loaded', true)
|
audio.onloadeddata = () => store.commit('player/loaded', true)
|
||||||
audio.onplay = () => store.commit('player/paused', false)
|
audio.onplay = () => store.dispatch('player/play')
|
||||||
audio.onpause = () => store.commit('player/paused', true)
|
audio.onpause = () => store.dispatch('player/pause')
|
||||||
audio.onratechange = () => store.commit('player/rate', audio.playbackRate)
|
audio.onratechange = () => store.commit('player/rate', audio.playbackRate)
|
||||||
audio.onseeked = () => store.commit('player/currentTime', audio.currentTime)
|
audio.onseeked = () => store.commit('player/currentTime', audio.currentTime)
|
||||||
audio.ontimeupdate = () => store.commit('player/currentTime', audio.currentTime)
|
audio.ontimeupdate = () => store.commit('player/currentTime', audio.currentTime)
|
||||||
@ -89,10 +89,12 @@ export const player = {
|
|||||||
},
|
},
|
||||||
pause: (context) => {
|
pause: (context) => {
|
||||||
audio.pause()
|
audio.pause()
|
||||||
|
context.commit('paused', true)
|
||||||
context.dispatch('time')
|
context.dispatch('time')
|
||||||
},
|
},
|
||||||
play: (context) => {
|
play: (context) => {
|
||||||
audio.play()
|
audio.play()
|
||||||
|
context.commit('paused', false)
|
||||||
context.commit('started', audio.currentTime)
|
context.commit('started', audio.currentTime)
|
||||||
},
|
},
|
||||||
seek: (context, currentTime) => {
|
seek: (context, currentTime) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user