diff --git a/src/pages/course/compenents/hour.tsx b/src/pages/course/compenents/hour.tsx index 9af7790..c8f517c 100644 --- a/src/pages/course/compenents/hour.tsx +++ b/src/pages/course/compenents/hour.tsx @@ -49,7 +49,7 @@ export const HourCompenent: React.FC = ({ }; const goNextVideo = () => { - const index = totalHours.findIndex((i: any) => i.id === id); + const index = totalHours.findIndex((i: any) => i.id === currentId); if (index === totalHours.length - 1) { setIsLastpage(true); } else if (index < totalHours.length - 1) { diff --git a/src/pages/course/compenents/video.tsx b/src/pages/course/compenents/video.tsx index 9f37261..d4f655b 100644 --- a/src/pages/course/compenents/video.tsx +++ b/src/pages/course/compenents/video.tsx @@ -35,6 +35,7 @@ export const VideoModel: React.FC = ({ const [playDuration, setPlayDuration] = useState(0); const [playendedStatus, setPlayendedStatus] = useState(false); const [lastSeeValue, setLastSeeValue] = useState({}); + const [loading, setLoading] = useState(false); const myRef = useRef(0); useEffect(() => { @@ -94,6 +95,7 @@ export const VideoModel: React.FC = ({ playTimeUpdate(parseInt(window.player.video.currentTime), true); window.player && window.player.destroy(); }); + setLoading(false); }; const playTimeUpdate = (duration: number, isEnd: boolean) => { @@ -143,6 +145,10 @@ export const VideoModel: React.FC = ({
{ + if (loading) { + return; + } + setLoading(true); setLastSeeValue({}); setPlayendedStatus(false); goNextVideo();