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() } }