Browse Source

Check player status before sending mpris interval

master
jeffvli 3 years ago
parent
commit
2fb86935ec
  1. 4
      src/components/player/Player.tsx

4
src/components/player/Player.tsx

@ -321,14 +321,14 @@ const Player = ({ currentEntryList, muted, children }: any, ref: any) => {
// for mpris-service's getPosition() function // for mpris-service's getPosition() function
if (isLinux()) { if (isLinux()) {
const interval = setInterval(() => { const interval = setInterval(() => {
if (player.status === 'PLAYING') {
ipcRenderer.send( ipcRenderer.send(
'current-position', 'current-position',
playQueue.currentPlayer === 1 playQueue.currentPlayer === 1
? player1Ref.current.audioEl.current.currentTime ? player1Ref.current.audioEl.current.currentTime
: player2Ref.current.audioEl.current.currentTime : player2Ref.current.audioEl.current.currentTime
); );
} else {
if (player.status === 'PAUSED') {
clearInterval(interval); clearInterval(interval);
} }
}, 500); }, 500);

Loading…
Cancel
Save