HTMLVideoElement.prototype.playBackwards = function() {
this.pause();
var video = this;
var fps = video.fps || 25;
var wait = 1000 / fps;
var intervalRewind = setInterval(function() {
//if (video.seeking) return ;
if(video.currentTime == 0){
clearInterval(intervalRewind);
video.pause();
}
else {
video.currentTime += -(1/fps);
//console.log(video.currentTime)
}
}, wait);
};
问题/缺陷: 视频文件较长较大情况, 每一次的 currentTime
变化, video 都在 seeking 状态,而且时间较长, 不适用于大视频倒放