mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-29 03:14:58 +08:00
视频播放连续跳转下一节优化
This commit is contained in:
parent
519907de2a
commit
808cfc67a7
@ -49,7 +49,7 @@ export const HourCompenent: React.FC<PropInterface> = ({
|
||||
};
|
||||
|
||||
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) {
|
||||
|
@ -35,6 +35,7 @@ export const VideoModel: React.FC<PropInterface> = ({
|
||||
const [playDuration, setPlayDuration] = useState(0);
|
||||
const [playendedStatus, setPlayendedStatus] = useState<Boolean>(false);
|
||||
const [lastSeeValue, setLastSeeValue] = useState({});
|
||||
const [loading, setLoading] = useState<Boolean>(false);
|
||||
const myRef = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
@ -94,6 +95,7 @@ export const VideoModel: React.FC<PropInterface> = ({
|
||||
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<PropInterface> = ({
|
||||
<div
|
||||
className={styles["alert-button"]}
|
||||
onClick={() => {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
setLastSeeValue({});
|
||||
setPlayendedStatus(false);
|
||||
goNextVideo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user