From 7616079e6180bafdc8da5463b837fbdcc30ca44a Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 23:09:58 +0800 Subject: [PATCH] fix --- public/react/src/modules/courses/Video/video-play/index.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Video/video-play/index.jsx b/public/react/src/modules/courses/Video/video-play/index.jsx index bfa56c938..77c64f73c 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -14,7 +14,7 @@ function getTotalEffectTime(pos) { pos.sort(compareNumbers) let sum = 0 for (let i = 0; i < pos.length - 1; i++) { - let v = pos[i + 1] - pos[i] + let v = Math.abs(pos[i + 1] - pos[i]) if (v < 21) { sum += v } @@ -115,6 +115,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { } //循环播放, 累计时长不能清空 async function onEnded() { + pos.push(el.current.currentTime) log(() => { logId = null lastUpdatedTime = 0 @@ -180,6 +181,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { el.current.removeEventListener('seeked', onSeeked) el.current.removeEventListener('timeupdate', onTimeupdate) if (el.current.playing) { + pos.push(lastUpdatedTime, el.current.currentTime) log() } }