停止播放视频3秒钟,然后继续

时间:2018-07-18 22:55:53

标签: javascript html

我的网页上有视频背景,我想将此视频停止3-4秒,然后继续(循环播放)。我该怎么办?

我有此代码:

var data = _dbContext.Project
    .Select(p => new ProjectViewModel
    {
        Id = p.Id,
        Details = p.ProjectDetails
            .Select(pd => new KeyValuePair<string, List<string>>(pd.DetailDescription, pd.ProjectDetailsAnswers.Select(pda => pda.AnswerDescription).ToList()))
            .ToList()
    })
   .ToList();

1 个答案:

答案 0 :(得分:0)

以下是使用JavaScript的示例:

const video = document.getElementById('myVideo');
video.currentTime = 5; // Video will jump to 5th second
video.pause();
setInterval(() => {
	video.play();
}, 3000);
<video id="myVideo" autoplay loop>
  <source src="https://www.w3schools.com/jsref/movie.mp4" type="video/mp4">
  <source src="https://www.w3schools.com/jsref/movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>