From 90a8cb650986b3cd70b0f9389a27da440df16e4f Mon Sep 17 00:00:00 2001 From: supalerk-ar66 Date: Thu, 29 Jan 2026 17:17:40 +0700 Subject: [PATCH] feat: add classroom learning page with video player and robust progress tracking --- Frontend-Learner/pages/classroom/learning.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Frontend-Learner/pages/classroom/learning.vue b/Frontend-Learner/pages/classroom/learning.vue index 1791c8cd..af8915fa 100644 --- a/Frontend-Learner/pages/classroom/learning.vue +++ b/Frontend-Learner/pages/classroom/learning.vue @@ -169,7 +169,7 @@ const loadLesson = async (lessonId: number) => { const resumeTime = Math.max(serverProgress, localProgress) if (resumeTime > 0) { - console.log(`Resuming at: ${resumeTime}s (Server: ${serverProgress}, Local: ${localProgress})`) + initialSeekTime.value = resumeTime maxWatchedTime.value = resumeTime currentTime.value = resumeTime @@ -266,7 +266,7 @@ const performSaveProgress = async (force: boolean = false, keepalive: boolean = lastSavedTime.value = maxSec lastSavedTimestamp.value = now - console.log(`Saving Server: ${maxSec}/${durationSec} (KeepAlive: ${keepalive})`) + const res = await saveVideoProgress(currentLesson.value.id, maxSec, durationSec, keepalive) @@ -376,7 +376,7 @@ onBeforeUnmount(() => { const handleVisibilityChange = () => { if (document.hidden) { - console.log('Tab hidden, saving progress...') + if (currentLesson.value?.id) { saveLocalProgress(currentLesson.value.id, maxWatchedTime.value) } @@ -407,7 +407,7 @@ watch(isPlaying, (playing) => { // เมื่อวิดีโอจบ ให้บันทึกว่าเรียนจบ (Complete) const onVideoEnded = async () => { isPlaying.value = false - console.log('Video Ended') + // Force save progress at 100% await performSaveProgress(true, false) @@ -425,7 +425,7 @@ const onVideoEnded = async () => { } else if (res.data.next_lesson_id) { // Auto-advance removed as per request. // User will manually select the next lesson from the sidebar. - console.log('Video finished. Next lesson available:', res.data.next_lesson_id) + } } }