Browse Source

Merge branch 'feature-pc-choose' into gyt-dev

TIANYONG 9 months ago
parent
commit
1bdd75869a
3 changed files with 18 additions and 1 deletions
  1. 7 0
      index.html
  2. 8 0
      src/pages/detail/runtime.ts
  3. 3 1
      src/subpages/colexiu/buttons/evaluating.tsx

+ 7 - 0
index.html

@@ -39,6 +39,13 @@
       },
     })
   </script>
+  
+  <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
+  <script>
+    // VConsole will be exported to `window.VConsole` by default.
+    var vConsole = new window.VConsole();
+  </script>
+
   <style>
     #lottieWeb {
       position: fixed;

+ 8 - 0
src/pages/detail/runtime.ts

@@ -653,6 +653,8 @@ let nowTime = 0
 
 let prevTime: number = 0
 
+let preAppAudioPlayTime = 0; // 上一次app返回的播放进度
+
 // 播放中一直触发
 const accelerateRefreshPlayer = () => {
   if (timer || !state.audiosInstance) {
@@ -1044,6 +1046,12 @@ export const setAudioInit = () => {
   // 监听评测曲谱音频播放进度,返回
   listenerMessage("playProgress", (res) => {
     const time = res?.content.currentTime / 1000
+    const diffTime = res?.content?.currentTime - preAppAudioPlayTime;
+    preAppAudioPlayTime = res?.content?.currentTime
+    // console.log('app返回的mp3进度',time)
+    if (diffTime < 0) {
+      console.log('进度返回异常','本次时间比上次慢',diffTime)
+    }
     requestAnimationFrame(async () => {
       if (state.playState === 'play') {
         state.currentTimeNum = time

+ 3 - 1
src/subpages/colexiu/buttons/evaluating.tsx

@@ -323,6 +323,7 @@ let starTime = 0
 const formatTimes = () => {
   // const rate = runtime.speed / detailState.baseSpeed //1
   const rate = runtime.basePlayRate; // 播放倍率
+  // console.log('评测倍率123',rate)
   actualBeatLength = Math.round(detailState.times[0].fixtime * 1000 / rate)
   const difftime = detailState.times?.[0]?.difftime || 0
   let ListenMode = false
@@ -380,7 +381,8 @@ const formatTimes = () => {
   for (let index = 0; index < times.length; index++) {
     const item = times[index]
     const note = getNoteByMeasuresSlursStart(item)
-    const rate = runtime.speed / detailState.baseSpeed //1
+    // const rate = runtime.speed / detailState.baseSpeed //1
+    const rate = runtime.basePlayRate; // 播放倍率
     const start = difftime + (item.sourceRelativeTime || item.relativeTime) - starTime
     const end = difftime + (item.sourceRelaEndtime || item.relaEndtime) - starTime
     // console.log(start, end, starTime)