我可以播放视频,5秒钟后暂停。当它暂停5秒时,我想让一个按钮出现在屏幕中间。单击按钮时,我希望当前时间设置为20秒,按钮消失,视频播放为20秒。我不知道怎么执行这个。
这就是我目前为止所拥有的:
JS
var video = document.getElementById("myvid");
video.addEventListener("timeupdate", function(){
if(this.currentTime >= 5) {
this.pause();
//need to call for the button to appear in the video screen. overlay?
//when the button is clicked, call the skip() function
//button needs to disappear
}
});
function skip(){
video.currentTime = 20;
video.play();
}
HTML
<div id="wrapper">
<video id="myvid" width="320" height="240" controls>
<source src="video.mp4" type="video/mp4">
</video>
//would i put an onclick button here?
</div>
既然现在是一个按钮,我还需要.css吗?