我有一个html5视频播放器,我想在特定时间播放(例如6:10到6:20),然后从6:10再次开始播放,这对我来说很好,但是当我&#39 ;我试图手动设置从另一个不同于6:10的时间开始,我不能这样做......它跳到6:10。
var videoPlayer = document.createElement('video');
var videoStartTime = 0;
var durationTime = 0;
videoPlayer.src = video.src;
videoPlayer.id = "videoPlayer";
videoPlayer.setAttribute('autoplay',true);
videoPlayer.setAttribute('controls',true);
videoPlayer.addEventListener('play', function() {
videoStartTime = time;
durationTime = 10;
videoPlayer.currentTime = videoStartTime;
}, false);
videoPlayer.addEventListener('timeupdate', function() {
if(videoPlayer.currentTime > videoStartTime + durationTime){
videoPlayer.currentTime = videoStartTime;
}
});