Przeglądaj źródła

fix danmaku seek

DIYgod 8 lat temu
rodzic
commit
7a8a2ac7ba
3 zmienionych plików z 19 dodań i 11 usunięć
  1. 0 0
      dist/DPlayer.min.js
  2. 0 0
      dist/DPlayer.min.js.map
  3. 19 11
      src/DPlayer.js

Plik diff jest za duży
+ 0 - 0
dist/DPlayer.min.js


Plik diff jest za duży
+ 0 - 0
dist/DPlayer.min.js.map


+ 19 - 11
src/DPlayer.js

@@ -830,6 +830,14 @@ class DPlayer {
         }
 
         this.video.currentTime = time;
+
+        for (let i = 0; i < this.dan.length; i++) {
+            if (this.dan[i].time >= time) {
+                this.danIndex = i;
+                return;
+            }
+            this.danIndex = this.dan.length;
+        }
     }
 
     /**
@@ -1140,17 +1148,17 @@ class DPlayer {
             flvPlayer.load();
         }
 
-        if (this.option.danmaku) {
-            this.video.addEventListener('seeking', () => {
-                for (let i = 0; i < this.dan.length; i++) {
-                    if (this.dan[i].time >= this.video.currentTime) {
-                        this.danIndex = i;
-                        return;
-                    }
-                    this.danIndex = this.dan.length;
-                }
-            });
-        }
+        // if (this.option.danmaku) {
+        //     this.video.addEventListener('seeking', () => {
+        //         for (let i = 0; i < this.dan.length; i++) {
+        //             if (this.dan[i].time >= this.video.currentTime) {
+        //                 this.danIndex = i;
+        //                 return;
+        //             }
+        //             this.danIndex = this.dan.length;
+        //         }
+        //     });
+        // }
 
 
         /**

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików