视频已学显示进度条b

This commit is contained in:
禺狨 2023-05-30 18:13:10 +08:00
parent 0075a848e3
commit 97f4abfe41

View File

@ -129,7 +129,9 @@ const CoursePalyPage = () => {
const initDPlayer = (playUrl: string, isTrySee: number, params: any) => { const initDPlayer = (playUrl: string, isTrySee: number, params: any) => {
let banDrag = let banDrag =
systemConfig.playerIsDisabledDrag && watchRef.current < totalRef.current; systemConfig.playerIsDisabledDrag &&
watchRef.current < totalRef.current &&
watchRef.current === 0;
window.player = new window.DPlayer({ window.player = new window.DPlayer({
container: document.getElementById("meedu-player-container"), container: document.getElementById("meedu-player-container"),
autoplay: false, autoplay: false,
@ -155,7 +157,8 @@ const CoursePalyPage = () => {
window.player.on("timeupdate", () => { window.player.on("timeupdate", () => {
let currentTime = parseInt(window.player.video.currentTime); let currentTime = parseInt(window.player.video.currentTime);
if ( if (
banDrag && systemConfig.playerIsDisabledDrag &&
watchRef.current < totalRef.current &&
currentTime - playRef.current >= 2 && currentTime - playRef.current >= 2 &&
currentTime > watchRef.current currentTime > watchRef.current
) { ) {
@ -166,7 +169,11 @@ const CoursePalyPage = () => {
} }
}); });
window.player.on("ended", () => { window.player.on("ended", () => {
if (banDrag && window.player.video.duration - playRef.current >= 2) { if (
systemConfig.playerIsDisabledDrag &&
watchRef.current < totalRef.current &&
window.player.video.duration - playRef.current >= 2
) {
window.player.seek(playRef.current); window.player.seek(playRef.current);
return; return;
} }