我正在尝试创建一个视频,该视频会在您单击按钮后跳转到视频中的某个点后自动播放。我有它,以便视频跳转到现场,但我不知道如何让它从那里自动播放。我是 javascript 新手,我认为可能缺少一个简单的解决方案。
function Fwd(){
if (video.currentTime < 17.91 && video.currentTime >= 0)
{ (video.currentTime = 17.92)
}
else if (video.currentTime < 35.93 && video.currentTime > 17.91)
{ (video.currentTime = 35.94)
}
}
这是我的一些html
<div id="sideright">
<input type="button" id="fwdButton" onclick="Fwd()" class="button_fwdrew" />
</div>
<video id="video" width="896" height="504" data-setup="{}" >
<source src="video/myAwesomeVideo.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="video/myAwesomeVideo.webmhd.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="video/myAwesomeVideo.oggtheora.ogv" type='video/ogg; codecs="theora, vorbis"' />
<p>Your browser doesn't support HTML5. Maybe you should upgrade.</p>
</video>
这是我的更多 JavaScript
var v = document.getElementById("video")[0];
v.volume = .5;
v.pause();
video.onpause = video.onplay = function(e) {
playpause.value = video.paused ? 'Play' : 'Pause';
}