我正在处理一个功能,即在我的屏幕加载时,应该开始播放一个反向视频(从最后一帧到第一帧)。
它可以在屏幕加载时或者在按钮单击时触发。
目前为止,在StackOverflow的帮助和支持下,我已经实现了播放我的视频,并在一段时间后以相反的方式播放。以下是我使用的代码-
目前为止,在StackOverflow的帮助和支持下,我已经实现了播放我的视频,并在一段时间后以相反的方式播放。以下是我使用的代码-
<!DOCTYPE HTML>
<html>
<head>
<style>
video{
height: 200px;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function() {
var video = document.getElementById('video');
var intervalRewind;
$(video).on('play',function(){
//video.playbackRate = 1.0;
clearInterval(intervalRewind);
});
$(video).on('pause',function(){
video.playbackRate = 1.0;
clearInterval(intervalRewind);
});
$("#speed").click(function() { // button function for 3x fast speed forward
video.playbackRate = 8.0;
});
$("#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);
});
});
</script>
</head>
<body>
<video id="video" controls>
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" type="video/mp4">
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.webm" type="video/webm">
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.ogv" type="video/ogg">
</video>
<button id="speed">Fast Forward</button>
<button id="negative">Rewind</button>
</body>
</html>
现在,我想知道是否有机会直接倒放我的视频,即不向前播放任何持续时间,视频应该开始倒放。