From 2c1b95c6bb16d8e3305f73cb1e4c087041afceba Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 5 Mar 2024 10:31:08 +0100 Subject: [PATCH] fix(player): :children_crossing: record action when using keyboard media keys --- src/store/player.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/store/player.js b/src/store/player.js index 93113d5..eb19fd6 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -9,8 +9,8 @@ const audio = new Audio() audio.ondurationchange = () => store.commit('player/duration', audio.duration) audio.onended = () => store.dispatch('player/stop') audio.onloadeddata = () => store.commit('player/loaded', true) -audio.onplay = () => store.commit('player/paused', false) -audio.onpause = () => store.commit('player/paused', true) +audio.onplay = () => store.dispatch('player/play') +audio.onpause = () => store.dispatch('player/pause') audio.onratechange = () => store.commit('player/rate', audio.playbackRate) audio.onseeked = () => store.commit('player/currentTime', audio.currentTime) audio.ontimeupdate = () => store.commit('player/currentTime', audio.currentTime) @@ -89,10 +89,12 @@ export const player = { }, pause: (context) => { audio.pause() + context.commit('paused', true) context.dispatch('time') }, play: (context) => { audio.play() + context.commit('paused', false) context.commit('started', audio.currentTime) }, seek: (context, currentTime) => {