From 4cc0e53c700f3fd7098e943cc7a8a5dd345b5569 Mon Sep 17 00:00:00 2001
From: tranxuanthang <thang.dovah@gmail.com>
Date: Thu, 5 Oct 2023 01:29:06 +0700
Subject: [PATCH] More fix for linux & bump version

---
 src-tauri/tauri.conf.json |  2 +-
 src/composables/player.js | 32 ++++++++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 5940320..ebe0897 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -8,7 +8,7 @@
   },
   "package": {
     "productName": "LRCGET",
-    "version": "0.2.0"
+    "version": "0.2.1"
   },
   "tauri": {
     "allowlist": {
diff --git a/src/composables/player.js b/src/composables/player.js
index dc7788d..f8e2648 100644
--- a/src/composables/player.js
+++ b/src/composables/player.js
@@ -49,7 +49,12 @@ export function usePlayer() {
       howlerSound.value.seek(setProgress)
       
       status.value = 'playing'
-      window.requestAnimationFrame(updater)
+
+      if (platformName === 'linux') {
+        updater2()
+      } else {
+        window.requestAnimationFrame(updater)
+      }
     })
 
     howlerSound.value.on('pause', () => {
@@ -71,20 +76,39 @@ export function usePlayer() {
   }
 
   const updater = (timestamp) => {
-    if (!howlerSound.value || status.value !== 'playing') {
+    if (status.value !== 'playing') {
       return
     }
 
-    if (howlerSound.value.seek() > 0.0) {
-      progress.value = howlerSound.value.seek()
+    const currentProgress = howlerSound.value.seek()
+
+    if (currentProgress > 0.0) {
+      progress.value = currentProgress
     }
 
     window.requestAnimationFrame(updater)
   }
 
+  const updater2 = () => {
+    if (status.value !== 'playing') {
+      return
+    }
+
+    const currentProgress = howlerSound.value.seek()
+
+    if (currentProgress > 0.0) {
+      progress.value = currentProgress
+    }
+
+    setTimeout(() => {
+      updater2()
+    }, 70)
+  }
+
   const pause = () => {
     howlerSound.value.unload()
     Howler.unload()
+    status.value = 'paused'
   }
 
   const resume = () => {