mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
Optimize chapter end time handling in artplayer-plugin-chapter
This commit is contained in:
1 parent
586375eeb0
commit
e11a2da806
5 files changed
+8
-3
No files matched your search
@@ -187,6 +187,7 @@ function artplayerPluginChapter(option = {}) {
|
||||
for(let i = 0; i < chapters.length; i++){
|
||||
const chapter = chapters[i];
|
||||
const nextChapter = chapters[i + 1];
|
||||
if (chapter.end === Infinity) chapter.end = art.duration;
|
||||
if (typeof chapter.start !== "number" || typeof chapter.end !== "number" || typeof chapter.title !== "string") throw new Error("Illegal chapter data type");
|
||||
if (chapter.start < 0 || chapter.end > art.duration || chapter.start >= chapter.end) throw new Error("Illegal chapter time point");
|
||||
if (nextChapter && chapter.end > nextChapter.start) throw new Error("Illegal chapter time point");
|
||||
|
||||
Reference in new issue
Block a user