js video.js - 禁止拖动进度条,禁止快进。

if(!isDrag) {
var isMousedown = false;
videoPlayer.on('pause', function() {
if(isMousedown == false) {
 oldTime = videoPlayer.currentTime();
}
});
videoPlayer.on('play', function() {
isMousedown = false;
newTime = videoPlayer.currentTime();
if(newTime < maxTime) {
videoPlayer.currentTime(newTime);
} else {
videoPlayer.currentTime(oldTime);
};
});
$(".vjs-progress-holder").mousedown(function() {
isMousedown = true;
oldTime = videoPlayer.getCache().currentTime;
});
videoPlayer.on('timeupdate', function() {
if(videoPlayer.currentTime() > maxTime && !isMousedown) {
maxTime = videoPlayer.currentTime();
}
});
}

转载于:https://www.cnblogs.com/duanyuanyuan/p/8317543.html

你可能感兴趣的:(js video.js - 禁止拖动进度条,禁止快进。)