mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-29 07:32:50 +08:00
视频播放连续跳转下一节优化
This commit is contained in:
parent
519907de2a
commit
808cfc67a7
@ -49,7 +49,7 @@ export const HourCompenent: React.FC<PropInterface> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const goNextVideo = () => {
|
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) {
|
if (index === totalHours.length - 1) {
|
||||||
setIsLastpage(true);
|
setIsLastpage(true);
|
||||||
} else if (index < totalHours.length - 1) {
|
} else if (index < totalHours.length - 1) {
|
||||||
|
@ -35,6 +35,7 @@ export const VideoModel: React.FC<PropInterface> = ({
|
|||||||
const [playDuration, setPlayDuration] = useState(0);
|
const [playDuration, setPlayDuration] = useState(0);
|
||||||
const [playendedStatus, setPlayendedStatus] = useState<Boolean>(false);
|
const [playendedStatus, setPlayendedStatus] = useState<Boolean>(false);
|
||||||
const [lastSeeValue, setLastSeeValue] = useState({});
|
const [lastSeeValue, setLastSeeValue] = useState({});
|
||||||
|
const [loading, setLoading] = useState<Boolean>(false);
|
||||||
const myRef = useRef(0);
|
const myRef = useRef(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -94,6 +95,7 @@ export const VideoModel: React.FC<PropInterface> = ({
|
|||||||
playTimeUpdate(parseInt(window.player.video.currentTime), true);
|
playTimeUpdate(parseInt(window.player.video.currentTime), true);
|
||||||
window.player && window.player.destroy();
|
window.player && window.player.destroy();
|
||||||
});
|
});
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const playTimeUpdate = (duration: number, isEnd: boolean) => {
|
const playTimeUpdate = (duration: number, isEnd: boolean) => {
|
||||||
@ -143,6 +145,10 @@ export const VideoModel: React.FC<PropInterface> = ({
|
|||||||
<div
|
<div
|
||||||
className={styles["alert-button"]}
|
className={styles["alert-button"]}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
setLastSeeValue({});
|
setLastSeeValue({});
|
||||||
setPlayendedStatus(false);
|
setPlayendedStatus(false);
|
||||||
goNextVideo();
|
goNextVideo();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user