From 6653e794839244c5d028fb2bd34182b9764dfc3c Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 18 Mar 2020 23:08:14 +0800 Subject: [PATCH] fix --- public/react/src/modules/courses/Video/video-play/index.jsx | 6 +++++- 1 file changed, 5 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..a50f6d434 100644 --- a/public/react/src/modules/courses/Video/video-play/index.jsx +++ b/public/react/src/modules/courses/Video/video-play/index.jsx @@ -14,11 +14,13 @@ 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 + } else { } } + console.log(pos) return sum } const regex = /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i @@ -115,6 +117,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => { } //循环播放, 累计时长不能清空 async function onEnded() { + pos.push(el.current.currentTime) log(() => { logId = null lastUpdatedTime = 0 @@ -180,6 +183,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() } }