Jquery 如何让html5视频在点击按钮时倒带,在再次点击按钮时向前播放?
我的第一个问题,很抱歉,如果我犯了错误:格式 我的目标是创建一个ui,当你登陆页面时,html5视频将自动播放。单击按钮时,视频将倒带。再次单击按钮时,视频将从视频倒带的位置向前播放 目前,它只是倒带和再次点击按钮只是保持倒带。我只需要它在Chrome上运行。我读过的所有东西,甚至自定义按钮,都有多个按钮控制倒带、快进等 代码:Jquery 如何让html5视频在点击按钮时倒带,在再次点击按钮时向前播放?,jquery,html,video,Jquery,Html,Video,我的第一个问题,很抱歉,如果我犯了错误:格式 我的目标是创建一个ui,当你登陆页面时,html5视频将自动播放。单击按钮时,视频将倒带。再次单击按钮时,视频将从视频倒带的位置向前播放 目前,它只是倒带和再次点击按钮只是保持倒带。我只需要它在Chrome上运行。我读过的所有东西,甚至自定义按钮,都有多个按钮控制倒带、快进等 代码: <div class="video-player-box"> <video id="video" autoplay loop controls&
<div class="video-player-box">
<video id="video" autoplay loop controls>
<source src="video/SugarTestV2.mp4" type="video/mp4">
</video>
</div>
<!--video player box-->
<div id="buttoncontainer">
<button id="negative">Rewind</button>
</div>
$(document).ready(function() {
var video = $("#video");
var intervalRewind;
$(video).on('play', function() {
video.playbackRate = 1.0;
clearInterval(intervalRewind);
});
$(video).on('pause', function() {
video.playbackRate = 1.0;
clearInterval(intervalRewind);
});
$("#negative").click(function() { // button function for rewind
intervalRewind = setInterval(function() {
video.playbackRate = 1.0;
if (video.currentTime == 0) {
clearInterval(intervalRewind);
video.pause();
} else {
video.currentTime += -.1;
}
}, 30);
});
});