yangg 1 mēnesi atpakaļ
vecāks
revīzija
aaac1e6959
1 mainītis faili ar 20 papildinājumiem un 9 dzēšanām
  1. 20 9
      pages/identity-verify/identity-verify.vue

+ 20 - 9
pages/identity-verify/identity-verify.vue

@@ -256,6 +256,7 @@ export default {
       currentFollowUpQuestion: null, // 添加当前追问问题的完整信息
       lastQuestionWasFollowUp: false,
       lastFollowUpQuestionId: null,
+      lastUpdateTime: Date.now(), // 添加最后更新时间戳
     }
   },
   mounted() {
@@ -2316,7 +2317,7 @@ export default {
       container.appendChild(img);
     },
 
-    // 完全禁用视频拖动和进度控制
+    // 修改 handleTimeUpdate 方法
     handleTimeUpdate(e) {
       // 获取当前视频播放时间
       const currentTime = e.detail.currentTime || e.target.currentTime;
@@ -2348,14 +2349,23 @@ export default {
         return;
       }
       
-      // 更严格的跳转检测:任何超过0.3秒的时间跳跃都视为异常
-      // 但排除视频自然结束和新视频开始的情况
-      if (Math.abs(currentTime - this.historyTime) > 0.3 && this.historyTime > 0) {
+      // 计算时间差
+      const timeDiff = Math.abs(currentTime - this.historyTime);
+      
+      // 更宽松的跳转检测:
+      // 1. 只有大于1秒的时间跳跃才视为异常
+      // 2. 排除视频自然结束和新视频开始的情况
+      // 3. 添加自然播放速率的容差
+      if (timeDiff > 1 && this.historyTime > 0) {
         // 排除视频接近结束的情况
-        const isNearEnd = duration > 0 && (duration - this.historyTime < 0.5);
-        
-        // 如果不是接近结束,则视为异常跳转
-        if (!isNearEnd) {
+        const isNearEnd = duration > 0 && (duration - this.historyTime < 1);
+        // 排除视频刚开始的情况
+        const isJustStarted = currentTime < 1;
+        // 检查是否是自然播放速率(允许0.9-1.1倍的播放速度)
+        const isNaturalPlayback = timeDiff < 1.1 * (Date.now() - this.lastUpdateTime) / 1000;
+        
+        // 如果不是以上任何情况,则视为异常跳转
+        if (!isNearEnd && !isJustStarted && !isNaturalPlayback) {
           console.log('检测到视频时间异常跳转,回退到历史时间', this.historyTime);
           let videoContext = uni.createVideoContext('myVideo', this);
           videoContext.seek(this.historyTime);
@@ -2363,8 +2373,9 @@ export default {
         }
       }
       
-      // 更新历史时间 - 只有小幅度的自然播放才会更新历史时间
+      // 更新历史时间和最后更新时间戳
       this.historyTime = currentTime;
+      this.lastUpdateTime = Date.now();
       
       // 以下是字幕处理逻辑
       let currentSubtitles = null;