From 47a18c5e0da56d1c98a7e367dddfb0b0fc71b7fa Mon Sep 17 00:00:00 2001 From: Factiven Date: Mon, 17 Apr 2023 23:20:32 +0700 Subject: 8th fixes --- components/videoPlayer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'components') diff --git a/components/videoPlayer.js b/components/videoPlayer.js index 5d35874..b5f8412 100644 --- a/components/videoPlayer.js +++ b/components/videoPlayer.js @@ -83,16 +83,18 @@ export default function VideoPlayer({ } }); - art.on("destroy", () => { + art.on("video:timeupdate", () => { const currentTime = art.currentTime; const duration = art.duration; const percentage = currentTime / duration; + // console.log(percentage); + if (percentage >= 0.9) { // use >= instead of > markProgress(aniId, progress, stats); - } else { - return; + art.off("video:timeupdate"); + console.log("Video progress marked"); } }); -- cgit v1.2.3